filemerge: break overall filemerge into separate premerge and merge steps
This means that in ms.resolve we must call merge after calling premerge. This
doesn't yet mean that all premerges happen before any merges -- however, this
does get us closer to our goal.
The output differences are because we recompute the merge tool. The only
user-visible difference caused by this patch is that if the tool is missing
we'll print the warning twice. Not a huge deal, though.
--- a/mercurial/filemerge.py Sun Oct 11 20:04:40 2015 -0700
+++ b/mercurial/filemerge.py Sun Oct 11 20:47:14 2015 -0700
@@ -519,6 +519,8 @@
if premerge and mergetype == fullmerge:
r = _premerge(repo, toolconf, files, labels=labels)
+ # complete if premerge successful (r is 0)
+ return not r, r
if not r: # premerge successfully merged the file
needcheck = False
@@ -575,9 +577,7 @@
return _filemerge(True, repo, mynode, orig, fcd, fco, fca, labels=labels)
def filemerge(repo, mynode, orig, fcd, fco, fca, labels=None):
- # premerge = True is temporary -- will be changed to False once premerge
- # function above is ready
- return _filemerge(True, repo, mynode, orig, fcd, fco, fca, labels=labels)
+ return _filemerge(False, repo, mynode, orig, fcd, fco, fca, labels=labels)
# tell hggettext to extract docstrings from these functions:
i18nfunctions = internals.values()
--- a/mercurial/merge.py Sun Oct 11 20:04:40 2015 -0700
+++ b/mercurial/merge.py Sun Oct 11 20:47:14 2015 -0700
@@ -310,8 +310,11 @@
f = self._repo.vfs('merge/' + hash)
self._repo.wwrite(dfile, f.read(), flags)
f.close()
- complete, r = filemerge.filemerge(self._repo, self._local, lfile, fcd,
- fco, fca, labels=labels)
+ complete, r = filemerge.premerge(self._repo, self._local, lfile, fcd,
+ fco, fca, labels=labels)
+ if not complete:
+ complete, r = filemerge.filemerge(self._repo, self._local, lfile,
+ fcd, fco, fca, labels=labels)
if r is None:
# no real conflict
del self._state[dfile]
--- a/tests/test-graft.t Sun Oct 11 20:04:40 2015 -0700
+++ b/tests/test-graft.t Sun Oct 11 20:47:14 2015 -0700
@@ -187,6 +187,8 @@
picked tool ':merge' for e (binary False symlink False)
merging e
my e@1905859650ec+ other e@9c233e8e184d ancestor e@68795b066622
+ picked tool ':merge' for e (binary False symlink False)
+ my e@1905859650ec+ other e@9c233e8e184d ancestor e@68795b066622
warning: conflicts during merge.
merging e incomplete! (edit conflicts, then use 'hg resolve --mark')
abort: unresolved conflicts, can't continue
--- a/tests/test-merge-criss-cross.t Sun Oct 11 20:04:40 2015 -0700
+++ b/tests/test-merge-criss-cross.t Sun Oct 11 20:47:14 2015 -0700
@@ -86,6 +86,8 @@
picked tool ':dump' for f2 (binary False symlink False)
merging f2
my f2@3b08d01b0ab5+ other f2@adfe50279922 ancestor f2@40494bf2444c
+ picked tool ':dump' for f2 (binary False symlink False)
+ my f2@3b08d01b0ab5+ other f2@adfe50279922 ancestor f2@40494bf2444c
1 files updated, 0 files merged, 0 files removed, 1 files unresolved
use 'hg resolve' to retry unresolved file merges or 'hg update -C .' to abandon
[1]
--- a/tests/test-merge-tools.t Sun Oct 11 20:04:40 2015 -0700
+++ b/tests/test-merge-tools.t Sun Oct 11 20:47:14 2015 -0700
@@ -351,6 +351,7 @@
$ hg merge -r 2 --config merge-patterns.f=true --config merge-tools.true.executable=nonexistentmergetool
couldn't find merge tool true specified for f
merging f
+ couldn't find merge tool true specified for f
merging f failed!
0 files updated, 0 files merged, 0 files removed, 1 files unresolved
use 'hg resolve' to retry unresolved file merges or 'hg update -C .' to abandon
@@ -374,6 +375,7 @@
$ hg merge -r 2 --config merge-patterns.f=true --config merge-tools.true.executable=/nonexistent/mergetool
couldn't find merge tool true specified for f
merging f
+ couldn't find merge tool true specified for f
merging f failed!
0 files updated, 0 files merged, 0 files removed, 1 files unresolved
use 'hg resolve' to retry unresolved file merges or 'hg update -C .' to abandon
--- a/tests/test-merge7.t Sun Oct 11 20:04:40 2015 -0700
+++ b/tests/test-merge7.t Sun Oct 11 20:47:14 2015 -0700
@@ -89,6 +89,8 @@
picked tool ':merge' for test.txt (binary False symlink False)
merging test.txt
my test.txt@50c3a7e29886+ other test.txt@40d11a4173a8 ancestor test.txt@96b70246a118
+ picked tool ':merge' for test.txt (binary False symlink False)
+ my test.txt@50c3a7e29886+ other test.txt@40d11a4173a8 ancestor test.txt@96b70246a118
warning: conflicts during merge.
merging test.txt incomplete! (edit conflicts, then use 'hg resolve --mark')
0 files updated, 0 files merged, 0 files removed, 1 files unresolved
--- a/tests/test-rename-merge2.t Sun Oct 11 20:04:40 2015 -0700
+++ b/tests/test-rename-merge2.t Sun Oct 11 20:47:14 2015 -0700
@@ -98,6 +98,8 @@
picked tool 'python ../merge' for rev (binary False symlink False)
merging rev
my rev@e300d1c794ec+ other rev@4ce40f5aca24 ancestor rev@924404dff337
+ picked tool 'python ../merge' for rev (binary False symlink False)
+ my rev@e300d1c794ec+ other rev@4ce40f5aca24 ancestor rev@924404dff337
launching merge tool: python ../merge *$TESTTMP/t/t/rev* * * (glob)
merge tool returned: 0
0 files updated, 2 files merged, 0 files removed, 0 files unresolved
@@ -135,7 +137,9 @@
picked tool 'python ../merge' for rev (binary False symlink False)
merging rev
my rev@86a2aa42fc76+ other rev@f4db7e329e71 ancestor rev@924404dff337
- launching merge tool: python ../merge *$TESTTMP/t/t/rev* * (glob)
+ picked tool 'python ../merge' for rev (binary False symlink False)
+ my rev@86a2aa42fc76+ other rev@f4db7e329e71 ancestor rev@924404dff337
+ launching merge tool: python ../merge *$TESTTMP/t/t/rev* * * (glob)
merge tool returned: 0
1 files updated, 2 files merged, 0 files removed, 0 files unresolved
(branch merge, don't forget to commit)
@@ -171,6 +175,8 @@
picked tool 'python ../merge' for rev (binary False symlink False)
merging rev
my rev@e300d1c794ec+ other rev@bdb19105162a ancestor rev@924404dff337
+ picked tool 'python ../merge' for rev (binary False symlink False)
+ my rev@e300d1c794ec+ other rev@bdb19105162a ancestor rev@924404dff337
launching merge tool: python ../merge *$TESTTMP/t/t/rev* * * (glob)
merge tool returned: 0
0 files updated, 2 files merged, 0 files removed, 0 files unresolved
@@ -205,6 +211,8 @@
picked tool 'python ../merge' for rev (binary False symlink False)
merging rev
my rev@02963e448370+ other rev@f4db7e329e71 ancestor rev@924404dff337
+ picked tool 'python ../merge' for rev (binary False symlink False)
+ my rev@02963e448370+ other rev@f4db7e329e71 ancestor rev@924404dff337
launching merge tool: python ../merge *$TESTTMP/t/t/rev* * * (glob)
merge tool returned: 0
0 files updated, 2 files merged, 0 files removed, 0 files unresolved
@@ -235,6 +243,8 @@
picked tool 'python ../merge' for rev (binary False symlink False)
merging rev
my rev@94b33a1b7f2d+ other rev@4ce40f5aca24 ancestor rev@924404dff337
+ picked tool 'python ../merge' for rev (binary False symlink False)
+ my rev@94b33a1b7f2d+ other rev@4ce40f5aca24 ancestor rev@924404dff337
launching merge tool: python ../merge *$TESTTMP/t/t/rev* * * (glob)
merge tool returned: 0
1 files updated, 1 files merged, 0 files removed, 0 files unresolved
@@ -263,6 +273,8 @@
picked tool 'python ../merge' for rev (binary False symlink False)
merging rev
my rev@86a2aa42fc76+ other rev@97c705ade336 ancestor rev@924404dff337
+ picked tool 'python ../merge' for rev (binary False symlink False)
+ my rev@86a2aa42fc76+ other rev@97c705ade336 ancestor rev@924404dff337
launching merge tool: python ../merge *$TESTTMP/t/t/rev* * * (glob)
merge tool returned: 0
0 files updated, 1 files merged, 0 files removed, 0 files unresolved
@@ -295,6 +307,8 @@
picked tool 'python ../merge' for rev (binary False symlink False)
merging rev
my rev@94b33a1b7f2d+ other rev@bdb19105162a ancestor rev@924404dff337
+ picked tool 'python ../merge' for rev (binary False symlink False)
+ my rev@94b33a1b7f2d+ other rev@bdb19105162a ancestor rev@924404dff337
launching merge tool: python ../merge *$TESTTMP/t/t/rev* * * (glob)
merge tool returned: 0
1 files updated, 1 files merged, 1 files removed, 0 files unresolved
@@ -322,6 +336,8 @@
picked tool 'python ../merge' for rev (binary False symlink False)
merging rev
my rev@02963e448370+ other rev@97c705ade336 ancestor rev@924404dff337
+ picked tool 'python ../merge' for rev (binary False symlink False)
+ my rev@02963e448370+ other rev@97c705ade336 ancestor rev@924404dff337
launching merge tool: python ../merge *$TESTTMP/t/t/rev* * * (glob)
merge tool returned: 0
0 files updated, 1 files merged, 0 files removed, 0 files unresolved
@@ -347,12 +363,16 @@
picked tool 'python ../merge' for b (binary False symlink False)
merging b
my b@62e7bf090eba+ other b@49b6d8032493 ancestor a@924404dff337
+ picked tool 'python ../merge' for b (binary False symlink False)
+ my b@62e7bf090eba+ other b@49b6d8032493 ancestor a@924404dff337
launching merge tool: python ../merge *$TESTTMP/t/t/b* * * (glob)
merge tool returned: 0
rev: versions differ -> m
picked tool 'python ../merge' for rev (binary False symlink False)
merging rev
my rev@62e7bf090eba+ other rev@49b6d8032493 ancestor rev@924404dff337
+ picked tool 'python ../merge' for rev (binary False symlink False)
+ my rev@62e7bf090eba+ other rev@49b6d8032493 ancestor rev@924404dff337
launching merge tool: python ../merge *$TESTTMP/t/t/rev* * * (glob)
merge tool returned: 0
0 files updated, 2 files merged, 0 files removed, 0 files unresolved
@@ -388,6 +408,8 @@
picked tool 'python ../merge' for rev (binary False symlink False)
merging rev
my rev@02963e448370+ other rev@fe905ef2c33e ancestor rev@924404dff337
+ picked tool 'python ../merge' for rev (binary False symlink False)
+ my rev@02963e448370+ other rev@fe905ef2c33e ancestor rev@924404dff337
launching merge tool: python ../merge *$TESTTMP/t/t/rev* * * (glob)
merge tool returned: 0
note: possible conflict - a was renamed multiple times to:
@@ -417,12 +439,16 @@
picked tool 'python ../merge' for b (binary False symlink False)
merging b
my b@86a2aa42fc76+ other b@af30c7647fc7 ancestor b@000000000000
+ picked tool 'python ../merge' for b (binary False symlink False)
+ my b@86a2aa42fc76+ other b@af30c7647fc7 ancestor b@000000000000
launching merge tool: python ../merge *$TESTTMP/t/t/b* * * (glob)
merge tool returned: 0
rev: versions differ -> m
picked tool 'python ../merge' for rev (binary False symlink False)
merging rev
my rev@86a2aa42fc76+ other rev@af30c7647fc7 ancestor rev@924404dff337
+ picked tool 'python ../merge' for rev (binary False symlink False)
+ my rev@86a2aa42fc76+ other rev@af30c7647fc7 ancestor rev@924404dff337
launching merge tool: python ../merge *$TESTTMP/t/t/rev* * * (glob)
merge tool returned: 0
0 files updated, 2 files merged, 0 files removed, 0 files unresolved
@@ -451,12 +477,16 @@
picked tool 'python ../merge' for b (binary False symlink False)
merging b
my b@59318016310c+ other b@bdb19105162a ancestor b@000000000000
+ picked tool 'python ../merge' for b (binary False symlink False)
+ my b@59318016310c+ other b@bdb19105162a ancestor b@000000000000
launching merge tool: python ../merge *$TESTTMP/t/t/b* * * (glob)
merge tool returned: 0
rev: versions differ -> m
picked tool 'python ../merge' for rev (binary False symlink False)
merging rev
my rev@59318016310c+ other rev@bdb19105162a ancestor rev@924404dff337
+ picked tool 'python ../merge' for rev (binary False symlink False)
+ my rev@59318016310c+ other rev@bdb19105162a ancestor rev@924404dff337
launching merge tool: python ../merge *$TESTTMP/t/t/rev* * * (glob)
merge tool returned: 0
0 files updated, 2 files merged, 1 files removed, 0 files unresolved
@@ -484,12 +514,16 @@
picked tool 'python ../merge' for b (binary False symlink False)
merging b
my b@86a2aa42fc76+ other b@8dbce441892a ancestor b@000000000000
+ picked tool 'python ../merge' for b (binary False symlink False)
+ my b@86a2aa42fc76+ other b@8dbce441892a ancestor b@000000000000
launching merge tool: python ../merge *$TESTTMP/t/t/b* * * (glob)
merge tool returned: 0
rev: versions differ -> m
picked tool 'python ../merge' for rev (binary False symlink False)
merging rev
my rev@86a2aa42fc76+ other rev@8dbce441892a ancestor rev@924404dff337
+ picked tool 'python ../merge' for rev (binary False symlink False)
+ my rev@86a2aa42fc76+ other rev@8dbce441892a ancestor rev@924404dff337
launching merge tool: python ../merge *$TESTTMP/t/t/rev* * * (glob)
merge tool returned: 0
1 files updated, 2 files merged, 0 files removed, 0 files unresolved
@@ -518,12 +552,16 @@
picked tool 'python ../merge' for b (binary False symlink False)
merging b
my b@59318016310c+ other b@bdb19105162a ancestor b@000000000000
+ picked tool 'python ../merge' for b (binary False symlink False)
+ my b@59318016310c+ other b@bdb19105162a ancestor b@000000000000
launching merge tool: python ../merge *$TESTTMP/t/t/b* * * (glob)
merge tool returned: 0
rev: versions differ -> m
picked tool 'python ../merge' for rev (binary False symlink False)
merging rev
my rev@59318016310c+ other rev@bdb19105162a ancestor rev@924404dff337
+ picked tool 'python ../merge' for rev (binary False symlink False)
+ my rev@59318016310c+ other rev@bdb19105162a ancestor rev@924404dff337
launching merge tool: python ../merge *$TESTTMP/t/t/rev* * * (glob)
merge tool returned: 0
0 files updated, 2 files merged, 1 files removed, 0 files unresolved
@@ -551,12 +589,16 @@
picked tool 'python ../merge' for b (binary False symlink False)
merging b
my b@86a2aa42fc76+ other b@8dbce441892a ancestor b@000000000000
+ picked tool 'python ../merge' for b (binary False symlink False)
+ my b@86a2aa42fc76+ other b@8dbce441892a ancestor b@000000000000
launching merge tool: python ../merge *$TESTTMP/t/t/b* * * (glob)
merge tool returned: 0
rev: versions differ -> m
picked tool 'python ../merge' for rev (binary False symlink False)
merging rev
my rev@86a2aa42fc76+ other rev@8dbce441892a ancestor rev@924404dff337
+ picked tool 'python ../merge' for rev (binary False symlink False)
+ my rev@86a2aa42fc76+ other rev@8dbce441892a ancestor rev@924404dff337
launching merge tool: python ../merge *$TESTTMP/t/t/rev* * * (glob)
merge tool returned: 0
1 files updated, 2 files merged, 0 files removed, 0 files unresolved
@@ -584,12 +626,16 @@
picked tool 'python ../merge' for b (binary False symlink False)
merging b
my b@0b76e65c8289+ other b@4ce40f5aca24 ancestor b@000000000000
+ picked tool 'python ../merge' for b (binary False symlink False)
+ my b@0b76e65c8289+ other b@4ce40f5aca24 ancestor b@000000000000
launching merge tool: python ../merge *$TESTTMP/t/t/b* * * (glob)
merge tool returned: 0
rev: versions differ -> m
picked tool 'python ../merge' for rev (binary False symlink False)
merging rev
my rev@0b76e65c8289+ other rev@4ce40f5aca24 ancestor rev@924404dff337
+ picked tool 'python ../merge' for rev (binary False symlink False)
+ my rev@0b76e65c8289+ other rev@4ce40f5aca24 ancestor rev@924404dff337
launching merge tool: python ../merge *$TESTTMP/t/t/rev* * * (glob)
merge tool returned: 0
0 files updated, 2 files merged, 0 files removed, 0 files unresolved
@@ -620,12 +666,16 @@
picked tool 'python ../merge' for b (binary False symlink False)
merging b
my b@02963e448370+ other b@8dbce441892a ancestor b@000000000000
+ picked tool 'python ../merge' for b (binary False symlink False)
+ my b@02963e448370+ other b@8dbce441892a ancestor b@000000000000
launching merge tool: python ../merge *$TESTTMP/t/t/b* * * (glob)
merge tool returned: 0
rev: versions differ -> m
picked tool 'python ../merge' for rev (binary False symlink False)
merging rev
my rev@02963e448370+ other rev@8dbce441892a ancestor rev@924404dff337
+ picked tool 'python ../merge' for rev (binary False symlink False)
+ my rev@02963e448370+ other rev@8dbce441892a ancestor rev@924404dff337
launching merge tool: python ../merge *$TESTTMP/t/t/rev* * * (glob)
merge tool returned: 0
1 files updated, 2 files merged, 0 files removed, 0 files unresolved
@@ -655,12 +705,16 @@
picked tool 'python ../merge' for b (binary False symlink False)
merging b
my b@0b76e65c8289+ other b@bdb19105162a ancestor b@000000000000
+ picked tool 'python ../merge' for b (binary False symlink False)
+ my b@0b76e65c8289+ other b@bdb19105162a ancestor b@000000000000
launching merge tool: python ../merge *$TESTTMP/t/t/b* * * (glob)
merge tool returned: 0
rev: versions differ -> m
picked tool 'python ../merge' for rev (binary False symlink False)
merging rev
my rev@0b76e65c8289+ other rev@bdb19105162a ancestor rev@924404dff337
+ picked tool 'python ../merge' for rev (binary False symlink False)
+ my rev@0b76e65c8289+ other rev@bdb19105162a ancestor rev@924404dff337
launching merge tool: python ../merge *$TESTTMP/t/t/rev* * * (glob)
merge tool returned: 0
0 files updated, 2 files merged, 0 files removed, 0 files unresolved
@@ -691,12 +745,16 @@
picked tool 'python ../merge' for b (binary False symlink False)
merging a and b to b
my b@e300d1c794ec+ other b@49b6d8032493 ancestor a@924404dff337
+ picked tool 'python ../merge' for b (binary False symlink False)
+ my b@e300d1c794ec+ other b@49b6d8032493 ancestor a@924404dff337
launching merge tool: python ../merge *$TESTTMP/t/t/b* * * (glob)
merge tool returned: 0
rev: versions differ -> m
picked tool 'python ../merge' for rev (binary False symlink False)
merging rev
my rev@e300d1c794ec+ other rev@49b6d8032493 ancestor rev@924404dff337
+ picked tool 'python ../merge' for rev (binary False symlink False)
+ my rev@e300d1c794ec+ other rev@49b6d8032493 ancestor rev@924404dff337
launching merge tool: python ../merge *$TESTTMP/t/t/rev* * * (glob)
merge tool returned: 0
0 files updated, 2 files merged, 0 files removed, 0 files unresolved
@@ -726,12 +784,16 @@
picked tool 'python ../merge' for b (binary False symlink False)
merging b and a to b
my b@62e7bf090eba+ other a@f4db7e329e71 ancestor a@924404dff337
+ picked tool 'python ../merge' for b (binary False symlink False)
+ my b@62e7bf090eba+ other a@f4db7e329e71 ancestor a@924404dff337
launching merge tool: python ../merge *$TESTTMP/t/t/b* * * (glob)
merge tool returned: 0
rev: versions differ -> m
picked tool 'python ../merge' for rev (binary False symlink False)
merging rev
my rev@62e7bf090eba+ other rev@f4db7e329e71 ancestor rev@924404dff337
+ picked tool 'python ../merge' for rev (binary False symlink False)
+ my rev@62e7bf090eba+ other rev@f4db7e329e71 ancestor rev@924404dff337
launching merge tool: python ../merge *$TESTTMP/t/t/rev* * * (glob)
merge tool returned: 0
0 files updated, 2 files merged, 0 files removed, 0 files unresolved
@@ -773,6 +835,8 @@
picked tool 'python ../merge' for rev (binary False symlink False)
merging rev
my rev@02963e448370+ other rev@2b958612230f ancestor rev@924404dff337
+ picked tool 'python ../merge' for rev (binary False symlink False)
+ my rev@02963e448370+ other rev@2b958612230f ancestor rev@924404dff337
launching merge tool: python ../merge *$TESTTMP/t/t/rev* * * (glob)
merge tool returned: 0
1 files updated, 2 files merged, 0 files removed, 0 files unresolved
--- a/tests/test-subrepo.t Sun Oct 11 20:04:40 2015 -0700
+++ b/tests/test-subrepo.t Sun Oct 11 20:47:14 2015 -0700
@@ -300,6 +300,8 @@
picked tool ':merge' for t (binary False symlink False)
merging t
my t@20a0db6fbf6c+ other t@7af322bc1198 ancestor t@6747d179aa9a
+ picked tool ':merge' for t (binary False symlink False)
+ my t@20a0db6fbf6c+ other t@7af322bc1198 ancestor t@6747d179aa9a
warning: conflicts during merge.
merging t incomplete! (edit conflicts, then use 'hg resolve --mark')
0 files updated, 0 files merged, 0 files removed, 1 files unresolved
--- a/tests/test-up-local-change.t Sun Oct 11 20:04:40 2015 -0700
+++ b/tests/test-up-local-change.t Sun Oct 11 20:47:14 2015 -0700
@@ -53,7 +53,9 @@
picked tool 'true' for a (binary False symlink False)
merging a
my a@c19d34741b0a+ other a@1e71731e6fbb ancestor a@c19d34741b0a
- launching merge tool: true *$TESTTMP/r2/a* * (glob)
+ picked tool 'true' for a (binary False symlink False)
+ my a@c19d34741b0a+ other a@1e71731e6fbb ancestor a@c19d34741b0a
+ launching merge tool: true *$TESTTMP/r2/a* * * (glob)
merge tool returned: 0
1 files updated, 1 files merged, 0 files removed, 0 files unresolved
$ hg parents
@@ -74,7 +76,9 @@
picked tool 'true' for a (binary False symlink False)
merging a
my a@1e71731e6fbb+ other a@c19d34741b0a ancestor a@1e71731e6fbb
- launching merge tool: true *$TESTTMP/r2/a* * (glob)
+ picked tool 'true' for a (binary False symlink False)
+ my a@1e71731e6fbb+ other a@c19d34741b0a ancestor a@1e71731e6fbb
+ launching merge tool: true *$TESTTMP/r2/a* * * (glob)
merge tool returned: 0
0 files updated, 1 files merged, 1 files removed, 0 files unresolved
$ hg parents
@@ -103,7 +107,9 @@
picked tool 'true' for a (binary False symlink False)
merging a
my a@c19d34741b0a+ other a@1e71731e6fbb ancestor a@c19d34741b0a
- launching merge tool: true *$TESTTMP/r2/a* * (glob)
+ picked tool 'true' for a (binary False symlink False)
+ my a@c19d34741b0a+ other a@1e71731e6fbb ancestor a@c19d34741b0a
+ launching merge tool: true *$TESTTMP/r2/a* * * (glob)
merge tool returned: 0
1 files updated, 1 files merged, 0 files removed, 0 files unresolved
$ hg parents