[PATCH 4 of 4] tests: write largefile output with condition to match on windows

Simon Heimberg simohe at besonet.ch
Tue Feb 4 00:14:20 UTC 2014


# HG changeset patch
# User Simon Heimberg <simohe at besonet.ch>
# Date 1391472520 -3600
#      Tue Feb 04 01:08:40 2014 +0100
# Branch stable
# Node ID 12848a52ec6f06b41f19bd9fe0ab6355114dcca0
# Parent  7662e108fceac6850555359f0e668083b0f22598
tests: write largefile output with condition to match on windows

On windows $TESTTMP does not start with a slash. Therefore, the file url is
written with three slashes before $TESTMP. This can not be matched nicely by a
glob or a regext. Therefore write two output versions.

Update check-code.py because the pattern matches wrong and appending (glob)
does not help. The modified pattern is checked in test-check-code.t.

diff -r 7662e108fcea -r 12848a52ec6f contrib/check-code.py
--- a/contrib/check-code.py	Tue Feb 04 01:08:35 2014 +0100
+++ b/contrib/check-code.py	Tue Feb 04 01:08:40 2014 +0100
@@ -161,7 +161,8 @@
     (r'^  pushing subrepo \S+/\S+ to.*[^)]$', winglobmsg),
     (r'^  moving \S+/.*[^)]$', winglobmsg),
     (r'^  no changes made to subrepo since.*/.*[^)]$', winglobmsg),
