tests/test-merge-symlinks
author Mads Kiilerich <mads@kiilerich.com>
Sat, 25 Sep 2010 21:52:17 +0200
changeset 12406 66a07fb76ceb
parent 7080 a6477aa893b8
permissions -rwxr-xr-x
tests: avoid checking the exitcode of false Solaris false returns 255 instead of 1, so we remove one unneeded instance and replaces another with (exit 1) as suggested by Brodie Rao.
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
5391
786c1206a029 Test *_ISLINK merge environment vars
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
     1
#!/bin/sh
786c1206a029 Test *_ISLINK merge environment vars
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
     2
786c1206a029 Test *_ISLINK merge environment vars
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
     3
cat > echo.py <<EOF
786c1206a029 Test *_ISLINK merge environment vars
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
     4
#!/usr/bin/env python
7080
a6477aa893b8 tests: Windows compatibility fixes
Patrick Mezard <pmezard@gmail.com>
parents: 5408
diff changeset
     5
import os, sys
a6477aa893b8 tests: Windows compatibility fixes
Patrick Mezard <pmezard@gmail.com>
parents: 5408
diff changeset
     6
try:
a6477aa893b8 tests: Windows compatibility fixes
Patrick Mezard <pmezard@gmail.com>
parents: 5408
diff changeset
     7
    import msvcrt
a6477aa893b8 tests: Windows compatibility fixes
Patrick Mezard <pmezard@gmail.com>
parents: 5408
diff changeset
     8
    msvcrt.setmode(sys.stdout.fileno(), os.O_BINARY)
a6477aa893b8 tests: Windows compatibility fixes
Patrick Mezard <pmezard@gmail.com>
parents: 5408
diff changeset
     9
    msvcrt.setmode(sys.stderr.fileno(), os.O_BINARY)
a6477aa893b8 tests: Windows compatibility fixes
Patrick Mezard <pmezard@gmail.com>
parents: 5408
diff changeset
    10
except ImportError:
a6477aa893b8 tests: Windows compatibility fixes
Patrick Mezard <pmezard@gmail.com>
parents: 5408
diff changeset
    11
    pass
a6477aa893b8 tests: Windows compatibility fixes
Patrick Mezard <pmezard@gmail.com>
parents: 5408
diff changeset
    12
5408
36794dbe66a3 Test workingctx exec/link bit for copies.
Patrick Mezard <pmezard@gmail.com>
parents: 5391
diff changeset
    13
for k in ('HG_FILE', 'HG_MY_ISLINK', 'HG_OTHER_ISLINK', 'HG_BASE_ISLINK'):
5391
786c1206a029 Test *_ISLINK merge environment vars
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    14
    print k, os.environ[k]
786c1206a029 Test *_ISLINK merge environment vars
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    15
EOF
786c1206a029 Test *_ISLINK merge environment vars
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    16
786c1206a029 Test *_ISLINK merge environment vars
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    17
# Create 2 heads containing the same file, once as
5408
36794dbe66a3 Test workingctx exec/link bit for copies.
Patrick Mezard <pmezard@gmail.com>
parents: 5391
diff changeset
    18
# a file, once as a link. Bundle was generated with:
36794dbe66a3 Test workingctx exec/link bit for copies.
Patrick Mezard <pmezard@gmail.com>
parents: 5391
diff changeset
    19
#
36794dbe66a3 Test workingctx exec/link bit for copies.
Patrick Mezard <pmezard@gmail.com>
parents: 5391
diff changeset
    20
# hg init t
36794dbe66a3 Test workingctx exec/link bit for copies.
Patrick Mezard <pmezard@gmail.com>
parents: 5391
diff changeset
    21
# cd t
36794dbe66a3 Test workingctx exec/link bit for copies.
Patrick Mezard <pmezard@gmail.com>
parents: 5391
diff changeset
    22
# echo a > a
36794dbe66a3 Test workingctx exec/link bit for copies.
Patrick Mezard <pmezard@gmail.com>
parents: 5391
diff changeset
    23
