# HG changeset patch # User FUJIWARA Katsunori # Date 2017-06-09 04:07:49 # Node ID 627eaab1ad072ac89e579f365627c6bc8394a6ba # Parent b698921ee1378b039a0f8bef5a3aace16d658b9d tests: factor external procedures out for portability Fortunately, "&&" is treated as "execute next, if previous doesn't fail" both on POSIX and Windows. But keeping portability of "dirstaterace.command" manually is troublesome. This patch factors external procedures out as a shell script for portability. "sh SCRIPT" always allows scripting in POSIX style. This change is also for convenience. Fixed script name can reduce command line arguments. "r" prefix is needed for "sh '$TESTTMP/dirstaterace.sh'", because $TESTTMP contains backslash on Windows. diff --git a/tests/test-dirstate-race.t b/tests/test-dirstate-race.t --- a/tests/test-dirstate-race.t +++ b/tests/test-dirstate-race.t @@ -57,7 +57,8 @@ confused with a file with the exec bit s > extensions.wrapfunction(context.workingctx, '_checklookup', overridechecklookup) > def overridechecklookup(orig, self, files): > # make an update that changes the dirstate from underneath - > self._repo.ui.system(self._repo.ui.config('dirstaterace', 'command'), cwd=self._repo.root) + > self._repo.ui.system(r"sh '$TESTTMP/dirstaterace.sh'", + > cwd=self._repo.root) > return orig(self, files) > EOF @@ -73,8 +74,11 @@ XXX Note that this returns M for files t definitely a bug, but the fix for that is hard and the next status run is fine anyway. - $ hg status --config extensions.dirstaterace=$TESTTMP/dirstaterace.py \ - > --config dirstaterace.command='rm b && rm -r dir1 && rm d && mkdir d && rm e && mkdir e' + $ cat > $TESTTMP/dirstaterace.sh < rm b && rm -r dir1 && rm d && mkdir d && rm e && mkdir e + > EOF + + $ hg status --config extensions.dirstaterace=$TESTTMP/dirstaterace.py M d M e ! b