resolve: keep .orig files
authorMatt Mackall <mpm@selenic.com>
Mon, 16 Mar 2009 16:58:41 -0500
changeset 7847 30cb79d84352
parent 7834 2444285ec338
child 7848 89e05c02a4af
resolve: keep .orig files
mercurial/commands.py
tests/test-merge9
tests/test-merge9.out
--- a/mercurial/commands.py	Mon Mar 09 11:41:38 2009 -0500
+++ b/mercurial/commands.py	Mon Mar 16 16:58:41 2009 -0500
@@ -2363,8 +2363,17 @@
             else:
                 wctx = repo[None]
                 mctx = wctx.parents()[-1]
+
+                # backup pre-resolve (merge uses .orig for its own purposes)
+                a = repo.wjoin(f)
+                util.copyfile(a, a + ".resolve")
+
+                # resolve file
                 ms.resolve(f, wctx, mctx)
 
+                # replace filemerge's .orig file with our resolve file
+                util.rename(a + ".resolve", a + ".orig")
+
 def revert(ui, repo, *pats, **opts):
     """restore individual files or dirs to an earlier state
 
--- a/tests/test-merge9	Mon Mar 09 11:41:38 2009 -0500
+++ b/tests/test-merge9	Mon Mar 16 16:58:41 2009 -0500
@@ -37,6 +37,7 @@
 
 echo % show
 hg resolve -l
+hg st
 
 echo % re-resolve baz
 hg resolve baz
--- a/tests/test-merge9.out	Mon Mar 09 11:41:38 2009 -0500
+++ b/tests/test-merge9.out	Mon Mar 16 16:58:41 2009 -0500
@@ -23,6 +23,10 @@
 % show
 U bar
 U baz
+M bar
+M baz
+M quux2
+? bar.orig
 % re-resolve baz
 merging baz and foo to baz
 % after