Merge algorithms

Andrew Bennetts andrew.bennetts at canonical.com
Sun Nov 7 23:34:17 GMT 2010


Eli Zaretskii wrote:
[...]
> 
> I tried again, and it indeed works, thanks.  I think I know what I did
> wrong previously, when I tried it in ~/.bazaar/locations.conf: the
> file name in [/foo/bar] was not the top-level directory of a bzr
> branch, but rather the top-level directory of a repository, which is
> the parent of several branches.  I now defined several sections
> instead, one each for every branch where I want this functionality.
> Is that the correct setup?

Well it works, so in that sense it's clearly correct :)

But the other way you describe should work too.  i.e. if this is working:

[/foo/bar/x]
changelog_merge_files = lib/ChangeLog

[/foo/bar/y]
changelog_merge_files = lib/ChangeLog

Then this should be just as effective, and also apply to /foo/bar/z:

[/foo/bar]
changelog_merge_files = lib/ChangeLog

My own ~/.bazaar/locations.conf makes extensive use of this feature!

The only difference is that if a [/foo/bar] and a [/foo/bar/x] section both
match for the current location and both define the same setting, then the latter
will win.  Longer locations (as counted by path segment) override shorter (i.e.
less specific) locations.

Incidentally in bzr trunk there's a 'config' command that will help diagnose
these issues in future:

~/code/bzr$ bzr config news_merge_files
locations:
  news_merge_files = NEWS

(Which reminds me, I need to update my news_merge config...)

[...]
> I couldn't find any explicit sign in .bzr.log of the plugin being
> loaded and used.  The only difference between a merge that uses the
> plugin and the one that doesn't is this entry:
> 
>   Base revid: 'eliz at gnu.org-20101029104927-webtjc116gt5cefb'
> 
> (To be more precise, I show below the full log of a merge that used
> the plugin; the merge that doesn't use it looks identical, except that
> the above entry is absent.)  Is that expected?

To be honest I wouldn't have expected it to vary at all!  The plugin doesn't yet
log anything, but at least until it's fully mature and debugged it probably
should.

> > > I also clearly need to tweak the help text, but perhaps I should actually
> > > just remove most of the attempt at quick start help and refer to the main
> > > bzr docs for configuration?  I'm not sure.  Suggestions are welcome!
> > 
> > I will be sure to voice any suggestions I might have once I succeed in
> > getting this to work.  Thanks.
> 
> Re-reading the help text again, I think it's mostly okay, except that
> I would suggest to tell explicitly that [/home/user/proj] should name
> a branch.  There's also a double colon "::" which is probably a typo.

As above, the location can be above a branch.  The :: was intentional
for ReST rendering (it indicates the indented section is preformatted
text)... I thought bzr's help machinery filtered it out, but apparently
it doesn't, at least not for this kind of help.  Hmm...

> Thanks again for this nice feature.  Given enough testing and positive
> feedback from others, I would suggest to make it part of bzrtools.

Great to hear.  Thanks!

-Andrew.




More information about the bazaar mailing list