How to tell Mercurial to automatically accept “their” version during a merge conflict of any files in a particular directory?
-
09-12-2019 - |
سؤال
First off, I would prefer not to check in the generated files at all but my manager insists. So, given those constraints I would like to create a mercurial "merge-patterns" that will always take "their files" in all directories named "generated" in my working repo. I have read the hgrc documentation and a related post and here is what I think it should look like:
[merge-patterns]
generated/** = internal:other #keep their files
And this is placed in my root .hg/hgrc file. When I run the hg update with the merge conflicts this is what I get:
> hg update
couldn't find merge tool internal:other #keep their files specified for generated/**
merging generated/file.sv
So I modified the "merge-patterns" to look like this:
[merge-patterns]
**/generated/** = internal:other #keep their files
And here is what I get:
> hg update
merging generated/file.sv
So, I no longer get the "couldn't find merge tool internal:other" warning but it is still trying to merge the generated files.
Any ideas on how to get this to work?
Additional notes:
- We are using Mercurial version 1.7.5 as we were having problems with newer versions and subrepos.
- I am working with subrepos so here is what the structure of my main repo looks like:
المحلول
I believe the problem is simply the comment! Mercurial is searching for a tool named
internal:other #keep their files
and that's unlikely to exist :-) Try moving the comment to a line above:
[merge-patterns]
# keep their files
generated/** = internal:other
I haven't tested this out, but I believe you still need the first pattern you used — the warning went away with your second try because the pattern no longer matched inside the subrepo. Even when you start the merge from the top-level, the subrepos are merged as if hg merge
was executed inside the subrepo.