Patchwork [1,of,3] tests: convert the 'file://\$TESTTMP' rule to an automatic substitution

login
register
mail settings
Submitter Matt Harbison
Date Dec. 17, 2017, 12:27 a.m.
Message ID <c0cbd08b9b48e073ae35.1513470442@Envy>
Download mbox | patch
Permalink /patch/26326/
State Accepted
Headers show

Comments

Matt Harbison - Dec. 17, 2017, 12:27 a.m.
# HG changeset patch
# User Matt Harbison <matt_harbison@yahoo.com>
# Date 1513441930 18000
#      Sat Dec 16 11:32:10 2017 -0500
# Node ID c0cbd08b9b48e073ae354cd8a7fc6f33f257e735
# Parent  6be75f7925b85b3e21f36a346ac6e08def6004c2
tests: convert the 'file://\$TESTTMP' rule to an automatic substitution

The rule only triggered on non Windows platforms, even though Windows also
required an adjustment.  Automatic seems better.

The aggressive globbing in test-subrepo-svn.t was found and rewritten by the
substitution.
Gregory Szorc - Dec. 17, 2017, 7:04 p.m.
On Sat, Dec 16, 2017 at 4:27 PM, Matt Harbison <mharbison72@gmail.com>
wrote:

> # HG changeset patch
> # User Matt Harbison <matt_harbison@yahoo.com>
> # Date 1513441930 18000
> #      Sat Dec 16 11:32:10 2017 -0500
> # Node ID c0cbd08b9b48e073ae354cd8a7fc6f33f257e735
> # Parent  6be75f7925b85b3e21f36a346ac6e08def6004c2
> tests: convert the 'file://\$TESTTMP' rule to an automatic substitution
>

Queued parts 1 and 2. Held off on 3 because of potential test regression.


>
> The rule only triggered on non Windows platforms, even though Windows also
> required an adjustment.  Automatic seems better.
>
> The aggressive globbing in test-subrepo-svn.t was found and rewritten by
> the
> substitution.
>
> diff --git a/contrib/check-code.py b/contrib/check-code.py
> --- a/contrib/check-code.py
> +++ b/contrib/check-code.py
> @@ -181,8 +181,6 @@
>      (uprefix + r'.*:\.\S*/', "x:.y in a path does not work on msys,
> rewrite "
>       "as x://.y, or see `hg log -k msys` for alternatives", r'-\S+:\.|'
> #-Rxxx
>       '# no-msys'), # in test-pull.t which is skipped on windows
> -    (r'^  .*file://\$TESTTMP',
> -     'write "file:/*/$TESTTMP" + (glob) to match on windows too'),
>      (r'^  [^$>].*27\.0\.0\.1',
>       'use $LOCALIP not an explicit loopback address'),
>      (r'^  (?![>$] ).*\$LOCALIP.*[^)]$',
> diff --git a/tests/common-pattern.py b/tests/common-pattern.py
> --- a/tests/common-pattern.py
> +++ b/tests/common-pattern.py
> @@ -38,6 +38,14 @@
>      (br' - - \[\d\d/.../2\d\d\d \d\d:\d\d:\d\d] "GET',
>       br' - - [$LOGDATE$] "GET'
>      ),
> +    # Windows has an extra '/' in the following lines that get globbed
> away:
> +    #   pushing to file:/*/$TESTTMP/r2 (glob)
> +    #   comparing with file:/*/$TESTTMP/r2 (glob)
> +    #   sub/maybelarge.dat: largefile 34..9c not available from
> +    #       file:/*/$TESTTMP/largefiles-repo (glob)
> +    (br'(.*file:/)/?(/\$TESTTMP.*)',
> +     lambda m: m.group(1) + b'*' + m.group(2) + b' (glob)'
> +    ),
>  ]
>
>  # Various platform error strings, keyed on a common replacement string
> diff --git a/tests/test-subrepo-svn.t b/tests/test-subrepo-svn.t
> --- a/tests/test-subrepo-svn.t
> +++ b/tests/test-subrepo-svn.t
> @@ -91,10 +91,10 @@
>
>    $ hg debugsub
>    path s
> -   source   file://*/svn-repo/src (glob)
> +   source   file:/*/$TESTTMP/svn-repo/src (glob)
>     revision 2
>    path subdir/s
> -   source   file://*/svn-repo/src (glob)
> +   source   file:/*/$TESTTMP/svn-repo/src (glob)
>     revision 2
>
>  change file in svn and hg, commit
> @@ -117,10 +117,10 @@
>    At revision 3.
>    $ hg debugsub
>    path s
> -   source   file://*/svn-repo/src (glob)
> +   source   file:/*/$TESTTMP/svn-repo/src (glob)
>     revision 3
>    path subdir/s
> -   source   file://*/svn-repo/src (glob)
> +   source   file:/*/$TESTTMP/svn-repo/src (glob)
>     revision 2
>
>  missing svn file, commit should fail
> @@ -239,10 +239,10 @@
>
>    $ hg debugsub
>    path s
> -   source   file://*/svn-repo/src (glob)
> +   source   file:/*/$TESTTMP/svn-repo/src (glob)
>     revision 3
>    path subdir/s
> -   source   file://*/svn-repo/src (glob)
> +   source   file:/*/$TESTTMP/svn-repo/src (glob)
>     revision 2
>
>  verify subrepo is contained within the repo directory
> _______________________________________________
> Mercurial-devel mailing list
> Mercurial-devel@mercurial-scm.org
> https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
>

Patch

diff --git a/contrib/check-code.py b/contrib/check-code.py
--- a/contrib/check-code.py
+++ b/contrib/check-code.py
@@ -181,8 +181,6 @@ 
     (uprefix + r'.*:\.\S*/', "x:.y in a path does not work on msys, rewrite "
      "as x://.y, or see `hg log -k msys` for alternatives", r'-\S+:\.|' #-Rxxx
      '# no-msys'), # in test-pull.t which is skipped on windows
