changeset 5716:be367cbafe70

cmdutil: make bail_if_changed bail on uncommitted merge
author Matt Mackall <mpm@selenic.com>
date Thu, 27 Dec 2007 23:55:39 -0600
parents d280774a7498
children 18fdfafdb3e9
files mercurial/cmdutil.py mercurial/commands.py
diffstat 2 files changed, 4 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/cmdutil.py	Thu Dec 27 23:55:39 2007 -0600
+++ b/mercurial/cmdutil.py	Thu Dec 27 23:55:39 2007 -0600
@@ -64,6 +64,8 @@
     raise UnknownCommand(cmd)
 
 def bail_if_changed(repo):
+    if repo.dirstate.parents()[1] != nullid:
+        raise util.Abort(_('outstanding uncommitted merge'))
     modified, added, removed, deleted = repo.status()[:4]
     if modified or added or removed or deleted:
         raise util.Abort(_("outstanding uncommitted changes"))
--- a/mercurial/commands.py	Thu Dec 27 23:55:39 2007 -0600
+++ b/mercurial/commands.py	Thu Dec 27 23:55:39 2007 -0600
@@ -196,11 +196,9 @@
         raise util.Abort(_("please specify a revision to backout"))
 
     cmdutil.bail_if_changed(repo)
+    node = repo.lookup(rev)
+
     op1, op2 = repo.dirstate.parents()
-    if op2 != nullid:
-        raise util.Abort(_('outstanding uncommitted merge'))
-    node = repo.lookup(rev)
-
     a = repo.changelog.ancestor(op1, node)
     if a != node:
         raise util.Abort(_('cannot back out change on a different branch'))