John
John

Reputation: 1021

Mercurial - How to mark files not to be merged

I am using a named branch for a customer specific version. On this branch, I have some files that are customer-specific (Branding, logos,...). These files should never be merged to the default branch.

I want to make sure that these customer-specific files will never be merged in the default branch.

Is there a way to mark some files as branch specific in Mercurial?

Upvotes: 1

Views: 70

Answers (2)

Ringding
Ringding

Reputation: 2856

You can use merge-patterns.

hg merge --config merge-patterns.somefile=internal:local otherbranch

Upvotes: 0

planetmaker
planetmaker

Reputation: 6044

No, not that I know of such feature. However, you can merge that branch once into default, taking care to merge into default only what you want to see merged (e.g. hg forget those customer files during the merge into default). In later merges those files you chose to forget in the default branch will be "only" show up with

remote changed customer which local deleted use (c)hanged version, leave (d)eleted, or leave (u)nresolved? d

where you should choose 'd'. An example transcript of such exercise you can find in this paste

If those files are well-known and fairly stable, you could create a commit hook (client-side) and/or a pretxnchangegroup hook (server side) which checks those files not being present in any commit within the default branch, and which rejects the commit when any such file is committed to default.

Upvotes: 1

Related Questions