[PATCH V3] test-walk: enable for Windows
Adrian Buehlmann
adrian at cadifra.com
Tue Jun 12 03:42:36 CDT 2012
# HG changeset patch
# User Adrian Buehlmann <adrian at cadifra.com>
# Date 1339418460 -7200
# Node ID 199802c1ac5d1b04cfb605b4e8e0b5ad8c809be3
# Parent b112e265b78a614dac15d5be92d39926d5e653da
test-walk: enable for Windows
Changes to V2 of the patch:
- less glob-ish
- less horrible to review
- still keeps that glog:glob file for all cases
- simply doing replace('\\', '/') in debugwalk (after all, it's
just a debug command, so why fuss over it?)
Of course, passes on Windows and Ubtuntu and check-code found nothing
to bicker about.
Can we agree to finally start checking our kidney beans on Windows too? :-)
diff --git a/mercurial/commands.py b/mercurial/commands.py
--- a/mercurial/commands.py
+++ b/mercurial/commands.py
@@ -2375,7 +2375,8 @@
max([len(abs) for abs in items]),
max([len(m.rel(abs)) for abs in items]))
for abs in items:
- line = fmt % (abs, m.rel(abs), m.exact(abs) and 'exact' or '')
+ line = fmt % (abs, m.rel(abs).replace('\\', '/'),
+ m.exact(abs) and 'exact' or '')
ui.write("%s\n" % line.rstrip())
@command('debugwireargs',
diff --git a/tests/test-walk.t b/tests/test-walk.t
--- a/tests/test-walk.t
+++ b/tests/test-walk.t
@@ -1,5 +1,3 @@
- $ "$TESTDIR/hghave" no-windows || exit 80
-
$ hg init t
$ cd t
$ mkdir -p beans
@@ -14,7 +12,6 @@
$ echo fennel > fennel
$ echo fenugreek > fenugreek
$ echo fiddlehead > fiddlehead
- $ echo glob:glob > glob:glob
$ hg addremove
adding beans/black
adding beans/borlotti
@@ -25,14 +22,19 @@
adding fennel
adding fenugreek
adding fiddlehead
- adding glob:glob
adding mammals/Procyonidae/cacomistle
adding mammals/Procyonidae/coatimundi
adding mammals/Procyonidae/raccoon
adding mammals/skunk
+#if no-windows
+ $ echo glob:glob > glob:glob
+ $ hg addremove
+ adding glob:glob
warning: filename contains ':', which is reserved on Windows: 'glob:glob'
+#endif
$ hg commit -m "commit #0"
+#if no-windows
$ hg debugwalk
f beans/black beans/black
f beans/borlotti beans/borlotti
@@ -48,6 +50,24 @@
f mammals/Procyonidae/coatimundi mammals/Procyonidae/coatimundi
f mammals/Procyonidae/raccoon mammals/Procyonidae/raccoon
f mammals/skunk mammals/skunk
+#else
+ $ hg debugwalk
+ f beans/black beans/black
+ f beans/borlotti beans/borlotti
+ f beans/kidney beans/kidney
+ f beans/navy beans/navy
+ f beans/pinto beans/pinto
+ f beans/turtle beans/turtle
+ f fennel fennel
+ f fenugreek fenugreek
+ f fiddlehead fiddlehead
+ f mammals/Procyonidae/cacomistle mammals/Procyonidae/cacomistle
+ f mammals/Procyonidae/coatimundi mammals/Procyonidae/coatimundi
+ f mammals/Procyonidae/raccoon mammals/Procyonidae/raccoon
+ f mammals/skunk mammals/skunk
+#endif
+
+#if no-windows
$ hg debugwalk -I.
f beans/black beans/black
f beans/borlotti beans/borlotti
@@ -63,8 +83,26 @@
f mammals/Procyonidae/coatimundi mammals/Procyonidae/coatimundi
f mammals/Procyonidae/raccoon mammals/Procyonidae/raccoon
f mammals/skunk mammals/skunk
+#else
+ $ hg debugwalk -I.
+ f beans/black beans/black
+ f beans/borlotti beans/borlotti
+ f beans/kidney beans/kidney
+ f beans/navy beans/navy
+ f beans/pinto beans/pinto
+ f beans/turtle beans/turtle
+ f fennel fennel
+ f fenugreek fenugreek
+ f fiddlehead fiddlehead
+ f mammals/Procyonidae/cacomistle mammals/Procyonidae/cacomistle
+ f mammals/Procyonidae/coatimundi mammals/Procyonidae/coatimundi
+ f mammals/Procyonidae/raccoon mammals/Procyonidae/raccoon
+ f mammals/skunk mammals/skunk
+#endif
$ cd mammals
+
+#if no-windows
$ hg debugwalk
f beans/black ../beans/black
f beans/borlotti ../beans/borlotti
@@ -80,6 +118,24 @@
f mammals/Procyonidae/coatimundi Procyonidae/coatimundi
f mammals/Procyonidae/raccoon Procyonidae/raccoon
f mammals/skunk skunk
+#else
+ $ hg debugwalk
+ f beans/black ../beans/black
+ f beans/borlotti ../beans/borlotti
+ f beans/kidney ../beans/kidney
+ f beans/navy ../beans/navy
+ f beans/pinto ../beans/pinto
+ f beans/turtle ../beans/turtle
+ f fennel ../fennel
+ f fenugreek ../fenugreek
+ f fiddlehead ../fiddlehead
+ f mammals/Procyonidae/cacomistle Procyonidae/cacomistle
+ f mammals/Procyonidae/coatimundi Procyonidae/coatimundi
+ f mammals/Procyonidae/raccoon Procyonidae/raccoon
+ f mammals/skunk skunk
+#endif
+
+#if no-windows
$ hg debugwalk -X ../beans
f fennel ../fennel
f fenugreek ../fenugreek
@@ -89,6 +145,17 @@
f mammals/Procyonidae/coatimundi Procyonidae/coatimundi
f mammals/Procyonidae/raccoon Procyonidae/raccoon
f mammals/skunk skunk
+#else
+ $ hg debugwalk -X ../beans
+ f fennel ../fennel
+ f fenugreek ../fenugreek
+ f fiddlehead ../fiddlehead
+ f mammals/Procyonidae/cacomistle Procyonidae/cacomistle
+ f mammals/Procyonidae/coatimundi Procyonidae/coatimundi
+ f mammals/Procyonidae/raccoon Procyonidae/raccoon
+ f mammals/skunk skunk
+#endif
+
$ hg debugwalk -I '*k'
f mammals/skunk skunk
$ hg debugwalk -I 'glob:*k'
@@ -114,13 +181,18 @@
f beans/navy ../beans/navy
f beans/pinto ../beans/pinto
f beans/turtle ../beans/turtle
- $ hg debugwalk -I 'relpath:../beans'
+
+(arguments 'foo:../bar' are mangled by MSYS, so we do these in Python)
+
+ >>> from mercurial.dispatch import request, dispatch
+ >>> dispatch(request(['debugwalk', '-I', 'relpath:../beans']))
f beans/black ../beans/black
f beans/borlotti ../beans/borlotti
f beans/kidney ../beans/kidney
f beans/navy ../beans/navy
f beans/pinto ../beans/pinto
f beans/turtle ../beans/turtle
+
$ hg debugwalk .
f mammals/Procyonidae/cacomistle Procyonidae/cacomistle
f mammals/Procyonidae/coatimundi Procyonidae/coatimundi
@@ -161,7 +233,7 @@
f mammals/Procyonidae/raccoon Procyonidae/raccoon
f mammals/skunk skunk
$ hg debugwalk .hg
- abort: path 'mammals/.hg' is inside nested repo 'mammals'
+ abort: path 'mammals/.hg' is inside nested repo 'mammals' (glob)
[255]
$ hg debugwalk ../.hg
abort: path contains illegal component: .hg
@@ -202,10 +274,10 @@
abort: path contains illegal component: .hg
[255]
$ hg debugwalk beans/../.hg/data
- abort: path contains illegal component: .hg/data
+ abort: path contains illegal component: .hg/data (glob)
[255]
$ hg debugwalk beans/.hg
- abort: path 'beans/.hg' is inside nested repo 'beans'
+ abort: path 'beans/.hg' is inside nested repo 'beans' (glob)
[255]
Test absolute paths:
@@ -223,21 +295,35 @@
Test patterns:
+#if no-windows
$ hg debugwalk glob:\*
f fennel fennel
f fenugreek fenugreek
f fiddlehead fiddlehead
f glob:glob glob:glob
+#else
+ $ hg debugwalk glob:\*
+ f fennel fennel
+ f fenugreek fenugreek
+ f fiddlehead fiddlehead
+#endif
$ hg debugwalk 'glob:**e'
- f beans/turtle beans/turtle
- f mammals/Procyonidae/cacomistle mammals/Procyonidae/cacomistle
+ f beans/turtle beans/turtle (glob)
+ f mammals/Procyonidae/cacomistle mammals/Procyonidae/cacomistle (glob)
+#if no-windows
$ hg debugwalk 're:.*[kb]$'
f beans/black beans/black
f fenugreek fenugreek
f glob:glob glob:glob
f mammals/skunk mammals/skunk
+#else
+ $ hg debugwalk 're:.*[kb]$'
+ f beans/black beans/black
+ f fenugreek fenugreek
+ f mammals/skunk mammals/skunk
+#endif
$ hg debugwalk path:beans/black
f beans/black beans/black exact
@@ -276,9 +362,11 @@
$ hg debugwalk NOEXIST
NOEXIST: * (glob)
+#if fifo
$ mkfifo fifo
$ hg debugwalk fifo
fifo: unsupported file type (type is fifo)
+#endif
$ rm fenugreek
$ hg debugwalk fenugreek
@@ -295,18 +383,24 @@
$ echo '^ignored$' > .hgignore
$ hg debugwalk ignored
$ hg debugwalk ignored/file
- f ignored/file ignored/file exact
+ f ignored/file ignored/file exact (glob)
Test listfile and listfile0
+(arguments 'foo:../bar' are mangled by MSYS, so we do these in Python)
$ python -c "file('../listfile0', 'wb').write('fenugreek\0new\0')"
- $ hg debugwalk -I 'listfile0:../listfile0'
+
+ >>> from mercurial.dispatch import request, dispatch
+ >>> dispatch(request(['debugwalk', '-I', 'listfile0:../listfile0']))
f fenugreek fenugreek
f new new
+
$ python -c "file('../listfile', 'wb').write('fenugreek\nnew\r\nmammals/skunk\n')"
- $ hg debugwalk -I 'listfile:../listfile'
+
+ >>> from mercurial.dispatch import request, dispatch
+ >>> dispatch(request(['debugwalk', '-I', 'listfile:../listfile']))
f fenugreek fenugreek
- f mammals/skunk mammals/skunk
+ f mammals/skunk mammals/skunk (glob)
f new new
$ cd ..
More information about the Mercurial-devel
mailing list