##// END OF EJS Templates
* clean up error handling when user requests to use a non file object...
shaleh@speakeasy.net -
r611:48c3eb2b default
parent child Browse files
Show More
@@ -753,8 +753,10 b' class localrepository:'
753 def add(self, list):
753 def add(self, list):
754 for f in list:
754 for f in list:
755 p = self.wjoin(f)
755 p = self.wjoin(f)
756 if not os.path.isfile(p):
756 if not os.path.exists(p):
757 self.ui.warn("%s does not exist!\n" % f)
757 self.ui.warn("%s does not exist!\n" % f)
758 elif not os.path.isfile(p):
759 self.ui.warn("%s not added: mercurial only supports files currently\n" % f)
758 elif self.dirstate.state(f) == 'n':
760 elif self.dirstate.state(f) == 'n':
759 self.ui.warn("%s already tracked!\n" % f)
761 self.ui.warn("%s already tracked!\n" % f)
760 else:
762 else:
@@ -770,7 +772,7 b' class localrepository:'
770 def remove(self, list):
772 def remove(self, list):
771 for f in list:
773 for f in list:
772 p = self.wjoin(f)
774 p = self.wjoin(f)
773 if os.path.isfile(p):
775 if os.path.exists(p):
774 self.ui.warn("%s still exists!\n" % f)
776 self.ui.warn("%s still exists!\n" % f)
775 elif self.dirstate.state(f) == 'a':
777 elif self.dirstate.state(f) == 'a':
776 self.ui.warn("%s never committed!\n" % f)
778 self.ui.warn("%s never committed!\n" % f)
@@ -782,8 +784,10 b' class localrepository:'
782
784
783 def copy(self, source, dest):
785 def copy(self, source, dest):
784 p = self.wjoin(dest)
786 p = self.wjoin(dest)
785 if not os.path.isfile(dest):
787 if not os.path.exists(dest):
786 self.ui.warn("%s does not exist!\n" % dest)
788 self.ui.warn("%s does not exist!\n" % dest)
789 elif not os.path.isfile(dest):
790 self.ui.warn("copy failed: %s is not a file\n" % dest)
787 else:
791 else:
788 if self.dirstate.state(dest) == '?':
792 if self.dirstate.state(dest) == '?':
789 self.dirstate.update([dest], "a")
793 self.dirstate.update([dest], "a")
General Comments 0
You need to be logged in to leave comments. Login now