changeset 23427:3778884197f0

addremove: print relative paths when called with -I/-X (BC) For "hg addremove 'glob:*.py'", we print any paths added or removed as relative to the current directory, but when "hg addremove -I 'glob:*.py'" is used, we use the absolute path (relative from the repo root). It seems like they should be the same, so change it so we use relative paths in both cases. Continue to use absolute paths when no patterns are given.
author Martin von Zweigbergk <martinvonz@google.com>
date Mon, 01 Dec 2014 21:48:32 -0800
parents 19ebd2f88fc7
children b5e3f3d25395
files mercurial/scmutil.py tests/test-addremove.t
diffstat 2 files changed, 17 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/scmutil.py	Mon Dec 01 19:34:11 2014 -0600
+++ b/mercurial/scmutil.py	Mon Dec 01 21:48:32 2014 -0800
@@ -732,9 +732,9 @@
         if repo.ui.verbose or not m.exact(abs):
             rel = m.rel(abs)
             if abs in unknownset:
-                status = _('adding %s\n') % ((pats and rel) or abs)
+                status = _('adding %s\n') % ((m.anypats() and rel) or abs)
             else:
-                status = _('removing %s\n') % ((pats and rel) or abs)
+                status = _('removing %s\n') % ((m.anypats() and rel) or abs)
             repo.ui.status(status)
 
     renames = _findrenames(repo, m, added + unknown, removed + deleted,
--- a/tests/test-addremove.t	Mon Dec 01 19:34:11 2014 -0600
+++ b/tests/test-addremove.t	Mon Dec 01 21:48:32 2014 -0800
@@ -24,6 +24,21 @@
   adding foo
   $ cd ..
 
+  $ hg init subdir
+  $ cd subdir
+  $ mkdir dir
+  $ cd dir
+  $ touch a.py
+  $ hg addremove 'glob:*.py'
+  adding a.py
+  $ hg forget a.py
+  $ hg addremove -I 'glob:*.py'
+  adding a.py
+  $ hg forget a.py
+  $ hg addremove
+  adding dir/a.py
+  $ cd ..
+
   $ hg init sim
   $ cd sim
   $ echo a > a