Ignore specific * lines * when merging files

I have a repository with two branches, Aand B.

They are intended for the same code, but are intended for different versions of the libraries on which they depend.

So, it A/file1.jsmay have a fragment in it:

this.actor.bar();

while it B/file1.jsmay have:

// `bar` had its name changed to `foo` in version X.Y of library Z
this.actor.foo();

Then I talk to Aand make a whole bunch of changes compatible with both versions of the library Z, and I want to merge them into B.

Is there a way I can tell mercurial to "do a merge but ignore the lines where *.bar()it gets *.foo()"?

Basically, there are several blocks of code that differ between branches Aand Bbecause of the version of the library they depend on, but I wrote code like asides from these lines, the rest of the code is identical.

I just don’t want to deal with these blocks of code every time I merge, because otherwise I am more prone to stick together the merge and switch some of these blocks.

The only thing I can imagine is somehow to create a different diff preset for each file that calls diff --ignore-matching-lines [impressively_long_argument], which is common for each file - this seems like the wrong way to do it!

( git? , , , . , , diff),.

+1
1

Git, Mercurial , ( , , , svn CVS). , git Mercurial merge .

, A B, bar foo A, :

hg update B
hg merge A

, A, B. bar to foo, , .

:

hg update B
hg merge A

, A, A, , bar foo, , , A foo, B bars, , B, .

, CVS . , , A, B, , , - : "oh, , ".

+2

All Articles