Change repo.comit to return None on error or the new revision number on
authormason@suse.com
Sun, 14 Aug 2005 20:09:01 -0800
changeset 901 120cba94d5aa
parent 900 ba8cf1f2210c
child 902 c749ca37aed1
Change repo.comit to return None on error or the new revision number on success This allows the caller to correctly record the new revision number
mercurial/hg.py
--- a/mercurial/hg.py	Sun Aug 14 20:08:35 2005 -0800
+++ b/mercurial/hg.py	Sun Aug 14 20:09:01 2005 -0800
@@ -875,10 +875,10 @@
 
         if not commit and not remove and not force:
             self.ui.status("nothing changed\n")
-            return
+            return None
 
         if not self.hook("precommit"):
-            return 1
+            return None
 
         p1, p2 = self.dirstate.parents()
         c1 = self.changelog.read(p1)
@@ -932,12 +932,11 @@
             edittext += "".join(["HG: removed %s\n" % f for f in remove])
             edittext = self.ui.edit(edittext)
             if not edittext.rstrip():
-                return 1
+                return None
             text = edittext
 
         user = user or self.ui.username()
         n = self.changelog.add(mn, new, text, tr, p1, p2, user, date)
-
         tr.close()
 
         self.dirstate.setparents(n)
@@ -945,7 +944,8 @@
         self.dirstate.forget(remove)
 
         if not self.hook("commit", node=hex(n)):
-            return 1
+            return None
+        return n
 
     def walk(self, node = None, files = [], match = util.always):
         if node: