merge with stable
authorMatt Mackall <mpm@selenic.com>
Wed, 18 Nov 2015 20:59:17 -0600
changeset 27010 f4fec0940278
parent 27009 f5faef7e9119 (current diff)
parent 26960 6979fe2a6d75 (diff)
child 27011 53c668dc6b16
merge with stable
hgext/rebase.py
mercurial/commands.py
tests/test-resolve.t
--- a/hgext/rebase.py	Sun Nov 01 14:43:25 2015 +0900
+++ b/hgext/rebase.py	Wed Nov 18 20:59:17 2015 -0600
@@ -1104,6 +1104,7 @@
 
 def pullrebase(orig, ui, repo, *args, **opts):
     'Call rebase after pull if the latter has been invoked with --rebase'
+    ret = None
     if opts.get('rebase'):
         wlock = lock = None
         try:
@@ -1121,7 +1122,7 @@
                 pass
             commands.postincoming = _dummy
             try:
-                orig(ui, repo, *args, **opts)
+                ret = orig(ui, repo, *args, **opts)
             finally:
                 commands.postincoming = origpostincoming
             revspostpull = len(repo)
@@ -1148,7 +1149,9 @@
     else:
         if opts.get('tool'):
             raise error.Abort(_('--tool can only be used with --rebase'))
-        orig(ui, repo, *args, **opts)
+        ret = orig(ui, repo, *args, **opts)
+
+    return ret
 
 def _setrebasesetvisibility(repo, revs):
     """store the currently rebased set on the repo object
--- a/mercurial/commands.py	Sun Nov 01 14:43:25 2015 +0900
+++ b/mercurial/commands.py	Wed Nov 18 20:59:17 2015 -0600
@@ -5680,14 +5680,15 @@
                     ui.setconfig('ui', 'forcemerge', '', 'resolve')
                     ms.commit()
 
-                # replace filemerge's .orig file with our resolve file
-                # for files in tocomplete, ms.resolve will not overwrite
-                # .orig -- only preresolve does
-                try:
-                    util.rename(a + ".resolve", cmdutil.origpath(ui, repo, a))
-                except OSError as inst:
-                    if inst.errno != errno.ENOENT:
-                        raise
+                # replace filemerge's .orig file with our resolve file, but only
+                # for merges that are complete
+                if complete:
+                    try:
+                        util.rename(a + ".resolve",
+                                    cmdutil.origpath(ui, repo, a))
+                    except OSError as inst:
+                        if inst.errno != errno.ENOENT:
+                            raise
 
         for f in tocomplete:
             try:
@@ -5701,6 +5702,10 @@
                 ui.setconfig('ui', 'forcemerge', '', 'resolve')
                 ms.commit()
 
+            # replace filemerge's .orig file with our resolve file
+            a = repo.wjoin(f)
+            util.rename(a + ".resolve", a + ".orig")
+
         ms.commit()
 
         if not didwork and pats:
--- a/tests/test-resolve.t	Sun Nov 01 14:43:25 2015 +0900
+++ b/tests/test-resolve.t	Wed Nov 18 20:59:17 2015 -0600
@@ -219,6 +219,30 @@
   [1]
   $ grep '<<<' file1 > /dev/null
 
+test .orig behavior with resolve
+
+  $ echo resolve > file
+  $ hg resolve -q file1 --tool 'f --dump $TESTTMP/repo/file1.orig'
+  */file1~base*: (glob)
+  >>>
+  foo
+  <<<
+  */file1~other*: (glob)
+  >>>
+  foo
+  bar
+  <<<
+  $TESTTMP/repo/file1: (glob)
+  >>>
+  foo
+  baz
+  <<<
+  $TESTTMP/repo/file1.orig: (glob)
+  >>>
+  foo
+  baz
+  <<<
+
 resolve <file> should do nothing if 'file' was marked resolved
   $ echo resolved > file1
   $ hg resolve -m file1