Mercurial > hg
changeset 4575:d092e962c4f8
localrepo.add: avoid some stats
There's still an extra lstat done by dirstate.update.
author | Alexis S. L. Carvalho <alexis@cecm.usp.br> |
---|---|
date | Wed, 13 Jun 2007 19:15:58 -0300 |
parents | 339b8aeee8c5 |
children | b841dc886ba1 |
files | mercurial/localrepo.py |
diffstat | 1 files changed, 7 insertions(+), 6 deletions(-) [+] |
line wrap: on
line diff
--- a/mercurial/localrepo.py Wed Jun 13 19:15:58 2007 -0300 +++ b/mercurial/localrepo.py Wed Jun 13 19:15:58 2007 -0300 @@ -1013,16 +1013,17 @@ wlock = self.wlock() for f in list: p = self.wjoin(f) - islink = os.path.islink(p) - size = os.lstat(p).st_size - if size > 10000000: + try: + st = os.lstat(p) + except: + self.ui.warn(_("%s does not exist!\n") % f) + continue + if st.st_size > 10000000: self.ui.warn(_("%s: files over 10MB may cause memory and" " performance problems\n" "(use 'hg revert %s' to unadd the file)\n") % (f, f)) - if not islink and not os.path.exists(p): - self.ui.warn(_("%s does not exist!\n") % f) - elif not islink and not os.path.isfile(p): + if not (stat.S_ISREG(st.st_mode) or stat.S_ISLNK(st.st_mode)): self.ui.warn(_("%s not added: only files and symlinks " "supported currently\n") % f) elif self.dirstate.state(f) in 'an':