tests/test-merge-symlinks
author Maxim Dounin <mdounin@mdounin.ru>
Wed, 07 May 2008 14:32:00 +0400
changeset 6651 7f0dd352fb4d
parent 5408 36794dbe66a3
child 7080 a6477aa893b8
permissions -rwxr-xr-x
addremove: correctly handle intermediate symlinks This fixes problems mentioned in issue660 comments (unrelated to original issue) where directory was renamed, and symlink was added instead. In such situation addremove wasn't able to correctly detect that old files no longer here, but tried to add symlink (and failed due collision with old files).
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
786c1206a029 Test *_ISLINK merge environment vars
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
     5
import os
5408
36794dbe66a3 Test workingctx exec/link bit for copies.
Patrick Mezard <pmezard@gmail.com>
parents: 5391
diff changeset
     6
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
     7
    print k, os.environ[k]
786c1206a029 Test *_ISLINK merge environment vars
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
     8
EOF
786c1206a029 Test *_ISLINK merge environment vars
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
     9
786c1206a029 Test *_ISLINK merge environment vars
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    10
# 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
    11
# 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
    12
#
36794dbe66a3 Test workingctx exec/link bit for copies.
Patrick Mezard <pmezard@gmail.com>
parents: 5391
diff changeset
    13
# hg init t
36794dbe66a3 Test workingctx exec/link bit for copies.
Patrick Mezard <pmezard@gmail.com>
parents: 5391
diff changeset
    14
# cd t
36794dbe66a3 Test workingctx exec/link bit for copies.
Patrick Mezard <pmezard@gmail.com>
parents: 5391
diff changeset
    15
# echo a > a
36794dbe66a3 Test workingctx exec/link bit for copies.
Patrick Mezard <pmezard@gmail.com>
parents: 5391
diff changeset
    16
# hg ci -qAm t0 -d '0 0'
36794dbe66a3 Test workingctx exec/link bit for copies.
Patrick Mezard <pmezard@gmail.com>
parents: 5391
diff changeset
    17
# echo l > l
36794dbe66a3 Test workingctx exec/link bit for copies.
Patrick Mezard <pmezard@gmail.com>
parents: 5391
diff changeset
    18
# hg ci -qAm t1 -d '1 0'
36794dbe66a3 Test workingctx exec/link bit for copies.
Patrick Mezard <pmezard@gmail.com>
parents: 5391
diff changeset
    19
# hg up -C 0
36794dbe66a3 Test workingctx exec/link bit for copies.
Patrick Mezard <pmezard@gmail.com>
parents: 5391
diff changeset
    20
# ln -s a l
36794dbe66a3 Test workingctx exec/link bit for copies.
Patrick Mezard <pmezard@gmail.com>
parents: 5391
diff changeset
    21
# hg ci -qAm t2 -d '2 0'
36794dbe66a3 Test workingctx exec/link bit for copies.
Patrick Mezard <pmezard@gmail.com>
parents: 5391
diff changeset
    22
# echo l2 > l2
36794dbe66a3 Test workingctx exec/link bit for copies.
Patrick Mezard <pmezard@gmail.com>
parents: 5391
diff changeset
    23
# hg ci -qAm t3 -d '3 0'
36794dbe66a3 Test workingctx exec/link bit for copies.
Patrick Mezard <pmezard@gmail.com>
parents: 5391
diff changeset
    24
5391
786c1206a029 Test *_ISLINK merge environment vars
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    25
hg init t
786c1206a029 Test *_ISLINK merge environment vars
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    26
cd t
5408
36794dbe66a3 Test workingctx exec/link bit for copies.
Patrick Mezard <pmezard@gmail.com>
parents: 5391
diff changeset
    27
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
    28
hg up -C 3
5391
786c1206a029 Test *_ISLINK merge environment vars
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    29
786c1206a029 Test *_ISLINK merge environment vars
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    30
# Merge them and display *_ISLINK vars
786c1206a029 Test *_ISLINK merge environment vars
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    31
echo % merge heads
5408
36794dbe66a3 Test workingctx exec/link bit for copies.
Patrick Mezard <pmezard@gmail.com>
parents: 5391
diff changeset
    32
HGMERGE="python ../echo.py" hg merge
36794dbe66a3 Test workingctx exec/link bit for copies.
Patrick Mezard <pmezard@gmail.com>
parents: 5391
diff changeset
    33
36794dbe66a3 Test workingctx exec/link bit for copies.
Patrick Mezard <pmezard@gmail.com>
parents: 5391
diff changeset
    34
# 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
    35
# especially on non-supporting systems.
36794dbe66a3 Test workingctx exec/link bit for copies.
Patrick Mezard <pmezard@gmail.com>
parents: 5391
diff changeset
    36
echo % merge working directory
36794dbe66a3 Test workingctx exec/link bit for copies.
Patrick Mezard <pmezard@gmail.com>
parents: 5391
diff changeset
    37
hg up -C 2
36794dbe66a3 Test workingctx exec/link bit for copies.
Patrick Mezard <pmezard@gmail.com>
parents: 5391
diff changeset
    38
hg copy l l2
36794dbe66a3 Test workingctx exec/link bit for copies.
Patrick Mezard <pmezard@gmail.com>
parents: 5391
diff changeset
    39
HGMERGE="python ../echo.py" hg up 3