##// END OF EJS Templates
localrepo.add: avoid some stats...
Alexis S. L. Carvalho -
r4575:d092e962 default
parent child Browse files
Show More
@@ -1013,16 +1013,17 b' class localrepository(repo.repository):'
1013 wlock = self.wlock()
1013 wlock = self.wlock()
1014 for f in list:
1014 for f in list:
1015 p = self.wjoin(f)
1015 p = self.wjoin(f)
1016 islink = os.path.islink(p)
1016 try:
1017 size = os.lstat(p).st_size
1017 st = os.lstat(p)
1018 if size > 10000000:
1018 except:
1019 self.ui.warn(_("%s does not exist!\n") % f)
1020 continue
1021 if st.st_size > 10000000:
1019 self.ui.warn(_("%s: files over 10MB may cause memory and"
1022 self.ui.warn(_("%s: files over 10MB may cause memory and"
1020 " performance problems\n"
1023 " performance problems\n"
1021 "(use 'hg revert %s' to unadd the file)\n")
1024 "(use 'hg revert %s' to unadd the file)\n")
1022 % (f, f))
1025 % (f, f))
1023 if not islink and not os.path.exists(p):
1026 if not (stat.S_ISREG(st.st_mode) or stat.S_ISLNK(st.st_mode)):
1024 self.ui.warn(_("%s does not exist!\n") % f)
1025 elif not islink and not os.path.isfile(p):
1026 self.ui.warn(_("%s not added: only files and symlinks "
1027 self.ui.warn(_("%s not added: only files and symlinks "
1027 "supported currently\n") % f)
1028 "supported currently\n") % f)
1028 elif self.dirstate.state(f) in 'an':
1029 elif self.dirstate.state(f) in 'an':
General Comments 0
You need to be logged in to leave comments. Login now