Merge algorithms
Andrew Bennetts
andrew.bennetts at canonical.com
Thu Sep 23 01:20:30 BST 2010
Eli Zaretskii wrote:
> > Date: Mon, 20 Sep 2010 13:31:53 +1000
> > From: Andrew Bennetts <andrew.bennetts at canonical.com>
> > Cc: mbp at canonical.com, bazaar at lists.canonical.com
> >
> > bzr help changelog_merge
>
> This says, inter alia:
>
> To enable this plugin, add a section to your branch.conf or location.conf
> like::
>
> [/home/user/proj]
> changelog_merge_files = ChangeLog
>
> The changelog_merge_files config option takes a list of file paths, separated
> by commas.
>
> Just to make sure I understand the semantics of this: what exactly
> does /home/user/proj stand for here? Is this the root of a branch in
Sorry, that help is a little unclear. The [path] heading only applies to
location.conf (usually found in ~/.bazaar/location.conf), not a branch.conf.
location.conf is a way to set configuration for all branches under a particular
location of your filesystem.
<http://doc.bazaar.canonical.com/latest/en/user-reference/configuration-help.html#the-branch-location-configuration-file-locations-conf>
In a branch.conf (found in .bzr/branch of a branch) you can just put the "option
= value" part.
For instance, I enable news_merge for all my bzr branches with this in my
locations.conf (and never touch the individual branch.conf files):
[/home/andrew/warthogs/bzr]
news_merge_files = NEWS
(To be completely explicit, my branches are at paths like
/home/andrew/warthogs/bzr/fix-bug-1234.)
As a brief aside, I generally prefer putting settings in locations.conf to
branch.conf, because I only need to set it once no matter how many branches I
create (or how I create them). Here's another part of my locations.conf, for my
non-work code:
[/home/andrew/code]
email = Andrew Bennetts <andrew at bemusement.org>
push_location = lp:~spiv
push_location:policy = appendpath
So if I have a branch at /home/andrew/code/twisted/fix-bug-1234 then 'bzr push'
will automatically known to push it to lp:~spiv/twisted/fix-bug-1234 (that's the
"appendpath" magic). And commits I make to that branch will use my non-work
email address.
> which I want the ChangeLog files to be merged by this plugin? Or do I
> need to specify the subdirectories of the branch explicitly? If the
> subdirectories do not need to be mentioned explicitly, then why do I
> need the path at all, in a branch.conf file of a branch where I want
> to use this plugin?
IIRC, the filename is relative to the root of the tree, so "ChangeLog" will not
match "src/ChangeLog". If you need a more flexible policy let me know and I'll
figure out how to adjust the plugin.
> Also, will "bzr remerge" use this plugin automatically, given the
> above addition to branch.conf?
Yes. So "bzr --no-plugins remerge ChangeLog" is a relatively easy way to
compare what happens without the plugin enabled. (You could also set
BZR_DISABLE_PLUGINS=changelog_merge in your environment to disable just that
one plugin.)
-Andrew.
More information about the bazaar
mailing list