<p dir="ltr">I don't want to call bzr unless I know it has changed because it is slow compared to checking a file time by make.</p>
<p dir="ltr">Chris<br>
</p>
<div class="gmail_quote">On Nov 28, 2015 2:18 AM, "Sebastien Alaiwan" <<a href="mailto:ace17@free.fr">ace17@free.fr</a>> wrote:<br type="attribution"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Hi Chris,<br>
<br>
(I don't know a lot about writing bazaar plugins - I try hard to avoid having to write one.)<br>
You might get the same result without a custom plugin, by directly using '.bzr/branch/last-revision' from your build system ; or simply by calling 'bzr revno' / 'bzr revno --tree'.<br>
This is what I usually do.<br>
<br>
Hope this helps!<br>
Sebastien<br>
<br>
<br>
On 2015-11-28 09:35, Chris Hecker wrote:<br>
><br>
> I've got this simple plugin that updates a file named 'revno' with the revno and revid at the root of a branch when a checkin or pull happens so I can use it in my build system. It works great, and it's below. But, I was on another machine that has a lightweight checkout of this project and it does not appear to update 'revno' when I push to the repo for this branch remotely, and then update the working copy. Is there anything I can do to fix this easily?<br>
><br>
> I didn't immediately see another hook at <a href="http://doc.bazaar.canonical.com/bzr.dev/en/user-reference/hooks-help.html" rel="noreferrer" target="_blank">http://doc.bazaar.canonical.com/bzr.dev/en/user-reference/hooks-help.html</a> that would help, but I admit I skimmed it...<br>
><br>
> Thanks,<br>
> Chris<br>
><br>
><br>
><br>
><br>
> """Update the "revno" file when the branch changes.<br>
><br>
> This post_change_branch_tip hook puts the current revno in a file called<br>
> "revno" in the base directory of the current branch, if it exists. If "revno"<br>
> doesn't exist, then it is not created."""<br>
><br>
> from bzrlib import branch<br>
> version_info = (1, 0, 0, 'final', 0)<br>
><br>
> def update_revno_file(params):<br>
>     from bzrlib import errors<br>
>     try:<br>
>         trans = params.branch.bzrdir.root_transport<br>
>         path = trans.local_abspath('revno')<br>
>     except errors.NotLocalUrl:<br>
>         return # Nothing to do for a remote URL<br>
>     import os.path<br>
>     if os.path.isfile(path):<br>
>         f = open(path,'w')<br>
>         f.write('%s\n%s' % (params.new_revno,params.new_revid))<br>
>         f.close()<br>
><br>
> branch.Branch.hooks.install_named_hook('post_change_branch_tip',<br>
>                                        update_revno_file,<br>
>                                        'Update "revno" file on branch change, if it exists.')<br>
><br>
><br>
><br>
<br>
</blockquote></div>