[PATCH] addremove: print relative paths when called with -I/-X

Martin von Zweigbergk martinvonz at google.com
Tue Dec 2 01:02:29 CST 2014


mpm, I see you have a lot of patches in flight. If you agree with this
patch, you may want to pick it before the other Matt's patches, and instead
make the poor guy send a V3.

Matt, I didn't look past the first 6 or so patches. Did the anyfiles()
method end up being used anywhere else, or would this patch remove the need
for it completely?

On Mon Dec 01 2014 at 9:56:26 PM Martin von Zweigbergk <
martinvonz at google.com> 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
>
> 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
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://selenic.com/pipermail/mercurial-devel/attachments/20141202/6fdb2b1d/attachment.html>


More information about the Mercurial-devel mailing list