dummy merge (two branches) for dummies

Uwe Brauer oub at mat.ucm.es
Fri Aug 19 18:27:32 UTC 2016




   > If you want to keep more of his files than yours then you would use
   > internal:other and revert your few files back to uwe. If you want to
   > keep more of your files than his, use internal:local and revert his
   > files back to foo. For details about the various merge tools, see hg
   > help mergetools.

   >   hg up uwe
   >   hg merge foo --tool internal:local
   >   hg revert test.txt -r foo
   >   hg commit -m "keep 9, replace 1"

   > However, if it turns out he touched a second file and you didn't
   > notice, then you've just discarded his change.

   > To me it actually sounds like you just want a regular merge. All files
   > that only you changed will keep your changes and all files that only
   > he changed will keep his changes. If there really is no overlap in
   > which files were edited hg won't even ask you to resolve anything. It
   > will do everything correctly all by itself.

Well there is a problem which I did not mention since it seemed off
topic. Be it as it may: the problem is that the files in question are
latex files. While «regular» hackers follow strict markup rules, usually
most latex authors (the only exception are those who are using
Emacs+auctex) do not. The problems are for examples paragraphs which a
differently filled but would result in the same dvi/pdf file, hence any
linebased diff program would indicate a lot of differences.

There is a tool, latexdiff,  which allows you to a large extend
circumvent these problems by producing a third latex file, which when
compiled, generates a pdf file which displays the «real» changes. That is
why the regular merge tools, such as meld, which is otherwise excellent,
(a part from problem on small 12 inch screens like my laptop posses
one), do not fit to my needs.

   > The only potential issue with a regular merge is with a file you both
   > touched. If your changes to that file don't overlap his, hg will keep
   > both and not say anything. (In most cases this is the right thing to
   > do.) If you really, really want to throw away all of your changes to a
   > file anytime the other person touched the same file, I think this
   > would work:

   >   hg up uwe
   >   hg merge foo --tool internal:fail
   >   hg resolve -l

   > Then do an hg revert for all files listed as unresolved and mark
   > them as resolved before committing your merge.

   >   hg revert -r foo file1.txt file2.txt
   >   hg resolve -a -m
   >   hg commit -m "Merge foo discard my changes to file1 and file2"


I will try that thanks again.

Uwe 



More information about the Mercurial mailing list