-    (r'^  .*file://\$TESTTMP',
-     'write "file:/*/$TESTTMP" + (glob) to match on windows too'),
     (r'^  [^$>].*27\.0\.0\.1',
      'use $LOCALIP not an explicit loopback address'),
     (r'^  (?![>$] ).*\$LOCALIP.*[^)]$',
diff --git a/tests/common-pattern.py b/tests/common-pattern.py
--- a/tests/common-pattern.py
+++ b/tests/common-pattern.py
@@ -38,6 +38,14 @@ 
     (br' - - \[\d\d/.../2\d\d\d \d\d:\d\d:\d\d] "GET',
      br' - - [$LOGDATE$] "GET'
     ),
+    # Windows has an extra '/' in the following lines that get globbed away:
+    #   pushing to file:/*/$TESTTMP/r2 (glob)
+    #   comparing with file:/*/$TESTTMP/r2 (glob)
+    #   sub/maybelarge.dat: largefile 34..9c not available from
+    #       file:/*/$TESTTMP/largefiles-repo (glob)
+    (br'(.*file:/)/?(/\$TESTTMP.*)',
+     lambda m: m.group(1) + b'*' + m.group(2) + b' (glob)'
+    ),
 ]
 
 # Various platform error strings, keyed on a common replacement string
diff --git a/tests/test-subrepo-svn.t b/tests/test-subrepo-svn.t
--- a/tests/test-subrepo-svn.t
+++ b/tests/test-subrepo-svn.t
@@ -91,10 +91,10 @@ 
 
   $ hg debugsub
   path s
-   source   file://*/svn-repo/src (glob)
+   source   file:/*/$TESTTMP/svn-repo/src (glob)
    revision 2
   path subdir/s
-   source   file://*/svn-repo/src (glob)
+   source   file:/*/$TESTTMP/svn-repo/src (glob)
    revision 2
 
 change file in svn and hg, commit
@@ -117,10 +117,10 @@ 
   At revision 3.
   $ hg debugsub
   path s
-   source   file://*/svn-repo/src (glob)
+   source   file:/*/$TESTTMP/svn-repo/src (glob)
    revision 3
   path subdir/s
-   source   file://*/svn-repo/src (glob)
+   source   file:/*/$TESTTMP/svn-repo/src (glob)
    revision 2
 
 missing svn file, commit should fail
@@ -239,10 +239,10 @@ 
 
   $ hg debugsub
   path s
-   source   file://*/svn-repo/src (glob)
+   source   file:/*/$TESTTMP/svn-repo/src (glob)
    revision 3
   path subdir/s
-   source   file://*/svn-repo/src (glob)
+   source   file:/*/$TESTTMP/svn-repo/src (glob)
    revision 2
 
 verify subrepo is contained within the repo directory