tests/test-symlink-os-yes-fs-no.py
author Wagner Bruna <wbruna@yahoo.com>
Sun, 01 Aug 2010 01:54:31 -0300
branchstable
changeset 11722 bf1774d95bde
parent 6879 24fd94ed1cc0
child 11769 ca6cebd8734e
permissions -rw-r--r--
i18n-pt_BR: synchronized with db426935fa94
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
6879
24fd94ed1cc0 test symlinks on symlink-capable os but non-capable filesystem (issue1149)
Dov Feldstern <dfeldstern@fastimap.com>
parents:
diff changeset
     1
import os, sys
24fd94ed1cc0 test symlinks on symlink-capable os but non-capable filesystem (issue1149)
Dov Feldstern <dfeldstern@fastimap.com>
parents:
diff changeset
     2
from mercurial import hg, ui
24fd94ed1cc0 test symlinks on symlink-capable os but non-capable filesystem (issue1149)
Dov Feldstern <dfeldstern@fastimap.com>
parents:
diff changeset
     3
24fd94ed1cc0 test symlinks on symlink-capable os but non-capable filesystem (issue1149)
Dov Feldstern <dfeldstern@fastimap.com>
parents:
diff changeset
     4
TESTDIR = os.environ["TESTDIR"]
24fd94ed1cc0 test symlinks on symlink-capable os but non-capable filesystem (issue1149)
Dov Feldstern <dfeldstern@fastimap.com>
parents:
diff changeset
     5
24fd94ed1cc0 test symlinks on symlink-capable os but non-capable filesystem (issue1149)
Dov Feldstern <dfeldstern@fastimap.com>
parents:
diff changeset
     6
# only makes sense to test on os which supports symlinks
24fd94ed1cc0 test symlinks on symlink-capable os but non-capable filesystem (issue1149)
Dov Feldstern <dfeldstern@fastimap.com>
parents:
diff changeset
     7
if not hasattr(os, "symlink"):
24fd94ed1cc0 test symlinks on symlink-capable os but non-capable filesystem (issue1149)
Dov Feldstern <dfeldstern@fastimap.com>
parents:
diff changeset
     8
    sys.exit(80) # SKIPPED_STATUS defined in run-tests.py
24fd94ed1cc0 test symlinks on symlink-capable os but non-capable filesystem (issue1149)
Dov Feldstern <dfeldstern@fastimap.com>
parents:
diff changeset
     9
24fd94ed1cc0 test symlinks on symlink-capable os but non-capable filesystem (issue1149)
Dov Feldstern <dfeldstern@fastimap.com>
parents:
diff changeset
    10
# this is what symlink would do on a non-symlink file system
24fd94ed1cc0 test symlinks on symlink-capable os but non-capable filesystem (issue1149)
Dov Feldstern <dfeldstern@fastimap.com>
parents:
diff changeset
    11
def symlink_failure(src, dst):
24fd94ed1cc0 test symlinks on symlink-capable os but non-capable filesystem (issue1149)
Dov Feldstern <dfeldstern@fastimap.com>
parents:
diff changeset
    12
    raise OSError, (1, "Operation not permitted")
24fd94ed1cc0 test symlinks on symlink-capable os but non-capable filesystem (issue1149)
Dov Feldstern <dfeldstern@fastimap.com>
parents:
diff changeset
    13
os.symlink = symlink_failure
24fd94ed1cc0 test symlinks on symlink-capable os but non-capable filesystem (issue1149)
Dov Feldstern <dfeldstern@fastimap.com>
parents:
diff changeset
    14
24fd94ed1cc0 test symlinks on symlink-capable os but non-capable filesystem (issue1149)
Dov Feldstern <dfeldstern@fastimap.com>
parents:
diff changeset
    15
# now try cloning a repo which contains symlinks
24fd94ed1cc0 test symlinks on symlink-capable os but non-capable filesystem (issue1149)
Dov Feldstern <dfeldstern@fastimap.com>
parents:
diff changeset
    16
u = ui.ui()
24fd94ed1cc0 test symlinks on symlink-capable os but non-capable filesystem (issue1149)
Dov Feldstern <dfeldstern@fastimap.com>
parents:
diff changeset
    17
hg.clone(u, os.path.join(TESTDIR, 'test-no-symlinks.hg'), 'test1')