Mercurial > hg
changeset 34146:9e4f82bc2b0b
scmutil: don't append .orig to backups in origbackuppath (BC)
When ui.origbackuppath is set, .orig files are stored outside of the working
copy, however they still have a .orig suffix appended to them. This can cause
unexpected conflicts, particularly when tracked files or directories have .orig
at the end.
This change removes the .orig suffix from files stored in an out-of-tree
origbackuppath.
Test Plan:
Update and run unit tests.
Differential Revision: https://phab.mercurial-scm.org/D679
author | Mark Thomas <mbthomas@fb.com> |
---|---|
date | Mon, 11 Sep 2017 17:49:49 +0000 |
parents | 24bf823377fc |
children | b96cfc309ac5 |
files | mercurial/help/config.txt mercurial/scmutil.py tests/test-largefiles-misc.t tests/test-merge-local.t tests/test-mq-qpush-fail.t tests/test-mq.t tests/test-resolve.t tests/test-revert.t tests/test-shelve.t tests/test-subrepo-git.t |
diffstat | 10 files changed, 17 insertions(+), 15 deletions(-) [+] |
line wrap: on
line diff
--- a/mercurial/help/config.txt Tue Sep 12 19:27:01 2017 -0700 +++ b/mercurial/help/config.txt Mon Sep 11 17:49:49 2017 +0000 @@ -2007,7 +2007,9 @@ ``origbackuppath`` The path to a directory used to store generated .orig files. If the path is - not a directory, one will be created. + not a directory, one will be created. If set, files stored in this + directory have the same name as the original file and do not have a .orig + suffix. ``paginate`` Control the pagination of command output (default: True). See :hg:`help pager`
--- a/mercurial/scmutil.py Tue Sep 12 19:27:01 2017 -0700 +++ b/mercurial/scmutil.py Mon Sep 11 17:49:49 2017 +0000 @@ -553,7 +553,7 @@ '''customize where .orig files are created Fetch user defined path from config file: [ui] origbackuppath = <path> - Fall back to default (filepath) if not specified + Fall back to default (filepath with .orig suffix) if not specified ''' origbackuppath = ui.config('ui', 'origbackuppath') if origbackuppath is None: @@ -567,7 +567,7 @@ ui.note(_('creating directory: %s\n') % origbackupdir) util.makedirs(origbackupdir) - return fullorigpath + ".orig" + return fullorigpath class _containsnode(object): """proxy __contains__(node) to container.__contains__ which accepts revs"""
--- a/tests/test-largefiles-misc.t Tue Sep 12 19:27:01 2017 -0700 +++ b/tests/test-largefiles-misc.t Mon Sep 11 17:49:49 2017 +0000 @@ -528,13 +528,13 @@ $ echo moremore >> anotherlarge $ hg revert anotherlarge -v --config 'ui.origbackuppath=.hg/origbackups' creating directory: $TESTTMP/addrm2/.hg/origbackups/.hglf/sub (glob) - saving current version of ../.hglf/sub/anotherlarge as $TESTTMP/addrm2/.hg/origbackups/.hglf/sub/anotherlarge.orig (glob) + saving current version of ../.hglf/sub/anotherlarge as $TESTTMP/addrm2/.hg/origbackups/.hglf/sub/anotherlarge (glob) reverting ../.hglf/sub/anotherlarge (glob) creating directory: $TESTTMP/addrm2/.hg/origbackups/sub (glob) found 90c622cf65cebe75c5842f9136c459333faf392e in store found 90c622cf65cebe75c5842f9136c459333faf392e in store $ ls ../.hg/origbackups/sub - anotherlarge.orig + anotherlarge $ cd .. Test glob logging from the root dir
--- a/tests/test-merge-local.t Tue Sep 12 19:27:01 2017 -0700 +++ b/tests/test-merge-local.t Mon Sep 11 17:49:49 2017 +0000 @@ -110,7 +110,7 @@ Are orig files from the last commit where we want them? $ ls .hg/origbackups - zzz2_merge_bad.orig + zzz2_merge_bad $ hg diff --nodates | grep "^[+-][^<>]" --- a/zzz1_merge_ok
--- a/tests/test-mq-qpush-fail.t Tue Sep 12 19:27:01 2017 -0700 +++ b/tests/test-mq-qpush-fail.t Mon Sep 11 17:49:49 2017 +0000 @@ -465,7 +465,7 @@ test previous qpop (with --force and --config) saved .orig files to where user wants them $ ls .hg/origbackups - b.orig + b $ rm -rf .hg/origbackups $ cd ..
--- a/tests/test-mq.t Tue Sep 12 19:27:01 2017 -0700 +++ b/tests/test-mq.t Mon Sep 11 17:49:49 2017 +0000 @@ -1388,7 +1388,7 @@ $ hg qpush -f --verbose --config 'ui.origbackuppath=.hg/origbackups' applying empty creating directory: $TESTTMP/forcepush/.hg/origbackups (glob) - saving current version of hello.txt as $TESTTMP/forcepush/.hg/origbackups/hello.txt.orig (glob) + saving current version of hello.txt as $TESTTMP/forcepush/.hg/origbackups/hello.txt (glob) patching file hello.txt committing files: hello.txt @@ -1422,7 +1422,7 @@ test that the previous call to qpush with -f (--force) and --config actually put the orig files out of the working copy $ ls .hg/origbackups - hello.txt.orig + hello.txt test popping revisions not in working dir ancestry
--- a/tests/test-resolve.t Tue Sep 12 19:27:01 2017 -0700 +++ b/tests/test-resolve.t Mon Sep 11 17:49:49 2017 +0000 @@ -255,8 +255,8 @@ warning: conflicts while merging file2! (edit, then use 'hg resolve --mark') [1] $ ls .hg/origbackups - file1.orig - file2.orig + file1 + file2 $ grep '<<<' file1 > /dev/null $ grep '<<<' file2 > /dev/null
--- a/tests/test-revert.t Tue Sep 12 19:27:01 2017 -0700 +++ b/tests/test-revert.t Mon Sep 11 17:49:49 2017 +0000 @@ -92,7 +92,7 @@ $ echo z > e $ hg revert --all -v --config 'ui.origbackuppath=.hg/origbackups' creating directory: $TESTTMP/repo/.hg/origbackups (glob) - saving current version of e as $TESTTMP/repo/.hg/origbackups/e.orig (glob) + saving current version of e as $TESTTMP/repo/.hg/origbackups/e (glob) reverting e $ rm -rf .hg/origbackups
--- a/tests/test-shelve.t Tue Sep 12 19:27:01 2017 -0700 +++ b/tests/test-shelve.t Mon Sep 11 17:49:49 2017 +0000 @@ -1260,7 +1260,7 @@ unresolved conflicts (see 'hg resolve', then 'hg unshelve --continue') [1] $ ls .hg/origbackups - root.orig + root $ rm -rf .hg/origbackups test Abort unshelve always gets user out of the unshelved state
--- a/tests/test-subrepo-git.t Tue Sep 12 19:27:01 2017 -0700 +++ b/tests/test-subrepo-git.t Mon Sep 11 17:49:49 2017 +0000 @@ -885,9 +885,9 @@ $ hg revert --all --verbose --config 'ui.origbackuppath=.hg/origbackups' reverting subrepo ../gitroot creating directory: $TESTTMP/tc/.hg/origbackups (glob) - saving current version of foobar as $TESTTMP/tc/.hg/origbackups/foobar.orig (glob) + saving current version of foobar as $TESTTMP/tc/.hg/origbackups/foobar (glob) $ ls .hg/origbackups - foobar.orig + foobar $ rm -rf .hg/origbackups show file at specific revision