changeset 26941:454deda24315

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.
author Christian Delahousse <cdelahousse@fb.com>
date Tue, 10 Nov 2015 16:25:59 -0800
parents 91786f20db83
children d55d22840592
files mercurial/filemerge.py tests/test-merge-local.t
diffstat 2 files changed, 7 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- 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