Mercurial > public > mercurial-scm > hg
comparison mercurial/localrepo.py @ 4018:dfe87137ed14
Allow adding symlinks that don't point to files
author | Alexis S. L. Carvalho <alexis@cecm.usp.br> |
---|---|
date | Fri, 05 Jan 2007 00:01:53 -0200 |
parents | 20da40cc1c73 |
children | bf329bda51a6 |
comparison
equal
deleted
inserted
replaced
4017:ea6174c96ae1 | 4018:dfe87137ed14 |
---|---|
931 def add(self, list, wlock=None): | 931 def add(self, list, wlock=None): |
932 if not wlock: | 932 if not wlock: |
933 wlock = self.wlock() | 933 wlock = self.wlock() |
934 for f in list: | 934 for f in list: |
935 p = self.wjoin(f) | 935 p = self.wjoin(f) |
936 if not os.path.exists(p): | 936 islink = os.path.islink(p) |
937 if not islink and not os.path.exists(p): | |
937 self.ui.warn(_("%s does not exist!\n") % f) | 938 self.ui.warn(_("%s does not exist!\n") % f) |
938 elif not os.path.isfile(p): | 939 elif not islink and not os.path.isfile(p): |
939 self.ui.warn(_("%s not added: only files supported currently\n") | 940 self.ui.warn(_("%s not added: only files and symlinks " |
940 % f) | 941 "supported currently\n") % f) |
941 elif self.dirstate.state(f) in 'an': | 942 elif self.dirstate.state(f) in 'an': |
942 self.ui.warn(_("%s already tracked!\n") % f) | 943 self.ui.warn(_("%s already tracked!\n") % f) |
943 else: | 944 else: |
944 self.dirstate.update([f], "a") | 945 self.dirstate.update([f], "a") |
945 | 946 |