Avoiding conflicts in .hgtags
Peter Arrenbrecht
peter.arrenbrecht at gmail.com
Mon Dec 15 06:38:53 UTC 2008
On Fri, Dec 12, 2008 at 10:14 PM, Matt Mackall <mpm at selenic.com> wrote:
> On Fri, 2008-12-12 at 11:05 -0500, Greg Ward wrote:
>> On 08 December 2008, Arne Babenhauserheide said:
>> > Am Montag 08 Dezember 2008 19:52:14 schrieb Greg Ward:
>> > > [merge-patterns]
>> > > .hgtags = hgmergetags
>> > >
>> > > [merge-tools]
>> > > hgmergetags.args = $local $base $other > $output
>> > >
>> > > Script attached. Feedback welcome.
>> >
>> > I just tried it with groups and then skimmed over the code to see that it
>> > needs the layout of .hgtags.
>> >
>> > What is your reason for not just checking if lines are equal, that way making
>> > a merger for any kind of append/remove-only file?
>>
>> Because .hgtags is *not* an append/remove-only file: tags can be
>> changed. The trick is that it *is* a context-free file; you can merge
>> three copies of .hgtags by looking at each tag in isolation from the
>> others. Because the merge is content-based rather than textual, you
>> should only get conflicts when there is a real conflict. (E.g. you and
>> I both modify a tag to point to a different changeset, or you modify it
>> and I delete it.)
>>
>> It does seem that there ought to be one merge algorithm for all these
>> special .hg* files, but I don't know what it is. Maybe it's not
>> possible.
>
> The special files are:
>
> .hgignore
> .hgtags
> .hgsigs (only with the GPG extension)
>
> All three can be merged just fine by normal textual merge tools.
>
> You could write an automated tool that would handle some of the bogus
> conflicts in hgtags, but you'd still have to deal with real conflicts
> (two people adding the same tag pointing to different things).
>
> But if you regularly have to merge tags files, you probably have a
> process problem.
Depends. Someone might be using tag rewriting as some sort of
bookmark. But, more importantly, once extensions start picking up the
conventions used by the core by introducing other such files, we might
see even more of a need for such merges. Possible cases in point:
groups, bookmarks, subrepos. So I think the idea of having a dedicated
merger for position-independent files like .hgtags in the core is
sound.
-parren
More information about the Mercurial
mailing list