Mercurial > hg
view tests/test-ssh @ 11769:ca6cebd8734e stable
dirstate: ignore symlinks when fs cannot handle them (issue1888)
When the filesystem cannot handle the executable bit, we currently
ignore it completely when looking for modified files. Similarly, it is
impossible to set or clear the bit when the filesystem ignores it.
This patch makes Mercurial treat symbolic links the same way.
Symlinks are a little different since they manifest themselves as
small files containing a filename (the symlink target). On Windows,
these files show up as regular files, and on Linux and Mac they show
up as real symlinks.
Issue1888 presents a case where the symlink files are better ignored
from the Windows side. A Linux client creates symlinks in a working
copy which is shared over a network between Linux and Windows clients.
The Samba server is helpful and defererences the symlink when the
Windows client looks at it. This means that Mercurial on the Windows
side sees file content instead of a file name in the symlink, and
hence flags the link as modified. Ignoring the change would be much
more helpful, similarly to how Mercurial does not report any changes
when executable bits are ignored in a checkout on Windows.
An initial checkout of a symbolic link on a file system that cannot
handle symbolic links will still result in a regular file containing
the target file name as its content. Sharing such a checkout with a
Linux client will not turn the file into a symlink automatically, but
'hg revert' can fix that. After the revert, the Windows client will
see the correct file content (provided by the Samba server when it
follows the link on the Linux side) and otherwise ignore the change.
Running 'hg perfstatus' 10 times gives these results:
Before: After:
min: 0.544703 min: 0.546549
med: 0.547592 med: 0.548881
avg: 0.549146 avg: 0.548549
max: 0.564112 max: 0.551504
The median time is increased about 0.24%.
author | Martin Geisler <mg@aragost.com> |
---|---|
date | Mon, 09 Aug 2010 15:31:56 +0200 |
parents | 9f76df0edb7d |
children | 4c94b6d0fb1c |
line wrap: on
line source
#!/bin/sh cp "$TESTDIR"/printenv.py . # This test tries to exercise the ssh functionality with a dummy script cat <<EOF > dummyssh import sys import os os.chdir(os.path.dirname(sys.argv[0])) if sys.argv[1] != "user@dummy": sys.exit(-1) if not os.path.exists("dummyssh"): sys.exit(-1) os.environ["SSH_CLIENT"] = "127.0.0.1 1 2" log = open("dummylog", "ab") log.write("Got arguments") for i, arg in enumerate(sys.argv[1:]): log.write(" %d:%s" % (i+1, arg)) log.write("\n") log.close() r = os.system(sys.argv[2]) sys.exit(bool(r)) EOF cat <<EOF > badhook import sys sys.stdout.write("KABOOM\n") EOF echo "# creating 'remote'" hg init remote cd remote echo this > foo echo this > fooO hg ci -A -m "init" -d "1000000 0" foo fooO echo '[server]' > .hg/hgrc echo 'uncompressed = True' >> .hg/hgrc echo '[hooks]' >> .hg/hgrc echo 'changegroup = python ../printenv.py changegroup-in-remote 0 ../dummylog' >> .hg/hgrc cd .. echo "# repo not found error" hg clone -e "python ./dummyssh" ssh://user@dummy/nonexistent local echo "# clone remote via stream" hg clone -e "python ./dummyssh" --uncompressed ssh://user@dummy/remote local-stream 2>&1 | \ sed -e 's/[0-9][0-9.]*/XXX/g' -e 's/[KM]\(B\/sec\)/X\1/' cd local-stream hg verify cd .. echo "# clone remote via pull" hg clone -e "python ./dummyssh" ssh://user@dummy/remote local echo "# verify" cd local hg verify echo '[hooks]' >> .hg/hgrc echo 'changegroup = python ../printenv.py changegroup-in-local 0 ../dummylog' >> .hg/hgrc echo "# empty default pull" hg paths hg pull -e "python ../dummyssh" echo "# local change" echo bleah > foo hg ci -m "add" -d "1000000 0" echo "# updating rc" echo "default-push = ssh://user@dummy/remote" >> .hg/hgrc echo "[ui]" >> .hg/hgrc echo "ssh = python ../dummyssh" >> .hg/hgrc echo "# find outgoing" hg out ssh://user@dummy/remote echo "# find incoming on the remote side" hg incoming -R ../remote -e "python ../dummyssh" ssh://user@dummy/local echo "# push" hg push cd ../remote echo "# check remote tip" hg tip hg verify hg cat -r tip foo echo z > z hg ci -A -m z -d '1000001 0' z # a bad, evil hook that prints to stdout echo 'changegroup.stdout = python ../badhook' >> .hg/hgrc cd ../local echo r > r hg ci -A -m z -d '1000002 0' r echo "# push should succeed even though it has an unexpected response" hg push hg -R ../remote heads cd .. cat dummylog