# HG changeset patch # User Mads Kiilerich # Date 2012-06-10 12:14:05 # Node ID 8149ff405c7841e941ee647ba8572fc35445b7f8 # Parent bb91c602d4aded1bf741ee365abb84c59bfc9d51 tests: convert some 'hghave execbit' to #if This enables some new tests for running on windows. diff --git a/tests/test-convert-bzr.t b/tests/test-convert-bzr.t --- a/tests/test-convert-bzr.t +++ b/tests/test-convert-bzr.t @@ -1,5 +1,3 @@ - $ "$TESTDIR/hghave" symlink execbit || exit 80 - $ . "$TESTDIR/bzr-definitions" create and rename on the same file in the same step @@ -157,6 +155,8 @@ merge $ cd .. +#if symlink execbit + symlinks and executable files $ mkdir test-symlinks @@ -199,14 +199,17 @@ symlinks and executable files 755 * newprog 644 program 644 @ syma - $ cd source-hg test the symlinks can be recreated + $ cd source-hg $ hg up 5 files updated, 0 files merged, 0 files removed, 0 files unresolved $ hg cat syma; echo a + $ cd ../.. + +#endif Multiple branches diff --git a/tests/test-convert-hg-source.t b/tests/test-convert-hg-source.t --- a/tests/test-convert-hg-source.t +++ b/tests/test-convert-hg-source.t @@ -1,5 +1,3 @@ - $ "$TESTDIR/hghave" execbit || exit 80 - $ cat >> $HGRCPATH < [extensions] > convert= @@ -33,7 +31,11 @@ (branch merge, don't forget to commit) $ hg ci -m 'merge remote copy' -d '4 0' created new head +#if execbit $ chmod +x baz +#else + $ echo some other change to make sure we get a rev 5 > baz +#endif $ hg ci -m 'mark baz executable' -d '5 0' $ cd .. $ hg convert --datesort orig new 2>&1 | grep -v 'subversion python bindings could not be loaded' @@ -54,9 +56,16 @@ searching for changes no changes found [1] +#if execbit $ hg bookmarks premerge1 3:973ef48a98a4 premerge2 5:13d9b87cf8f8 +#else +Different hash because no x bit + $ hg bookmarks + premerge1 3:973ef48a98a4 + premerge2 5:df0779bcf33c +#endif $ cd .. check shamap LF and CRLF handling diff --git a/tests/test-convert-svn-sink.t b/tests/test-convert-svn-sink.t --- a/tests/test-convert-svn-sink.t +++ b/tests/test-convert-svn-sink.t @@ -1,4 +1,4 @@ - $ "$TESTDIR/hghave" svn13 no-outer-repo symlink execbit || exit 80 + $ "$TESTDIR/hghave" svn13 no-outer-repo symlink || exit 80 $ fixpath() > { @@ -202,12 +202,21 @@ Remove d1 newlink -Exectutable +Executable +#if execbit $ chmod +x a/c +#else + $ echo fake >> a/c +#endif $ hg --cwd a ci -d '5 0' -m 'make a file executable' +#if execbit $ hg --cwd a tip -q 5:31093672760b +#else + $ hg --cwd a tip -q + 5:034971d37224 +#endif $ hg convert -d svn a assuming destination a-hg @@ -227,16 +236,22 @@ Exectutable author: test msg: make a file executable M /c +#if execbit $ test -x a-hg-wc/c +#endif + $ rm -rf a a-hg a-hg-wc Executable in new directory - $ rm -rf a a-hg a-hg-wc $ hg init a $ mkdir a/d1 $ echo a > a/d1/a +#if execbit $ chmod +x a/d1/a +#else + $ echo fake >> a/d1/a +#endif $ hg --cwd a ci -d '0 0' -A -m 'add executable file in new directory' adding d1/a @@ -257,7 +272,9 @@ Executable in new directory msg: add executable file in new directory A /d1 A /d1/a +#if execbit $ test -x a-hg-wc/d1/a +#endif Copy to new directory diff --git a/tests/test-diff-color.t b/tests/test-diff-color.t --- a/tests/test-diff-color.t +++ b/tests/test-diff-color.t @@ -1,5 +1,3 @@ - $ "$TESTDIR/hghave" execbit || exit 80 - Setup $ echo "[color]" >> $HGRCPATH @@ -74,6 +72,8 @@ diffstat $ echo "[diff]" >> $HGRCPATH $ echo "git=True" >> $HGRCPATH +#if execbit + record $ chmod +x a @@ -124,3 +124,5 @@ qrecord a c \x1b[0;33mrecord this change to 'a'? [Ynesfdaq?]\x1b[0m (esc) + +#endif diff --git a/tests/test-extdiff.t b/tests/test-extdiff.t --- a/tests/test-extdiff.t +++ b/tests/test-extdiff.t @@ -1,5 +1,3 @@ - $ "$TESTDIR/hghave" symlink execbit || exit 80 - $ echo "[extensions]" >> $HGRCPATH $ echo "extdiff=" >> $HGRCPATH @@ -94,6 +92,8 @@ Check diff are made from the first paren diffing */extdiff.*/a.2a13a4d2da36/a a.46c0e4daeb72/a (glob) diff-like tools yield a non-zero exit code +#if execbit + Test extdiff of multiple files in tmp dir: $ hg update -C 0 > /dev/null @@ -182,6 +182,10 @@ Test with revsets: $ cd .. +#endif + +#if symlink + Test symlinks handling (issue1909) $ hg init testsymlinks @@ -196,3 +200,5 @@ Test symlinks handling (issue1909) diffing testsymlinks.07f494440405 testsymlinks [1] $ cd .. + +#endif diff --git a/tests/test-git-export.t b/tests/test-git-export.t --- a/tests/test-git-export.t +++ b/tests/test-git-export.t @@ -1,5 +1,3 @@ - $ "$TESTDIR/hghave" execbit || exit 80 - $ hg init $ echo start > start $ hg ci -Amstart @@ -58,6 +56,8 @@ Delete: $ hg ci -Amsrc adding src +#if execbit + chmod 644: $ chmod +x src @@ -94,6 +94,17 @@ Nonexistent in tip+chmod: old mode 100644 new mode 100755 +#else + +Dummy changes when no exec bit, mocking the execbit commit structure + + $ echo change >> src + $ hg ci -munexec + $ hg mv src dst + $ hg ci -mrenamemod + +#endif + Binary diff: $ cp "$TESTDIR/binfile.bin" . diff --git a/tests/test-import-bypass.t b/tests/test-import-bypass.t --- a/tests/test-import-bypass.t +++ b/tests/test-import-bypass.t @@ -1,5 +1,3 @@ - $ "$TESTDIR/hghave" symlink execbit || exit 80 - $ echo "[extensions]" >> $HGRCPATH $ echo "purge=" >> $HGRCPATH $ echo "graphlog=" >> $HGRCPATH @@ -218,6 +216,8 @@ Test applying multiple patches with --ex $ cd .. +#if symlink execbit + Test complicated patch with --exact $ hg init repo-exact @@ -265,3 +265,4 @@ data. If not, diff both heads to debug i | o 0:a0e19e636a43 test 0 0 - default - t +#endif diff --git a/tests/test-mq.t b/tests/test-mq.t --- a/tests/test-mq.t +++ b/tests/test-mq.t @@ -1,5 +1,3 @@ - $ "$TESTDIR/hghave" execbit || exit 80 - $ checkundo() > { > if [ -f .hg/store/undo ]; then @@ -918,9 +916,12 @@ bad node in status $ hg qnew -m'new file' new $ echo foo > new +#if execbit $ chmod +x new +#endif $ hg add new $ hg qrefresh +#if execbit $ cat .hg/patches/new new file @@ -930,6 +931,17 @@ bad node in status +++ b/new @@ -0,0 +1,1 @@ +foo +#else + $ cat .hg/patches/new + new file + + diff --git a/new b/new + new file mode 100644 + --- /dev/null + +++ b/new + @@ -0,0 +1,1 @@ + +foo +#endif $ hg qnew -m'copy file' copy $ hg cp new copy diff --git a/tests/test-record.t b/tests/test-record.t --- a/tests/test-record.t +++ b/tests/test-record.t @@ -772,6 +772,8 @@ f +a +#if execbit + Preserve chmod +x $ chmod +x f1 @@ -885,8 +887,120 @@ Preserve chmod -x +c +#else + +Slightly bogus tests to get almost same repo structure as when x bit is used +- but with different hashes. + +Mock "Preserve chmod +x" + + $ echo a >> f1 + $ hg record -d '20 0' -mz < y + > y + > y + > EOF + diff --git a/subdir/f1 b/subdir/f1 + 1 hunks, 1 lines changed + examine changes to 'subdir/f1'? [Ynesfdaq?] + @@ -1,2 +1,3 @@ + a + a + +a + record this change to 'subdir/f1'? [Ynesfdaq?] + + $ hg tip --config diff.git=True -p + changeset: 22:0d463bd428f5 + tag: tip + user: test + date: Thu Jan 01 00:00:20 1970 +0000 + summary: z + + diff --git a/subdir/f1 b/subdir/f1 + --- a/subdir/f1 + +++ b/subdir/f1 + @@ -1,2 +1,3 @@ + a + a + +a + + +Mock "Preserve execute permission on original" + + $ echo b >> f1 + $ hg record -d '21 0' -maa < y + > y + > y + > EOF + diff --git a/subdir/f1 b/subdir/f1 + 1 hunks, 1 lines changed + examine changes to 'subdir/f1'? [Ynesfdaq?] + @@ -1,3 +1,4 @@ + a + a + a + +b + record this change to 'subdir/f1'? [Ynesfdaq?] + + $ hg tip --config diff.git=True -p + changeset: 23:0eab41a3e524 + tag: tip + user: test + date: Thu Jan 01 00:00:21 1970 +0000 + summary: aa + + diff --git a/subdir/f1 b/subdir/f1 + --- a/subdir/f1 + +++ b/subdir/f1 + @@ -1,3 +1,4 @@ + a + a + a + +b + + +Mock "Preserve chmod -x" + + $ chmod -x f1 + $ echo c >> f1 + $ hg record -d '22 0' -mab < y + > y + > y + > EOF + diff --git a/subdir/f1 b/subdir/f1 + 1 hunks, 1 lines changed + examine changes to 'subdir/f1'? [Ynesfdaq?] + @@ -2,3 +2,4 @@ + a + a + b + +c + record this change to 'subdir/f1'? [Ynesfdaq?] + + $ hg tip --config diff.git=True -p + changeset: 24:f4f718f27b7c + tag: tip + user: test + date: Thu Jan 01 00:00:22 1970 +0000 + summary: ab + + diff --git a/subdir/f1 b/subdir/f1 + --- a/subdir/f1 + +++ b/subdir/f1 + @@ -2,3 +2,4 @@ + a + a + b + +c + + +#endif + $ cd .. + Abort early when a merge is in progress $ hg up 4 @@ -1096,13 +1210,13 @@ Ignore win32text deprecation warning for record this change to 'subdir/f1'? [Ynesfdaq?] $ hg tip -p - changeset: 28:287ad1f41a72 + changeset: 28:* (glob) tag: tip user: test date: Thu Jan 01 00:00:24 1970 +0000 summary: w1 - diff -r 65ce23a81197 -r 287ad1f41a72 subdir/f1 + diff -r ???????????? -r ???????????? subdir/f1 (glob) --- a/subdir/f1 Thu Jan 01 00:00:23 1970 +0000 +++ b/subdir/f1 Thu Jan 01 00:00:24 1970 +0000 @@ -3,3 +3,4 @@