Show More
@@ -625,6 +625,8 b' class dirstate(object):' | |||||
625 | dadd = deleted.append |
|
625 | dadd = deleted.append | |
626 | cadd = clean.append |
|
626 | cadd = clean.append | |
627 |
|
627 | |||
|
628 | lnkkind = stat.S_IFLNK | |||
|
629 | ||||
628 | for fn, st in self.walk(match, subrepos, listunknown, |
|
630 | for fn, st in self.walk(match, subrepos, listunknown, | |
629 | listignored).iteritems(): |
|
631 | listignored).iteritems(): | |
630 | if fn not in dmap: |
|
632 | if fn not in dmap: | |
@@ -640,13 +642,19 b' class dirstate(object):' | |||||
640 | if not st and state in "nma": |
|
642 | if not st and state in "nma": | |
641 | dadd(fn) |
|
643 | dadd(fn) | |
642 | elif state == 'n': |
|
644 | elif state == 'n': | |
|
645 | # The "mode & lnkkind != lnkkind or self._checklink" | |||
|
646 | # lines are an expansion of "islink => checklink" | |||
|
647 | # where islink means "is this a link?" and checklink | |||
|
648 | # means "can we check links?". | |||
643 | if (size >= 0 and |
|
649 | if (size >= 0 and | |
644 | (size != st.st_size |
|
650 | (size != st.st_size | |
645 | or ((mode ^ st.st_mode) & 0100 and self._checkexec)) |
|
651 | or ((mode ^ st.st_mode) & 0100 and self._checkexec)) | |
|
652 | and (mode & lnkkind != lnkkind or self._checklink) | |||
646 | or size == -2 # other parent |
|
653 | or size == -2 # other parent | |
647 | or fn in self._copymap): |
|
654 | or fn in self._copymap): | |
648 | madd(fn) |
|
655 | madd(fn) | |
649 |
elif time != int(st.st_mtime) |
|
656 | elif (time != int(st.st_mtime) | |
|
657 | and (mode & lnkkind != lnkkind or self._checklink)): | |||
650 | ladd(fn) |
|
658 | ladd(fn) | |
651 | elif listclean: |
|
659 | elif listclean: | |
652 | cadd(fn) |
|
660 | cadd(fn) |
@@ -1,5 +1,5 b'' | |||||
1 | import os, sys |
|
1 | import os, sys, time | |
2 | from mercurial import hg, ui |
|
2 | from mercurial import hg, ui, commands | |
3 |
|
3 | |||
4 | TESTDIR = os.environ["TESTDIR"] |
|
4 | TESTDIR = os.environ["TESTDIR"] | |
5 |
|
5 | |||
@@ -7,11 +7,35 b' TESTDIR = os.environ["TESTDIR"]' | |||||
7 | if not hasattr(os, "symlink"): |
|
7 | if not hasattr(os, "symlink"): | |
8 | sys.exit(80) # SKIPPED_STATUS defined in run-tests.py |
|
8 | sys.exit(80) # SKIPPED_STATUS defined in run-tests.py | |
9 |
|
9 | |||
10 | # this is what symlink would do on a non-symlink file system |
|
10 | # clone with symlink support | |
|
11 | u = ui.ui() | |||
|
12 | hg.clone(u, os.path.join(TESTDIR, 'test-no-symlinks.hg'), 'test0') | |||
|
13 | ||||
|
14 | repo = hg.repository(u, 'test0') | |||
|
15 | ||||
|
16 | # wait a bit, or the status call wont update the dirstate | |||
|
17 | time.sleep(1) | |||
|
18 | commands.status(u, repo) | |||
|
19 | ||||
|
20 | # now disable symlink support -- this is what os.symlink would do on a | |||
|
21 | # non-symlink file system | |||
11 | def symlink_failure(src, dst): |
|
22 | def symlink_failure(src, dst): | |
12 | raise OSError, (1, "Operation not permitted") |
|
23 | raise OSError, (1, "Operation not permitted") | |
13 | os.symlink = symlink_failure |
|
24 | os.symlink = symlink_failure | |
14 |
|
25 | |||
15 | # now try cloning a repo which contains symlinks |
|
26 | # dereference links as if a Samba server has exported this to a | |
|
27 | # Windows client | |||
|
28 | for f in 'test0/a.lnk', 'test0/d/b.lnk': | |||
|
29 | os.unlink(f) | |||
|
30 | fp = open(f, 'wb') | |||
|
31 | fp.write(open(f[:-4]).read()) | |||
|
32 | fp.close() | |||
|
33 | ||||
|
34 | # reload repository | |||
|
35 | u = ui.ui() | |||
|
36 | repo = hg.repository(u, 'test0') | |||
|
37 | commands.status(u, repo) | |||
|
38 | ||||
|
39 | # try cloning a repo which contains symlinks | |||
16 | u = ui.ui() |
|
40 | u = ui.ui() | |
17 | hg.clone(u, os.path.join(TESTDIR, 'test-no-symlinks.hg'), 'test1') |
|
41 | hg.clone(u, os.path.join(TESTDIR, 'test-no-symlinks.hg'), 'test1') |
@@ -5,3 +5,10 b' adding file changes' | |||||
5 | added 1 changesets with 4 changes to 4 files |
|
5 | added 1 changesets with 4 changes to 4 files | |
6 | updating to branch default |
|
6 | updating to branch default | |
7 | 4 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
7 | 4 files updated, 0 files merged, 0 files removed, 0 files unresolved | |
|
8 | requesting all changes | |||
|
9 | adding changesets | |||
|
10 | adding manifests | |||
|
11 | adding file changes | |||
|
12 | added 1 changesets with 4 changes to 4 files | |||
|
13 | updating to branch default | |||
|
14 | 4 files updated, 0 files merged, 0 files removed, 0 files unresolved |
General Comments 0
You need to be logged in to leave comments.
Login now