Starting another plugin project

Asked by ybdjkfd on 2011-12-05

I have looked over your plugin and a the code from push and update. My company wanted to auto update a bound master location so that everyone can see changes in the code. They did not desire to use branching and management prefers the "central" repository method like SVN, SourceSafe, etc. So I created a plugin that updates on post-commit on the master location. This may be a bad post-commit operation, but I wanted to know how I could share the plugin if it was a safe idea and others desired it. It seems I should also check if it is bound to a central location.

"""Update master from bound checkout plugin for Bazaar"""

import subprocess

from bzrlib import (

def update_master_after_commit(local, master, old_revno, old_revid, new_revno, new_revid):
    """Update the target branch's working copy.
    Code borrowed from bzr-automirror."""
    print 'Trying to call updatemaster on Master repository . . .'
    # Place the following two in a precommit hook so that it works there
    #lt = master.bzrdir.open_workingtree()
        wt = master.bzrdir.open_workingtree()
    except errors:
        print 'Cannot update Master repository. See other errors.'
        print 'Master repository updated.'

branch.Branch.hooks.install_named_hook("post_commit", update_master_after_commit,

Question information

English Edit question
Bazaar automirror plugin Edit question
No assignee Edit question
Last query:
Last reply:
Martin Pool (mbp) said : #1


I think this would be reasonable to have in the bzr core, as long as it is off by default and reasonably well tested. I don't see anything bad about it.

That will probably be easier than asking people to install a separate plugin just to get this fairly small bit of code.

Note that wt.update probably won't work if the wt is remote, but we will probably fix that later.

The main changes you would need to do to have this merged to trunk are:
 - don't print, work through the ui
 - check a variable something like 'commit.update_master' in the branch configuration
 - don't squash the errors - but you may need to specifically handle NoWorkingTree or some such
 - add at least a simple blackbox integration test

We will help you with any of those you get stuck on.

To contribute a patch to bzr see

Generically to make a new lp project see eg but as I say that's probably not the right choice here.

Thanks for suggesting this, it will be a nice feature.

Can you help with this problem?

Provide an answer of your own, or ask ybdjkfd for more information if necessary.

To post a message you must log in.