Avoiding conflicts in .hgtags
Matt Mackall
mpm at selenic.com
Thu Dec 18 21:49:16 CST 2008
On Thu, 2008-12-18 at 21:24 -0500, Greg Ward wrote:
> On 12 December 2008, Matt Mackall said:
> > 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.
>
> I disagree. What about this process:
>
> * develop on trunk
> * tag "1.0"
> * branch "1.0-maint"
> * on the branch: fix bugs
> * on the branch: tag "1.0.1"
> * return to trunk, develop some more
> * tag "1.1"
> * merge "1.0-maint"
>
> First, that is (IMHO) a perfectly valid reason to merge .hgtags. The
> only way to avoid it is to always create/remove/modify tags on the
> trunk, which seems rather awkward.
Well this doesn't meet my "regularly have to" criterion. Usually only
one or a few people are tagging releases and pushing branch merges, no?
> Second, that example creates a bogus conflict in .hgtags between tag
> 1.1 and 1.0.1. My hgmergetags script handles that case just fine,
> since it's a "content-aware" merge rather than a generic textual
> merge. Would be nice if Mercurial supported something like that out
> of the box, but I can't swear that my script is the most elegant
> solution.
There's another factor in my lack of excitement on this front. As it
happens, a fully-correct merge algorithm for .hgtags is not easy (or
probably even well-defined). The method by which hgtags selects what the
current value of tags across multiple branches is actually fairly
non-intuitive. When there's no semantic conflicts, it's easy. When
different branches disagree about the value of tags, it's hard. Hard
enough that you probably want to launch a textual merge tool anyway.
I try to strike a balance between simplicity of use and simplicity of
design and having a complex, specialized, and *still not perfect* merge
algorithm for the relatively rare .hgtags merges just doesn't strike me
as much of a win.
--
Mathematics is the supreme nostalgia of our time.
More information about the Mercurial
mailing list