# HG changeset patch # User Matt Mackall # Date 1167444271 21600 # Node ID d7b9ec5895467d8493e8c038b2bc5f38eed02062 # Parent dda03b2d9ef1e37f54d3868394b1f452d02551c0 symlinks: use is_link wherever is_exec is used diff --git a/mercurial/context.py b/mercurial/context.py --- a/mercurial/context.py +++ b/mercurial/context.py @@ -379,13 +379,14 @@ class workingctx(changectx): man = self._parents[0].manifest().copy() is_exec = util.execfunc(self._repo.root, man.execf) + is_link = util.linkfunc(self._repo.root, man.linkf) copied = self._repo.dirstate.copies() modified, added, removed, deleted, unknown = self._status[:5] for i, l in (("a", added), ("m", modified), ("u", unknown)): for f in l: man[f] = man.get(copied.get(f, f), nullid) + i try: - man.set(f, is_exec(f)) + man.set(f, is_exec(f), is_link(f)) except OSError: pass diff --git a/mercurial/localrepo.py b/mercurial/localrepo.py --- a/mercurial/localrepo.py +++ b/mercurial/localrepo.py @@ -713,11 +713,12 @@ class localrepository(repo.repository): linkrev = self.changelog.count() commit.sort() is_exec = util.execfunc(self.root, m1.execf) + is_link = util.linkfunc(self.root, m1.linkf) for f in commit: self.ui.note(f + "\n") try: new[f] = self.filecommit(f, m1, m2, linkrev, tr, changed) - m1.set(f, is_exec(f)) + m1.set(f, is_exec(f), is_link(f)) except IOError: if use_dirstate: self.ui.warn(_("trouble committing %s!\n") % f) @@ -879,9 +880,10 @@ class localrepository(repo.repository): # XXX: create it in dirstate.py ? mf2 = mfmatches(self.dirstate.parents()[0]) is_exec = util.execfunc(self.root, mf2.execf) + is_link = util.linkfunc(self.root, mf2.linkf) for f in lookup + modified + added: mf2[f] = "" - mf2.set(f, is_exec(f)) + mf2.set(f, is_exec(f), is_link(f)) for f in removed: if f in mf2: del mf2[f] diff --git a/mercurial/util.py b/mercurial/util.py --- a/mercurial/util.py +++ b/mercurial/util.py @@ -713,7 +713,7 @@ def execfunc(path, fallback): return lambda x: is_exec(os.path.join(path, x)) return fallback -def checksymlink(path): +def checklink(path): """check whether the given path is on a symlink-capable filesystem""" # mktemp is not racy because symlink creation will fail if the # file already exists diff --git a/tests/test-commit.out b/tests/test-commit.out --- a/tests/test-commit.out +++ b/tests/test-commit.out @@ -21,8 +21,7 @@ abort: no match under directory .../test dir/file does-not-exist: No such file or directory abort: file .../test/does-not-exist not found! -baz: unsupported file type (type is symbolic link) -abort: can't commit .../test/baz: unsupported file type! +abort: file .../test/baz not tracked! abort: file .../test/quux not tracked! dir/file % partial subdir commit test diff --git a/tests/test-symlinks.out b/tests/test-symlinks.out --- a/tests/test-symlinks.out +++ b/tests/test-symlinks.out @@ -1,11 +1,12 @@ +adding bar adding foo adding bomb adding a.c adding dir/a.o adding dir/b.o +M dir/b.o ! a.c ! dir/a.o -! dir/b.o ? .hgignore a.c: unsupported file type (type is fifo) ! a.c