[PATCH 3 of 3] match: consistently return paths with native separators from uipath()
Martin von Zweigbergk
martinvonz at google.com
Tue Dec 30 10:48:35 CST 2014
FWIW, this series looks good to me. Thanks.
On Mon Dec 29 2014 at 5:39:20 PM Matt Harbison <mharbison72 at gmail.com>
wrote:
> # HG changeset patch
> # User Matt Harbison <matt_harbison at yahoo.com>
> # Date 1419480918 18000
> # Wed Dec 24 23:15:18 2014 -0500
> # Node ID ae491c5bcc4cb921975740149f5b07bdb14e965f
> # Parent 1f18e86a4d081a4d5217cd78cd9d92d060996be4
> match: consistently return paths with native separators from uipath()
>
> The path returned from uipath() was previously os.sep based if files or
> patterns
> were used to create the matcher, but '/' based otherwise. Given that the
> path
> returned can either be relative to cwd or the root of the repo, depending
> upon
> how the matcher was created, this method is only useful for display.
> Therefore,
> it seems harmless to convert the absolute paths to use os.sep too, since
> this
> can be done without taking a dependency on the os module.
>
> With this change, there are only a relative handful of 'adding <file>' and
> 'removing <file>' lines in the tests that are not globbed. Many are tests
> that
> could be globbed, but aren't run on Windows. A couple require code
> changes in
> largefiles and archiving, after which rules can be added to the test suite
> to
> ensure that the globs don't go missing.
>
> diff --git a/mercurial/match.py b/mercurial/match.py
> --- a/mercurial/match.py
> +++ b/mercurial/match.py
> @@ -138,7 +138,8 @@
> '''Convert repo path to a display path. If patterns or -I/-X
> were used
> to create this matcher, the display path will be relative to cwd.
> Otherwise it is relative to the root of the repo.'''
> - return (self._pathrestricted and self.rel(f)) or self.abs(f)
> + return ((self._pathrestricted and self.rel(f))
> + or util.localpath(self.abs(f)))
>
> def files(self):
> '''Explicitly listed files or patterns or roots:
> diff --git a/tests/test-addremove-similar.t b/tests/test-addremove-
> similar.t
> --- a/tests/test-addremove-similar.t
> +++ b/tests/test-addremove-similar.t
> @@ -79,8 +79,8 @@
>
> $ mv d/a d/b
> $ hg addremove -s80
> - removing d/a
> - adding d/b
> + removing d/a (glob)
> + adding d/b (glob)
> recording removal of d/a as rename to d/b (100% similar) (glob)
> $ hg debugstate
> r 0 0 1970-01-01 00:00:00 d/a
> diff --git a/tests/test-addremove.t b/tests/test-addremove.t
> --- a/tests/test-addremove.t
> +++ b/tests/test-addremove.t
> @@ -3,7 +3,7 @@
> $ mkdir dir
> $ touch foo dir/bar
> $ hg -v addremove
> - adding dir/bar
> + adding dir/bar (glob)
> adding foo
> $ hg -v commit -m "add 1"
> dir/bar
> @@ -12,7 +12,7 @@
> $ cd dir/
> $ touch ../foo_2 bar_2
> $ hg -v addremove
> - adding dir/bar_2
> + adding dir/bar_2 (glob)
> adding foo_2
> $ hg -v commit -m "add 2"
> dir/bar_2
> @@ -46,7 +46,7 @@
> adding a.py
> $ hg forget a.py
> $ hg addremove
> - adding dir/a.py
> + adding dir/a.py (glob)
> $ cd ..
>
> $ hg init sim
> diff --git a/tests/test-dirstate.t b/tests/test-dirstate.t
> --- a/tests/test-dirstate.t
> +++ b/tests/test-dirstate.t
> @@ -7,9 +7,9 @@
> $ touch a/b/c/d/y
> $ touch a/b/c/d/z
> $ hg ci -Am m
> - adding a/b/c/d/x
> - adding a/b/c/d/y
> - adding a/b/c/d/z
> + adding a/b/c/d/x (glob)
> + adding a/b/c/d/y (glob)
> + adding a/b/c/d/z (glob)
> $ hg mv a z
> moving a/b/c/d/x to z/b/c/d/x (glob)
> moving a/b/c/d/y to z/b/c/d/y (glob)
> diff --git a/tests/test-fncache.t b/tests/test-fncache.t
> --- a/tests/test-fncache.t
> +++ b/tests/test-fncache.t
> @@ -64,7 +64,7 @@
> $ mkdir tst.d
> $ echo foo > tst.d/foo
> $ hg ci -Amfoo
> - adding tst.d/foo
> + adding tst.d/foo (glob)
> $ find .hg | sort
> .hg
> .hg/00changelog.i
> @@ -93,7 +93,7 @@
> $ mkdir tst.d
> $ echo foo > tst.d/Foo
> $ hg ci -Amfoo
> - adding tst.d/Foo
> + adding tst.d/Foo (glob)
> $ find .hg | sort
> .hg
> .hg/00changelog.i
> diff --git a/tests/test-import.t b/tests/test-import.t
> --- a/tests/test-import.t
> +++ b/tests/test-import.t
> @@ -5,7 +5,7 @@
> $ echo line 1 > a/d1/d2/a
> $ hg --cwd a ci -Ama
> adding a
> - adding d1/d2/a
> + adding d1/d2/a (glob)
>
> $ echo line 2 >> a/a
> $ hg --cwd a ci -u someone -d '1 0' -m'second change'
> @@ -923,7 +923,7 @@
> $ mkdir -p src/cmd/gc
> $ touch src/cmd/gc/mksys.bash
> $ hg ci -Am init
> - adding src/cmd/gc/mksys.bash
> + adding src/cmd/gc/mksys.bash (glob)
> $ hg import - <<EOF
> > # HG changeset patch
> > # User Rob Pike
> diff --git a/tests/test-issue1089.t b/tests/test-issue1089.t
> --- a/tests/test-issue1089.t
> +++ b/tests/test-issue1089.t
> @@ -4,7 +4,7 @@
> $ mkdir a
> $ echo a > a/b
> $ hg ci -Am m
> - adding a/b
> + adding a/b (glob)
>
> $ hg rm a
> removing a/b (glob)
> @@ -13,7 +13,7 @@
> $ mkdir a b
> $ echo a > a/b
> $ hg ci -Am m
> - adding a/b
> + adding a/b (glob)
>
> $ hg rm a
> removing a/b (glob)
> diff --git a/tests/test-issue612.t b/tests/test-issue612.t
> --- a/tests/test-issue612.t
> +++ b/tests/test-issue612.t
> @@ -4,7 +4,7 @@
> $ mkdir src
> $ echo a > src/a.c
> $ hg ci -Ama
> - adding src/a.c
> + adding src/a.c (glob)
>
> $ hg mv src source
> moving src/a.c to source/a.c (glob)
> diff --git a/tests/test-issue660.t b/tests/test-issue660.t
> --- a/tests/test-issue660.t
> +++ b/tests/test-issue660.t
> @@ -7,7 +7,7 @@
> $ echo b > b/b
> $ hg commit -A -m "a is file, b is dir"
> adding a
> - adding b/b
> + adding b/b (glob)
>
> File replaced with directory:
>
> @@ -91,9 +91,9 @@
>
> $ hg addremove -s 0
> removing a
> - adding a/a
> + adding a/a (glob)
> adding b
> - removing b/b
> + removing b/b (glob)
>
> $ hg st
> A a/a
> @@ -114,7 +114,7 @@
> $ mkdir d/d
> $ echo d > d/d/d
> $ hg commit -A -m "d is long directory"
> - adding d/d/d
> + adding d/d/d (glob)
>
> $ rm -r d
> $ echo d > d
> diff --git a/tests/test-lfconvert.t b/tests/test-lfconvert.t
> --- a/tests/test-lfconvert.t
> +++ b/tests/test-lfconvert.t
> @@ -30,8 +30,8 @@
> adding large
> adding large2
> adding normal1
> - adding sub/maybelarge.dat
> - adding sub/normal2
> + adding sub/maybelarge.dat (glob)
> + adding sub/normal2 (glob)
> $ hg commit -m"add large, normal1" large normal1
> $ hg commit -m"add sub/*" sub
>
> diff --git a/tests/test-locate.t b/tests/test-locate.t
> --- a/tests/test-locate.t
> +++ b/tests/test-locate.t
> @@ -13,11 +13,11 @@
> $ hg ci -A -m m
> adding a
> adding b
> - adding dir.h/foo
> + adding dir.h/foo (glob)
> adding t.h
> - adding t/b
> - adding t/e.h
> - adding t/x
> + adding t/b (glob)
> + adding t/e.h (glob)
> + adding t/x (glob)
>
> $ touch nottracked
>
> diff --git a/tests/test-mq-qnew.t b/tests/test-mq-qnew.t
> --- a/tests/test-mq-qnew.t
> +++ b/tests/test-mq-qnew.t
> @@ -135,7 +135,7 @@
> popping mtest.patch
> popping uncommitted.patch
> patch queue now empty
> - adding d/b
> + adding d/b (glob)
> M d/b
> diff --git a/d/b b/d/b
> --- a/d/b
> @@ -205,7 +205,7 @@
> popping mtest.patch
> popping uncommitted.patch
> patch queue now empty
> - adding d/b
> + adding d/b (glob)
> M d/b
> # HG changeset patch
> # Parent
> diff --git a/tests/test-mq-qrefresh.t b/tests/test-mq-qrefresh.t
> --- a/tests/test-mq-qrefresh.t
> +++ b/tests/test-mq-qrefresh.t
> @@ -12,8 +12,8 @@
> $ echo 'base' > 1/base
> $ echo 'base' > 2/base
> $ hg ci -Ambase
> - adding 1/base
> - adding 2/base
> + adding 1/base (glob)
> + adding 2/base (glob)
>
> $ hg qnew -mmqbase mqbase
>
> diff --git a/tests/test-mq.t b/tests/test-mq.t
> --- a/tests/test-mq.t
> +++ b/tests/test-mq.t
> @@ -111,7 +111,7 @@
> $ mkdir b
> $ echo z > b/z
> $ hg ci -Ama
> - adding b/z
> + adding b/z (glob)
>
>
> qinit
> diff --git a/tests/test-rebase-rename.t b/tests/test-rebase-rename.t
> --- a/tests/test-rebase-rename.t
> +++ b/tests/test-rebase-rename.t
> @@ -18,7 +18,7 @@
>
> $ echo b > d/b
> $ hg ci -Am B
> - adding d/b
> + adding d/b (glob)
>
> $ hg mv d d-renamed
> moving d/b to d-renamed/b (glob)
> diff --git a/tests/test-record.t b/tests/test-record.t
> --- a/tests/test-record.t
> +++ b/tests/test-record.t
> @@ -664,7 +664,7 @@
> $ cd subdir
> $ echo a > a
> $ hg ci -d '16 0' -Amsubdir
> - adding subdir/a
> + adding subdir/a (glob)
>
> $ echo a >> a
> $ hg record -d '16 0' -m subdir-change a <<EOF
> diff --git a/tests/test-remove.t b/tests/test-remove.t
> --- a/tests/test-remove.t
> +++ b/tests/test-remove.t
> @@ -189,8 +189,8 @@
> $ echo a > test/foo
> $ echo b > test/bar
> $ hg ci -Am2
> - adding test/bar
> - adding test/foo
> + adding test/bar (glob)
> + adding test/foo (glob)
>
> dir, options none
>
> @@ -247,8 +247,8 @@
> $ echo x > issue1861/x
> $ echo y > issue1861/b/c/y
> $ hg ci -Am add
> - adding issue1861/b/c/y
> - adding issue1861/x
> + adding issue1861/b/c/y (glob)
> + adding issue1861/x (glob)
> $ hg rm issue1861/b
> removing issue1861/b/c/y (glob)
> $ hg ci -m remove
> diff --git a/tests/test-rename-dir-merge.t b/tests/test-rename-dir-merge.t
> --- a/tests/test-rename-dir-merge.t
> +++ b/tests/test-rename-dir-merge.t
> @@ -5,8 +5,8 @@
> $ echo foo > a/a
> $ echo bar > a/b
> $ hg ci -Am "0"
> - adding a/a
> - adding a/b
> + adding a/a (glob)
> + adding a/b (glob)
>
> $ hg co -C 0
> 0 files updated, 0 files merged, 0 files removed, 0 files unresolved
> diff --git a/tests/test-rename.t b/tests/test-rename.t
> --- a/tests/test-rename.t
> +++ b/tests/test-rename.t
> @@ -55,8 +55,8 @@
>
> $ mv d1/d11/a1 d2/c
> $ hg addrem -s 0
> - removing d1/d11/a1
> - adding d2/c
> + removing d1/d11/a1 (glob)
> + adding d2/c (glob)
> $ hg rename --after d1/d11/a1 d2/c
> $ hg status -C
> A d2/c
> diff --git a/tests/test-revert.t b/tests/test-revert.t
> --- a/tests/test-revert.t
> +++ b/tests/test-revert.t
> @@ -212,7 +212,7 @@
> ----------------------------------------------------
>
> $ hg ci -A -m b
> - adding b/b
> + adding b/b (glob)
> created new head
> $ echo foobar > b/b
> $ mkdir newdir
> diff --git a/tests/test-subrepo-deep-nested-change.t
> b/tests/test-subrepo-deep-nested-change.t
> --- a/tests/test-subrepo-deep-nested-change.t
> +++ b/tests/test-subrepo-deep-nested-change.t
> @@ -107,7 +107,7 @@
> $ mkdir sub1/sub2/folder
> $ echo 'subfolder' > sub1/sub2/folder/test.txt
> $ hg ci -ASm "add test.txt"
> - adding sub1/sub2/folder/test.txt
> + adding sub1/sub2/folder/test.txt (glob)
> committing subrepository sub1
> committing subrepository sub1/sub2 (glob)
>
> @@ -162,11 +162,11 @@
> $ rm sub1/sub2/folder/test.txt
> $ rm sub1/sub2/test.txt
> $ hg ci -ASm "remove test.txt"
> - adding sub1/sub2/folder/bar
> - removing sub1/sub2/folder/test.txt
> - removing sub1/sub2/test.txt
> - adding sub1/foo
> - adding foo/bar/abc
> + adding sub1/sub2/folder/bar (glob)
> + removing sub1/sub2/folder/test.txt (glob)
> + removing sub1/sub2/test.txt (glob)
> + adding sub1/foo (glob)
> + adding foo/bar/abc (glob)
> committing subrepository sub1
> committing subrepository sub1/sub2 (glob)
> $ hg rollback -q
> diff --git a/tests/test-walk.t b/tests/test-walk.t
> --- a/tests/test-walk.t
> +++ b/tests/test-walk.t
> @@ -13,19 +13,19 @@
> $ echo fenugreek > fenugreek
> $ echo fiddlehead > fiddlehead
> $ hg addremove
> - adding beans/black
> - adding beans/borlotti
> - adding beans/kidney
> - adding beans/navy
> - adding beans/pinto
> - adding beans/turtle
> + adding beans/black (glob)
> + adding beans/borlotti (glob)
> + adding beans/kidney (glob)
> + adding beans/navy (glob)
> + adding beans/pinto (glob)
> + adding beans/turtle (glob)
> adding fennel
> adding fenugreek
> adding fiddlehead
> - adding mammals/Procyonidae/cacomistle
> - adding mammals/Procyonidae/coatimundi
> - adding mammals/Procyonidae/raccoon
> - adding mammals/skunk
> + adding mammals/Procyonidae/cacomistle (glob)
> + adding mammals/Procyonidae/coatimundi (glob)
> + adding mammals/Procyonidae/raccoon (glob)
> + adding mammals/skunk (glob)
> $ hg commit -m "commit #0"
>
> $ hg debugwalk
> _______________________________________________
> Mercurial-devel mailing list
> Mercurial-devel at selenic.com
> http://selenic.com/mailman/listinfo/mercurial-devel
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://selenic.com/pipermail/mercurial-devel/attachments/20141230/db1890ba/attachment.html>
More information about the Mercurial-devel
mailing list