Support for more lines of context in hg merge?

Daniel Faken dfaken at coventor.com
Fri Sep 23 17:38:06 UTC 2016


Hello all,

   I recently encountered a problem where the Hg automerge inserted some 
duplicate code into the file.

   Basically the inputs were like this:

   ..long stretch of identical code..
   ..line A of identical code except for a change in a function name..
   ..two lines of identical code..
   ..line B of identical code except for a change in a function name..
   ..block of identical code..
  ..long stretch of identical code..

   and the result of automerge was that line A and B are merged 
properly, but the 'block of identical code' gets duplicated.

   It appears this is due to some complex revision history [partly 
involving changes to the 'block of identical code'] since the problem 
doesn't occur if I get rid of the history.

   I can't post the code here, but it appears that a similar situation 
is described at 
http://stackoverflow.com/questions/5003577/how-safe-are-automatic-merges-in-mercurial

   In that Stackoverflow discussion it mentions that the _default_ 
context is three lines wide, and I'm thinking that our problems might be 
lessened with more context.  (though i realize we might get more prompts 
for manual merges as well)

   So my question: is there some way to specify an increased number of 
lines to use for context?

   The only option I could find was for the diff tool, but the help 
explicitly says this is only for the diff tool.

thanks for any help!
Daniel Faken



More information about the Mercurial mailing list