Useful script: multi-push script to push a hierarchy of branches

Colin D Bennett colin at gibibit.com
Thu Dec 11 06:33:40 GMT 2008


On Thu, 11 Dec 2008 05:33:27 +0200
Alexander Belchenko <bialix at ukr.net> wrote:

> Colin D Bennett пишет:
> > This script pushes a hierarchy of branches from one location to
> > another.  It works better for me than the 'bzr multi-pull' command
> > from bzrtools in many situations, because it will push new
> > branches, while doing a multi-pull from the other end will only
> > pull branches that already exist on that end.
> > 
> > I use this to mirror my treeless shared repositories that I work
> > from between machines.  Because it uses the 'bzr push' command it
> > will create new branches in the destination when they don't already
> > exist.
> > 
> > Caveats
> > -------
> > 
> > - Unlike 'bzr multi-pull', this is just a shell script, so
> >   multiple authentication prompts will occur if SOURCE_ROOT or
> > DEST_ROOT refers to a remote location that requires interactive
> > authentication. Maybe sometime I'll look at multi-pull and see if I
> > can re-implement this multi-push script properly as a bzr plugin
> > command.
> 
> May I persuade you to improve existing repo-push plugin instead of
> writing new one from the scratch?

Yes, you may!  Actually, I didn't know about repo-push.  Thanks for
pointing me toward it.  I just checked it out and it does most of what I
want, in a much better way than I did it, of course.

What repo-push lacks that I desire is the ability to push a tree of
branches that aren't rooted in a common shared repository. For
instance, in my usage I have something like this, to keep all me code
for a particular set of related projects together (then I can back up
just one directory tree to keep all project history):

somewhere/
   work/
     demos/    ---- lightweight checkout
   repos/      ---- root of repositories, but NOT a repo itself
     demos/    ---- shared repo
       trunk/      ---- branch
       feature-X/  ---- branch
     libxyz/   ---- shared repo
       trunk/      ---- branch
       feature-Y/  ---- branch

The point being that the 'demos' and 'libxyz' projects are related in
usage but not in actual content, so it seems more efficient to have
separate shared repositories such that each one is only used for truly
related content in the branches it contains.

Anyway, this would be simple to add, I'm sure, and I may take a look at
it myself.  Do you think it would be acceptable for repo-push to walk
all subdirectories of the source tree (current directory) and push all
branches, so that if I were to run 'bzr repo-push X' from 'somewhere/',
then all the trees below it would be pushed?

Now, to really make this feature complete, it should create multiple
shared repositories in the destination location (as needed) to mirror
the source structure.  Clearly, my shell script doesn't do that either
in the case of pushing to an empty destination (or one without all the
shared repositories that the source has), but if the top-level shared
repositories are already created, then the branches get pushed into
their appropriate locations in the proper shared repositories.

Anyway, I'll play around with it.  Thanks!

Regards,
Colin
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 197 bytes
Desc: not available
Url : https://lists.ubuntu.com/archives/bazaar/attachments/20081210/3d318d0f/attachment.pgp 


More information about the bazaar mailing list