Mercurial > hg
changeset 26943:263edb591b72
mq: let the user choose where .orig files are kept
This patch uses cmdutil.origpath to let the user decide where .orig files are
kept when backup files are created.
author | Christian Delahousse <cdelahousse@fb.com> |
---|---|
date | Tue, 10 Nov 2015 14:52:54 -0800 |
parents | d55d22840592 |
children | ef5bab63af85 |
files | hgext/mq.py tests/test-mq-qpush-fail.t tests/test-mq.t |
diffstat | 3 files changed, 19 insertions(+), 7 deletions(-) [+] |
line wrap: on
line diff
--- a/hgext/mq.py Tue Nov 10 14:41:14 2015 -0800 +++ b/hgext/mq.py Tue Nov 10 14:52:54 2015 -0800 @@ -697,11 +697,13 @@ absf = repo.wjoin(f) if os.path.lexists(absf): self.ui.note(_('saving current version of %s as %s\n') % - (f, f + '.orig')) + (f, cmdutil.origpath(self.ui, repo, f))) + + absorig = cmdutil.origpath(self.ui, repo, absf) if copy: - util.copyfile(absf, absf + '.orig') + util.copyfile(absf, absorig) else: - util.rename(absf, absf + '.orig') + util.rename(absf, absorig) def printdiff(self, repo, diffopts, node1, node2=None, files=None, fp=None, changes=None, opts={}):
--- a/tests/test-mq-qpush-fail.t Tue Nov 10 14:41:14 2015 -0800 +++ b/tests/test-mq-qpush-fail.t Tue Nov 10 14:52:54 2015 -0800 @@ -444,7 +444,7 @@ $ hg st a M a $ echo b >> b - $ hg --config mq.keepchanges=1 qpop --force + $ hg --config mq.keepchanges=1 qpop --force --config 'ui.origbackuppath=.hg/origbackups' popping p3 now at: p2 $ hg st b @@ -461,4 +461,10 @@ now at: p2 $ hg st a +test previous qpop (with --force and --config) saved .orig files to where user +wants them + $ ls .hg/origbackups + b.orig + $ rm -rf .hg/origbackups + $ cd ..
--- a/tests/test-mq.t Tue Nov 10 14:41:14 2015 -0800 +++ b/tests/test-mq.t Tue Nov 10 14:52:54 2015 -0800 @@ -1394,9 +1394,10 @@ apply force, should discard changes in hello, but not bye - $ hg qpush -f --verbose + $ hg qpush -f --verbose --config 'ui.origbackuppath=.hg/origbackups' applying empty - saving current version of hello.txt as hello.txt.orig + creating directory: $TESTTMP/forcepush/.hg/origbackups + saving current version of hello.txt as $TESTTMP/forcepush/.hg/origbackups/hello.txt.orig patching file hello.txt committing files: hello.txt @@ -1405,7 +1406,6 @@ now at: empty $ hg st M bye.txt - ? hello.txt.orig $ hg diff --config diff.nodates=True diff -r ba252371dbc1 bye.txt --- a/bye.txt @@ -1428,6 +1428,10 @@ +world +universe +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 test popping revisions not in working dir ancestry