[PATCH 1 of 7] tests: avoid nested quoting on command line for portability

FUJIWARA Katsunori foozy at lares.dti.ne.jp
Fri Feb 5 13:53:34 UTC 2016


# HG changeset patch
# User FUJIWARA Katsunori <foozy at lares.dti.ne.jp>
# Date 1454679125 -32400
#      Fri Feb 05 22:32:05 2016 +0900
# Node ID e1652bc8139ba73b8092b0897a20bd0a8b3b705b
# Parent  01a5143cd25f285f8c745a92986cd7186bb32c90
tests: avoid nested quoting on command line for portability

Before this patch, test-revset.t fails on Solaris using ksh as default
"sh", because nested quoting below isn't acceptable for it.

                +-----------------------------+ inner quoting
    "`python -c "print '|'.join(['0:1'] * 500)"`"
    +-------------------------------------------+ outer quoting

This patch does below for portability.

  - omit outer quoting

    This should be safe, because generated string contains no white
    space character.

  - use '+' instead of '|' (for safety)

    '|' has special meaning for many shell, but '+' isn't (at least,
    for ordinary ones).

diff --git a/tests/test-revset.t b/tests/test-revset.t
--- a/tests/test-revset.t
+++ b/tests/test-revset.t
@@ -1222,7 +1222,7 @@ no crash by empty group "()" while optim
 test that chained `or` operations never eat up stack (issue4624)
 (uses `0:1` instead of `0` to avoid future optimization of trivial revisions)
 
-  $ hg log -T '{rev}\n' -r "`python -c "print '|'.join(['0:1'] * 500)"`"
+  $ hg log -T '{rev}\n' -r `python -c "print '+'.join(['0:1'] * 500)"`
   0
   1
 


More information about the Mercurial-devel mailing list