# HG changeset patch # User Martin von Zweigbergk # Date 2014-12-02 05:48:32 # Node ID 3778884197f048402f79836788ba9aaf31338972 # Parent 19ebd2f88fc77282efe724b30de8750f79771e8f 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. diff --git a/mercurial/scmutil.py b/mercurial/scmutil.py --- a/mercurial/scmutil.py +++ b/mercurial/scmutil.py @@ -732,9 +732,9 @@ def addremove(repo, pats=[], opts={}, dr 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, diff --git a/tests/test-addremove.t b/tests/test-addremove.t --- a/tests/test-addremove.t +++ b/tests/test-addremove.t @@ -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