[PATCH 2 of 7 V4] resolve: choose where .orig file locations are kept
cdelahousse at fb.com
cdelahousse at fb.com
Tue Nov 10 18:59:53 CST 2015
# HG changeset patch
# User Christian Delahousse <cdelahousse at fb.com>
# Date 1447194379 28800
# Tue Nov 10 14:26:19 2015 -0800
# Node ID 1ecc53f8ab6aaed2731343b5a3fac18ad4243f04
# Parent 5ee6aa63a694b3f8b4aba1c7b23561fba77dd78b
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.
diff --git a/mercurial/cmdutil.py b/mercurial/cmdutil.py
--- a/mercurial/cmdutil.py
+++ b/mercurial/cmdutil.py
@@ -3082,7 +3082,7 @@
xlist.append(abs)
if dobackup and (backup <= dobackup
or wctx[abs].cmp(ctx[abs])):
- bakname = _origpath(ui, repo, rel)
+ bakname = origpath(ui, repo, rel)
ui.note(_('saving current version of %s as %s\n') %
(rel, bakname))
if not opts.get('dry_run'):
@@ -3114,7 +3114,7 @@
finally:
wlock.release()
-def _origpath(ui, repo, filepath):
+def origpath(ui, repo, filepath):
'''customize where .orig files are created
Fetch user defined path from config file: [ui] origbackuppath = <path>
diff --git a/mercurial/commands.py b/mercurial/commands.py
--- a/mercurial/commands.py
+++ b/mercurial/commands.py
@@ -5673,7 +5673,7 @@
# replace filemerge's .orig file with our resolve file
# for files in tocomplete, ms.resolve will not overwrite
# .orig -- only preresolve does
- util.rename(a + ".resolve", a + ".orig")
+ util.rename(a + ".resolve", cmdutil.origpath(ui, repo, a))
for f in tocomplete:
try:
diff --git a/tests/test-resolve.t b/tests/test-resolve.t
--- a/tests/test-resolve.t
+++ b/tests/test-resolve.t
@@ -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
More information about the Mercurial-devel
mailing list