plugin not working on lightweight checkouts
Sebastien Alaiwan
sebastien.alaiwan at gmail.com
Sun Nov 29 08:53:33 UTC 2015
I tested your plugin with a single standalone tree.
I was expecting it to react on "bzr update" and "bzr commit".
However, it only seems to react on "bzr commit".
Test of "bzr update":
*$ bzr up*
Tree is up to date at revision 77 of branch /tmp/deeep
*$ head revno -n 1*
77
*$ bzr up -r 75*
M README
All changes applied successfully.
Updated to revision 75 of branch /tmp/deeep
*$ head revno -n 1*
77
*$ *
Test of "bzr commit":
*$ **bzr up*
M README
All changes applied successfully.
Updated to revision 77 of branch /tmp/deeep
*$**echo "Hello" >> README *
*$**bzr commit -m "Test"*
Committing to: /tmp/deeep/
modified README
/update_revno_file//(this is my debug trace).
/Committed revision 78.
*$ head revno -n 1*
78
This might be related to the problem you're having.
Is this the expected behaviour? Not updating the "revno" file on "bzr update -r XXX" commands seems error-prone, as you might want to build older revisions of your project.
I was about to suggest to directly use, from your build system, the ".bzr/branch/last-revision" file.
However, this will couple your build system to bazaar ; which you probably want to avoid.
Cheers,
Sebastien
On 2015-11-28 09:35, Chris Hecker wrote:
>
> 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?
>
> I didn't immediately see another hook at http://doc.bazaar.canonical.com/bzr.dev/en/user-reference/hooks-help.html that would help, but I admit I skimmed it...
>
> Thanks,
> Chris
>
>
>
>
> """Update the "revno" file when the branch changes.
>
> This post_change_branch_tip hook puts the current revno in a file called
> "revno" in the base directory of the current branch, if it exists. If "revno"
> doesn't exist, then it is not created."""
>
> from bzrlib import branch
> version_info = (1, 0, 0, 'final', 0)
>
> def update_revno_file(params):
> from bzrlib import errors
> try:
> trans = params.branch.bzrdir.root_transport
> path = trans.local_abspath('revno')
> except errors.NotLocalUrl:
> return # Nothing to do for a remote URL
> import os.path
> if os.path.isfile(path):
> f = open(path,'w')
> f.write('%s\n%s' % (params.new_revno,params.new_revid))
> f.close()
>
> branch.Branch.hooks.install_named_hook('post_change_branch_tip',
> update_revno_file,
> 'Update "revno" file on branch change, if it exists.')
>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.ubuntu.com/archives/bazaar/attachments/20151129/748f2078/attachment.html>
More information about the bazaar
mailing list