mercurial/localrepo.py
changeset 4573 d092e962c4f8
parent 4556 30bc57094bfc
child 4577 e7d4ed543de5
equal deleted inserted replaced
4572:339b8aeee8c5 4573:d092e962c4f8
  1011     def add(self, list, wlock=None):
  1011     def add(self, list, wlock=None):
  1012         if not wlock:
  1012         if not wlock:
  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':
  1029                 self.ui.warn(_("%s already tracked!\n") % f)
  1030                 self.ui.warn(_("%s already tracked!\n") % f)
  1030             else:
  1031             else: