Patchwork [1,of,2] testlib: move the prune alias into a shell script for Windows

login
register
mail settings
Submitter Matt Harbison
Date April 16, 2017, 5:36 a.m.
Message ID <01b8058372c5e1344ed5.1492320976@Envy>
Download mbox | patch
Permalink /patch/20237/
State Accepted
Headers show

Comments

Matt Harbison - April 16, 2017, 5:36 a.m.
# HG changeset patch
# User Matt Harbison <matt_harbison@yahoo.com>
# Date 1492316978 14400
#      Sun Apr 16 00:29:38 2017 -0400
# Node ID 01b8058372c5e1344ed5a83ce5968c2ce6906157
# Parent  4c2c30bc38b4f84ce8f215146bbf158e299065b3
testlib: move the prune alias into a shell script for Windows

Cramming all of this directly into an alias doesn't play nicely on Windows.
Various test-exchange-obsmarkers-case-XX.t were failing with:

    abort: cannot select revision when creating marker

It turned out that inside debugcommands.debugobsolete(), the following differed
from Linux (where they were empty, at least in the case I debugged):

    'rev': ['.`;'],
    'template': "'{node}\\n'"
Yuya Nishihara - April 16, 2017, 11 a.m.
On Sun, 16 Apr 2017 01:36:16 -0400, Matt Harbison wrote:
> # HG changeset patch
> # User Matt Harbison <matt_harbison@yahoo.com>
> # Date 1492316978 14400
> #      Sun Apr 16 00:29:38 2017 -0400
> # Node ID 01b8058372c5e1344ed5a83ce5968c2ce6906157
> # Parent  4c2c30bc38b4f84ce8f215146bbf158e299065b3
> testlib: move the prune alias into a shell script for Windows

Seems fine. Queued, thanks.

> diff --git a/tests/testlib/exchange-obsmarker-util.sh b/tests/testlib/exchange-obsmarker-util.sh
> --- a/tests/testlib/exchange-obsmarker-util.sh
> +++ b/tests/testlib/exchange-obsmarker-util.sh
> @@ -1,6 +1,14 @@
>  #!/bin/sh
>  # setup config and various utility to test obsolescence marker exchanges tests
>  
> +
> +cat >> $TESTTMP/prune.sh << EOF

You could use << 'EOF' to disable variable expansion.

> +rev=\`hg log --hidden --template '{node}\n' --rev "\$3"\`
> +
> +hg debugobsolete --record-parents \$1 "\$2" \$rev \
> +   && hg up --quiet 'max((::.) - obsolete())'
> +EOF

Patch

diff --git a/tests/testlib/exchange-obsmarker-util.sh b/tests/testlib/exchange-obsmarker-util.sh
--- a/tests/testlib/exchange-obsmarker-util.sh
+++ b/tests/testlib/exchange-obsmarker-util.sh
@@ -1,6 +1,14 @@ 
 #!/bin/sh
 # setup config and various utility to test obsolescence marker exchanges tests
 
+
+cat >> $TESTTMP/prune.sh << EOF
+rev=\`hg log --hidden --template '{node}\n' --rev "\$3"\`
+
+hg debugobsolete --record-parents \$1 "\$2" \$rev \
+   && hg up --quiet 'max((::.) - obsolete())'
+EOF
+
 cat >> $HGRCPATH <<EOF
 [web]
 # We test http pull and push, drop authentication requirement
@@ -29,8 +37,7 @@ 
 # fix date used to create obsolete markers.
 debugobsolete=debugobsolete -d '0 0'
 # poor man substiture to the evolve 'hg prune'. using prune makes the test clearer and 
-prune =!hg debugobsolete --record-parents \$1 "\$2" \`hg log --hidden --template '{node}\n' --rev "\$3"\`;\
-        hg up --quiet 'max((::.) - obsolete())'
+prune = !sh $TESTTMP/prune.sh \$1 "\$2" "\$3"
 EOF
 
 mkcommit() {