-    (r'^  .*: largefile \S+ not available from file:.*/.*[^)]$', winglobmsg),
+    (r'\n  .*: largefile \S+ not available from file://..*/.*',
+     "use '#if windows' + '#else' to match file:///$.. + file://$..", '#else'),
   ],
   # warnings
   [
diff -r 7662e108fcea -r 12848a52ec6f tests/test-check-code.t
--- a/tests/test-check-code.t	Tue Feb 04 01:08:35 2014 +0100
+++ b/tests/test-check-code.t	Tue Feb 04 01:08:40 2014 +0100
@@ -77,8 +77,13 @@
   > no_class = 1:
   >     pass
   > EOF
+  $ cat > test-unified.t <<EOF
+  >   $ dummy command
+  >   large0: largefile x not available from file://\$X/y
+  > EOF
   $ check_code="$TESTDIR"/../contrib/check-code.py
-  $ "$check_code" ./wrong.py ./correct.py ./quote.py ./non-py24.py ./classstyle.py
+  $ "$check_code" ./wrong.py ./correct.py ./quote.py ./non-py24.py ./classstyle.py \
+  > ./test-unified.t
   ./wrong.py:1:
    > def toto( arg1, arg2):
    gratuitous whitespace in () or []
@@ -119,6 +124,9 @@
   ./classstyle.py:7:
    > class empty():
    class foo() not available in Python 2.4, use class foo(object)
+  ./test-unified.t:1:
+   >   $ dummy command
+   use '#if windows' + '#else' to match file:///$.. + file://$..
   [1]
   $ cat > python3-compat.py << EOF
   > foo <> bar
diff -r 7662e108fcea -r 12848a52ec6f tests/test-largefiles-cache.t
--- a/tests/test-largefiles-cache.t	Tue Feb 04 01:08:35 2014 +0100
+++ b/tests/test-largefiles-cache.t	Tue Feb 04 01:08:40 2014 +0100
@@ -47,7 +47,11 @@
 
   $ hg update -r0
   getting changed largefiles
-  large: largefile 7f7097b041ccf68cc5561e9600da4655d21c6d18 not available from file://$TESTTMP/mirror (glob)
+#if windows
+  large: largefile 7f7097b041ccf68cc5561e9600da4655d21c6d18 not available from file:///$TESTTMP\mirror
+#else
+  large: largefile 7f7097b041ccf68cc5561e9600da4655d21c6d18 not available from file://$TESTTMP/mirror
+#endif
   0 largefiles updated, 0 removed
   1 files updated, 0 files merged, 0 files removed, 0 files unresolved
   $ hg status
@@ -64,7 +68,11 @@
 
   $ hg update -r0
   getting changed largefiles
-  large: largefile 7f7097b041ccf68cc5561e9600da4655d21c6d18 not available from file://$TESTTMP/mirror (glob)
+#if windows
+  large: largefile 7f7097b041ccf68cc5561e9600da4655d21c6d18 not available from file:///$TESTTMP\mirror
+#else
+  large: largefile 7f7097b041ccf68cc5561e9600da4655d21c6d18 not available from file://$TESTTMP/mirror
+#endif
   0 largefiles updated, 0 removed
   1 files updated, 0 files merged, 0 files removed, 0 files unresolved
   $ hg status
diff -r 7662e108fcea -r 12848a52ec6f tests/test-largefiles.t
--- a/tests/test-largefiles.t	Tue Feb 04 01:08:35 2014 +0100
+++ b/tests/test-largefiles.t	Tue Feb 04 01:08:40 2014 +0100
@@ -1280,7 +1280,11 @@
   $ rm ${USERCACHE}/7838695e10da2bb75ac1156565f40a2595fa2fa0
   $ hg up -r 6
   getting changed largefiles
-  large3: largefile 7838695e10da2bb75ac1156565f40a2595fa2fa0 not available from file://$TESTTMP/d (glob)
+#if windows
+  large3: largefile 7838695e10da2bb75ac1156565f40a2595fa2fa0 not available from file:///$TESTTMP\d
+#else
+  large3: largefile 7838695e10da2bb75ac1156565f40a2595fa2fa0 not available from file://$TESTTMP/d
+#endif
   1 largefiles updated, 2 removed
   4 files updated, 0 files merged, 2 files removed, 0 files unresolved
   $ rm normal3
@@ -1301,7 +1305,11 @@
   ! normal3
   $ hg up -Cr.
   getting changed largefiles
-  large3: largefile 7838695e10da2bb75ac1156565f40a2595fa2fa0 not available from file://$TESTTMP/d (glob)
+#if windows
+  large3: largefile 7838695e10da2bb75ac1156565f40a2595fa2fa0 not available from file:///$TESTTMP\d
+#else
+  large3: largefile 7838695e10da2bb75ac1156565f40a2595fa2fa0 not available from file://$TESTTMP/d
+#endif
   0 largefiles updated, 0 removed
   1 files updated, 0 files merged, 0 files removed, 0 files unresolved
   $ hg st
@@ -1323,7 +1331,11 @@
   4 files updated, 0 files merged, 0 files removed, 0 files unresolved
   (branch merge, don't forget to commit)
   getting changed largefiles
-  large3: largefile 7838695e10da2bb75ac1156565f40a2595fa2fa0 not available from file://$TESTTMP/d (glob)
+#if windows
+  large3: largefile 7838695e10da2bb75ac1156565f40a2595fa2fa0 not available from file:///$TESTTMP\d
+#else
+  large3: largefile 7838695e10da2bb75ac1156565f40a2595fa2fa0 not available from file://$TESTTMP/d
+#endif
   1 largefiles updated, 0 removed
 
   $ hg rollback -q
diff -r 7662e108fcea -r 12848a52ec6f tests/test-lfconvert.t
--- a/tests/test-lfconvert.t	Tue Feb 04 01:08:35 2014 +0100
+++ b/tests/test-lfconvert.t	Tue Feb 04 01:08:40 2014 +0100
@@ -342,7 +342,11 @@
   $ rm largefiles-repo/.hg/largefiles/*
   $ hg lfconvert --to-normal issue3519 normalized3519
   initializing destination normalized3519
-  large: largefile 2e000fa7e85759c7f4c254d4d9c33ef481e459a7 not available from file://$TESTTMP/largefiles-repo (glob)
+#if windows
+  large: largefile 2e000fa7e85759c7f4c254d4d9c33ef481e459a7 not available from file:///$TESTTMP\largefiles-repo
+#else
+  large: largefile 2e000fa7e85759c7f4c254d4d9c33ef481e459a7 not available from file://$TESTTMP/largefiles-repo
+#endif
   abort: missing largefile 'large' from revision d4892ec57ce212905215fad1d9018f56b99202ad
   [255]
 



More information about the Mercurial-devel mailing list