CAD bloke
CAD bloke

Reputation: 8828

Mercurial premerge = false only for specific files, = true for all others?

Is it possible for Mercurial to automatically merge all changes except for specifically nominated files? For the specific files there are some lines that may be overwritten so I want it to force a manual merge with the visual merge tool.

The use-case for this is pulling from a parent repo and building a different version of an app form the same code. The specific files would include the Visual Studio project file & AssemblyInfo file - I want to retain the version-specific references and .NET framework to build against. For more background of my scenario see http://kiln.stackexchange.com/questions/2320/best-practice-to-maintain-different-build-configs-for-the-same-code

Upvotes: 2

Views: 764

Answers (1)

Ry4an Brase
Ry4an Brase

Reputation: 78350

Yes, you can configure separate merge tools on a per-file basis, and they could differ only by pre-merge flag if you wanted:

[merge-tools]
mymergetool.priority = 100
mymergetool.premerge = True
mymergetool.args = $local $other $base -o $output
mymergetool.executable = /path/to/mergetool

manualmerge.priority = 100
manualmerge.premerge = False
manualmerge.args = $local $other $base -o $output
manualmerge.executable = /path/to/mergetool


[merge-patterns]
filename_to_never_automerge = manualmerge

Full details: https://www.mercurial-scm.org/wiki/MergeToolConfiguration

Upvotes: 5

Related Questions