--- a/mercurial/localrepo.py Wed Apr 21 01:18:31 2010 +0200
+++ b/mercurial/localrepo.py Wed Apr 21 01:34:12 2010 +0200
@@ -798,10 +798,10 @@
wlock = self.wlock()
try:
- p1, p2 = self.dirstate.parents()
wctx = self[None]
+ merge = len(wctx.parents()) > 1
- if (not force and p2 != nullid and match and
+ if (not force and merge and match and
(match.files() or match.anypats())):
raise util.Abort(_('cannot partially commit a merge '
'(do not specify files or patterns)'))
@@ -841,9 +841,9 @@
elif f not in self.dirstate:
fail(f, _("file not tracked!"))
- if (not force and not extra.get("close") and p2 == nullid
+ if (not force and not extra.get("close") and not merge
and not (changes[0] or changes[1] or changes[2])
- and self[None].branch() == self['.'].branch()):
+ and wctx.branch() == wctx.p1().branch()):
return None
ms = mergemod.mergestate(self)
@@ -873,8 +873,9 @@
msgfile.write(cctx._text)
msgfile.close()
+ p1, p2 = self.dirstate.parents()
+ hookp1, hookp2 = hex(p1), (p2 != nullid and hex(p2) or '')
try:
- hookp1, hookp2 = hex(p1), (p2 != nullid and hex(p2) or '')
self.hook("precommit", throw=True, parent1=hookp1, parent2=hookp2)
ret = self.commitctx(cctx, True)
except: