[PATCH] addremove: print relative paths when called with -I/-X
Augie Fackler
raf at durin42.com
Tue Dec 2 09:52:49 CST 2014
On Mon, Dec 01, 2014 at 09:56:25PM -0800, Martin von Zweigbergk wrote:
> # HG changeset patch
> # User Martin von Zweigbergk <martinvonz at google.com>
> # Date 1417499312 28800
> # Mon Dec 01 21:48:32 2014 -0800
> # Node ID 0ec94796e8c2d5c142976edb49c911a92341b109
> # Parent 19ebd2f88fc77282efe724b30de8750f79771e8f
> addremove: print relative paths when called with -I/-X
LGTM, queued with (bc) flag
>
> 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 @@
> 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
> _______________________________________________
> Mercurial-devel mailing list
> Mercurial-devel at selenic.com
> http://selenic.com/mailman/listinfo/mercurial-devel
More information about the Mercurial-devel
mailing list