changeset 26942:d55d22840592

shelve: choose where .orig file locations are kept This patch uses cmdutil.origpath to let the user set the location of the orig files.
author Christian Delahousse <cdelahousse@fb.com>
date Tue, 10 Nov 2015 14:41:14 -0800
parents 454deda24315
children 263edb591b72
files hgext/shelve.py tests/test-shelve.t
diffstat 2 files changed, 9 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/hgext/shelve.py	Tue Nov 10 16:25:59 2015 -0800
+++ b/hgext/shelve.py	Tue Nov 10 14:41:14 2015 -0800
@@ -507,7 +507,7 @@
         # revert will overwrite unknown files, so move them out of the way
         for file in repo.status(unknown=True).unknown:
             if file in files:
-                util.rename(file, file + ".orig")
+                util.rename(file, cmdutil.origpath(ui, repo, file))
         ui.pushbuffer(True)
         cmdutil.revert(ui, repo, shelvectx, repo.dirstate.parents(),
                        *pathtofiles(repo, files),
--- a/tests/test-shelve.t	Tue Nov 10 16:25:59 2015 -0800
+++ b/tests/test-shelve.t	Tue Nov 10 14:41:14 2015 -0800
@@ -1135,7 +1135,7 @@
 
   $ cd ..
 
-test Abort unshelve always gets user out of the unshelved state
+test .orig files go where the user wants them to
 ---------------------------------------------------------------
   $ hg init salvage
   $ cd salvage
@@ -1144,10 +1144,16 @@
   $ echo '' > root
   $ hg shelve -q
   $ echo 'contADDent' > root
-  $ hg unshelve -q
+  $ hg unshelve -q --config 'ui.origbackuppath=.hg/origbackups'
   warning: conflicts while merging root! (edit, then use 'hg resolve --mark')
   unresolved conflicts (see 'hg resolve', then 'hg unshelve --continue')
   [1]
+  $ ls .hg/origbackups
+  root.orig
+  $ rm -rf .hg/origbackups
+
+test Abort unshelve always gets user out of the unshelved state
+---------------------------------------------------------------
 Wreak havoc on the unshelve process
   $ rm .hg/unshelverebasestate
   $ hg unshelve --abort