diff mercurial/localrepo.py @ 5688:883d887c6408

commands: add exits(1) if a specified file cannot be added (issue 891)
author Patrick Mezard <pmezard@gmail.com>
date Mon, 24 Dec 2007 12:14:43 +0100
parents 9d6ad26fab10
children 14789f30ac11 75c2071385da
line wrap: on
line diff
--- a/mercurial/localrepo.py	Mon Dec 24 01:50:07 2007 +0100
+++ b/mercurial/localrepo.py	Mon Dec 24 12:14:43 2007 +0100
@@ -1010,12 +1010,14 @@
     def add(self, list):
         wlock = self.wlock()
         try:
+            rejected = []
             for f in list:
                 p = self.wjoin(f)
                 try:
                     st = os.lstat(p)
                 except:
                     self.ui.warn(_("%s does not exist!\n") % f)
+                    rejected.append(f)
                     continue
                 if st.st_size > 10000000:
                     self.ui.warn(_("%s: files over 10MB may cause memory and"
@@ -1025,12 +1027,14 @@
                 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)
+                    rejected.append(p)
                 elif self.dirstate[f] in 'amn':
                     self.ui.warn(_("%s already tracked!\n") % f)
                 elif self.dirstate[f] == 'r':
                     self.dirstate.normallookup(f)
                 else:
                     self.dirstate.add(f)
+            return rejected
         finally:
             del wlock