[patch 04/10] Change repo.comit to return None on error or the new
revision number on
Chris Mason
mason at suse.com
Tue Aug 9 12:42:57 CDT 2005
# HG changeset patch
# User mason at suse.com
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
Index: mine/mercurial/hg.py
===================================================================
--- mine.orig/mercurial/hg.py 2005-07-25 16:19:19.000000000 -0400
+++ mine/mercurial/hg.py 2005-07-25 16:20:18.000000000 -0400
@@ -774,10 +774,10 @@ class localrepository:
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)
@@ -831,12 +831,11 @@ class localrepository:
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)
@@ -844,7 +843,8 @@ class localrepository:
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:
--
More information about the Mercurial
mailing list