Allow adding symlinks that don't point to files
authorAlexis S. L. Carvalho <alexis@cecm.usp.br>
Fri, 05 Jan 2007 00:01:53 -0200
changeset 4018 dfe87137ed14
parent 4017 ea6174c96ae1
child 4022 bf329bda51a6
Allow adding symlinks that don't point to files
mercurial/localrepo.py
--- a/mercurial/localrepo.py	Fri Jan 05 00:01:51 2007 -0200
+++ b/mercurial/localrepo.py	Fri Jan 05 00:01:53 2007 -0200
@@ -933,11 +933,12 @@
             wlock = self.wlock()
         for f in list:
             p = self.wjoin(f)
-            if not os.path.exists(p):
+            islink = os.path.islink(p)
+            if not islink and not os.path.exists(p):
                 self.ui.warn(_("%s does not exist!\n") % f)
-            elif not os.path.isfile(p):
-                self.ui.warn(_("%s not added: only files supported currently\n")
-                             % f)
+            elif not islink and not os.path.isfile(p):
+                self.ui.warn(_("%s not added: only files and symlinks "
+                               "supported currently\n") % f)
             elif self.dirstate.state(f) in 'an':
                 self.ui.warn(_("%s already tracked!\n") % f)
             else: