filemerge: choose where .orig files are kept
authorChristian Delahousse <cdelahousse@fb.com>
Tue, 10 Nov 2015 16:25:59 -0800
changeset 26941 454deda24315
parent 26940 91786f20db83
child 26942 d55d22840592
filemerge: choose where .orig files are kept Having .orig files litter your working copy is a common complaint. This patch uses cmdutil.orig to let the user determine where those files should reside.
mercurial/filemerge.py
tests/test-merge-local.t
--- a/mercurial/filemerge.py	Tue Nov 10 14:29:13 2015 -0800
+++ b/mercurial/filemerge.py	Tue Nov 10 16:25:59 2015 -0800
@@ -16,6 +16,7 @@
 from .node import short
 
 from . import (
+    cmdutil,
     error,
     match,
     simplemerge,
@@ -510,7 +511,7 @@
     a = repo.wjoin(fd)
     b = temp("base", fca)
     c = temp("other", fco)
-    back = a + ".orig"
+    back = cmdutil.origpath(ui, repo, a)
     if premerge:
         util.copyfile(a, back)
     files = (a, b, c, back)
--- a/tests/test-merge-local.t	Tue Nov 10 14:29:13 2015 -0800
+++ b/tests/test-merge-local.t	Tue Nov 10 16:25:59 2015 -0800
@@ -91,7 +91,7 @@
   use 'hg resolve' to retry unresolved file merges
   [1]
 
-  $ hg co 0
+  $ hg co 0 --config 'ui.origbackuppath=.hg/origbackups'
   merging zzz1_merge_ok
   merging zzz2_merge_bad
   warning: conflicts while merging zzz2_merge_bad! (edit, then use 'hg resolve --mark')
@@ -99,6 +99,10 @@
   use 'hg resolve' to retry unresolved file merges
   [1]
 
+Are orig files from the last commit where we want them?
+  $ ls .hg/origbackups
+  zzz2_merge_bad.orig
+
   $ hg diff --nodates | grep "^[+-][^<>]"
   --- a/zzz1_merge_ok
   +++ b/zzz1_merge_ok