# HG changeset patch # User mason@suse.com # Date 1124078941 28800 # Node ID 120cba94d5aacf7cd036fccf10a59287285a54ba # Parent ba8cf1f2210c6413e8213a2521f455266b5dc18a 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 diff -r ba8cf1f2210c -r 120cba94d5aa 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: