plugin not working on lightweight checkouts
checker at d6.com
Sat Nov 28 14:24:18 UTC 2015
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.
On Nov 28, 2015 2:18 AM, "Sebastien Alaiwan" <ace17 at free.fr> wrote:
> Hi Chris,
> (I don't know a lot about writing bazaar plugins - I try hard to avoid
> having to write one.)
> 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'.
> This is what I usually do.
> Hope this helps!
> 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
> 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
> > 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...
More information about the bazaar