symlinks: use is_link wherever is_exec is used
authorMatt Mackall <mpm@selenic.com>
Fri, 29 Dec 2006 20:04:31 -0600
changeset 4002 d7b9ec589546
parent 4001 dda03b2d9ef1
child 4003 616806f74f0f
symlinks: use is_link wherever is_exec is used
mercurial/context.py
mercurial/localrepo.py
mercurial/util.py
tests/test-commit.out
tests/test-symlinks.out
--- a/mercurial/context.py	Fri Dec 29 20:04:31 2006 -0600
+++ b/mercurial/context.py	Fri Dec 29 20:04:31 2006 -0600
@@ -379,13 +379,14 @@
 
         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
 
--- a/mercurial/localrepo.py	Fri Dec 29 20:04:31 2006 -0600
+++ b/mercurial/localrepo.py	Fri Dec 29 20:04:31 2006 -0600
@@ -713,11 +713,12 @@
         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 @@
                 # 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]
--- a/mercurial/util.py	Fri Dec 29 20:04:31 2006 -0600
+++ b/mercurial/util.py	Fri Dec 29 20:04:31 2006 -0600
@@ -713,7 +713,7 @@
         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
--- a/tests/test-commit.out	Fri Dec 29 20:04:31 2006 -0600
+++ b/tests/test-commit.out	Fri Dec 29 20:04:31 2006 -0600
@@ -21,8 +21,7 @@
 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
--- a/tests/test-symlinks.out	Fri Dec 29 20:04:31 2006 -0600
+++ b/tests/test-symlinks.out	Fri Dec 29 20:04:31 2006 -0600
@@ -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