Patchwork D5871: revert: always show relative path to .orig backup

login
register
mail settings
Submitter phabricator
Date Feb. 7, 2019, 2:03 a.m.
Message ID <10885127d73d591c0af01ff5ceb7b01e@localhost.localdomain>
Download mbox | patch
Permalink /patch/38503/
State Not Applicable
Headers show

Comments

phabricator - Feb. 7, 2019, 2:03 a.m.
This revision was automatically updated to reflect the committed changes.
Closed by commit rHG4d4842445afc: revert: always show relative path to .orig backup (authored by martinvonz, committed by ).

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D5871?vs=13852&id=13869

REVISION DETAIL
  https://phab.mercurial-scm.org/D5871

AFFECTED FILES
  mercurial/cmdutil.py
  tests/test-largefiles-misc.t
  tests/test-revert.t

CHANGE DETAILS




To: martinvonz, #hg-reviewers
Cc: mercurial-devel

Patch

diff --git a/tests/test-revert.t b/tests/test-revert.t
--- a/tests/test-revert.t
+++ b/tests/test-revert.t
@@ -92,7 +92,7 @@ 
   $ echo z > e
   $ hg revert --all -v --config 'ui.origbackuppath=.hg/origbackups'
   creating directory: $TESTTMP/repo/.hg/origbackups
-  saving current version of e as $TESTTMP/repo/.hg/origbackups/e
+  saving current version of e as .hg/origbackups/e
   reverting e
   $ rm -rf .hg/origbackups
 
diff --git a/tests/test-largefiles-misc.t b/tests/test-largefiles-misc.t
--- a/tests/test-largefiles-misc.t
+++ b/tests/test-largefiles-misc.t
@@ -578,7 +578,7 @@ 
   $ echo moremore >> anotherlarge
   $ hg revert anotherlarge -v --config 'ui.origbackuppath=.hg/origbackups'
   creating directory: $TESTTMP/addrm2/.hg/origbackups/.hglf/sub
-  saving current version of ../.hglf/sub/anotherlarge as $TESTTMP/addrm2/.hg/origbackups/.hglf/sub/anotherlarge
+  saving current version of ../.hglf/sub/anotherlarge as ../.hg/origbackups/.hglf/sub/anotherlarge
   reverting ../.hglf/sub/anotherlarge
   creating directory: $TESTTMP/addrm2/.hg/origbackups/sub
   found 90c622cf65cebe75c5842f9136c459333faf392e in store
diff --git a/mercurial/cmdutil.py b/mercurial/cmdutil.py
--- a/mercurial/cmdutil.py
+++ b/mercurial/cmdutil.py
@@ -3018,8 +3018,9 @@ 
                             tobackup.add(abs)
                         elif (backup <= dobackup or wctx[abs].cmp(ctx[abs])):
                             bakname = scmutil.origpath(ui, repo, rel)
+                            relbakname = os.path.relpath(bakname)
                             ui.note(_('saving current version of %s as %s\n') %
-                                    (rel, bakname))
+                                    (rel, relbakname))
                             if not opts.get('dry_run'):
                                 if interactive:
                                     util.copyfile(target, bakname)