# hg ci -qAm t0 -d '0 0'
36794dbe66a3 Test workingctx exec/link bit for copies.
Patrick Mezard <pmezard@gmail.com>
parents: 5391
diff changeset
    24
# echo l > l
36794dbe66a3 Test workingctx exec/link bit for copies.
Patrick Mezard <pmezard@gmail.com>
parents: 5391
diff changeset
    25
# hg ci -qAm t1 -d '1 0'
36794dbe66a3 Test workingctx exec/link bit for copies.
Patrick Mezard <pmezard@gmail.com>
parents: 5391
diff changeset
    26
# hg up -C 0
36794dbe66a3 Test workingctx exec/link bit for copies.
Patrick Mezard <pmezard@gmail.com>
parents: 5391
diff changeset
    27
# ln -s a l
36794dbe66a3 Test workingctx exec/link bit for copies.
Patrick Mezard <pmezard@gmail.com>
parents: 5391
diff changeset
    28
# hg ci -qAm t2 -d '2 0'
36794dbe66a3 Test workingctx exec/link bit for copies.
Patrick Mezard <pmezard@gmail.com>
parents: 5391
diff changeset
    29
# echo l2 > l2
36794dbe66a3 Test workingctx exec/link bit for copies.
Patrick Mezard <pmezard@gmail.com>
parents: 5391
diff changeset
    30
# hg ci -qAm t3 -d '3 0'
36794dbe66a3 Test workingctx exec/link bit for copies.
Patrick Mezard <pmezard@gmail.com>
parents: 5391
diff changeset
    31
5391
786c1206a029 Test *_ISLINK merge environment vars
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    32
hg init t
786c1206a029 Test *_ISLINK merge environment vars
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    33
cd t
5408
36794dbe66a3 Test workingctx exec/link bit for copies.
Patrick Mezard <pmezard@gmail.com>
parents: 5391
diff changeset
    34
hg -q pull "$TESTDIR/test-merge-symlinks.hg"
36794dbe66a3 Test workingctx exec/link bit for copies.
Patrick Mezard <pmezard@gmail.com>
parents: 5391
diff changeset
    35
hg up -C 3
5391
786c1206a029 Test *_ISLINK merge environment vars
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    36
786c1206a029 Test *_ISLINK merge environment vars
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    37
# Merge them and display *_ISLINK vars
786c1206a029 Test *_ISLINK merge environment vars
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    38
echo % merge heads
5408
36794dbe66a3 Test workingctx exec/link bit for copies.
Patrick Mezard <pmezard@gmail.com>
parents: 5391
diff changeset
    39
HGMERGE="python ../echo.py" hg merge
36794dbe66a3 Test workingctx exec/link bit for copies.
Patrick Mezard <pmezard@gmail.com>
parents: 5391
diff changeset
    40
36794dbe66a3 Test workingctx exec/link bit for copies.
Patrick Mezard <pmezard@gmail.com>
parents: 5391
diff changeset
    41
# Test working directory symlink bit calculation wrt copies,
36794dbe66a3 Test workingctx exec/link bit for copies.
Patrick Mezard <pmezard@gmail.com>
parents: 5391
diff changeset
    42
# especially on non-supporting systems.
36794dbe66a3 Test workingctx exec/link bit for copies.
Patrick Mezard <pmezard@gmail.com>
parents: 5391
diff changeset
    43
echo % merge working directory
36794dbe66a3 Test workingctx exec/link bit for copies.
Patrick Mezard <pmezard@gmail.com>
parents: 5391
diff changeset
    44
hg up -C 2
36794dbe66a3 Test workingctx exec/link bit for copies.
Patrick Mezard <pmezard@gmail.com>
parents: 5391
diff changeset
    45
hg copy l l2
36794dbe66a3 Test workingctx exec/link bit for copies.
Patrick Mezard <pmezard@gmail.com>
parents: 5391
diff changeset
    46
HGMERGE="python ../echo.py" hg up 3