resolve: choose where .orig file locations are kept
authorChristian Delahousse <cdelahousse@fb.com>
Tue, 10 Nov 2015 14:26:19 -0800
changeset 26939 50d2389a2e49
parent 26938 080276d377d9
child 26940 91786f20db83
resolve: choose where .orig file locations are kept Having your working copy littered with .orig files is a common HG complaint. This patch uses the cmd.origpath helper function to let the user specify where they should be kept when using the resolve command.
mercurial/commands.py
tests/test-resolve.t
--- a/mercurial/commands.py	Thu Nov 12 17:00:08 2015 -0600
+++ b/mercurial/commands.py	Tue Nov 10 14:26:19 2015 -0800
@@ -5678,7 +5678,7 @@
                 # for files in tocomplete, ms.resolve will not overwrite
                 # .orig -- only preresolve does
                 try:
-                    util.rename(a + ".resolve", a + ".orig")
+                    util.rename(a + ".resolve", cmdutil.origpath(ui, repo, a))
                 except OSError as inst:
                     if inst.errno != errno.ENOENT:
                         raise
--- a/tests/test-resolve.t	Thu Nov 12 17:00:08 2015 -0600
+++ b/tests/test-resolve.t	Tue Nov 10 14:26:19 2015 -0800
@@ -197,6 +197,18 @@
   $ cat file2.orig
   foo
   baz
+
+.orig files should exists where specified
+  $ hg resolve --all --verbose --config 'ui.origbackuppath=.hg/origbackups'
+  merging file1
+  creating directory: $TESTTMP/repo/.hg/origbackups
+  merging file2
+  warning: conflicts while merging file1! (edit, then use 'hg resolve --mark')
+  warning: conflicts while merging file2! (edit, then use 'hg resolve --mark')
+  [1]
+  $ ls .hg/origbackups
+  file1.orig
+  file2.orig
   $ grep '<<<' file1 > /dev/null
   $ grep '<<<' file2 > /dev/null