diff --git a/mercurial/localrepo.py b/mercurial/localrepo.py --- a/mercurial/localrepo.py +++ b/mercurial/localrepo.py @@ -782,6 +782,17 @@ class localrepository(repo.repository): supplied, it is called to get a commit message. """ + def fail(f, msg): + raise util.Abort('%s: %s' % (f, msg)) + + if not match: + match = match_.always(self.root, '') + + if not force: + vdirs = [] + match.dir = vdirs.append + match.bad = fail + wlock = self.wlock() try: p1, p2 = self.dirstate.parents() @@ -791,17 +802,6 @@ class localrepository(repo.repository): raise util.Abort(_('cannot partially commit a merge ' '(do not specify files or patterns)')) - def fail(f, msg): - raise util.Abort('%s: %s' % (f, msg)) - - if not match: - match = match_.always(self.root, '') - - if not force: - vdirs = [] - match.dir = vdirs.append - match.bad = fail - changes = self.status(match=match, clean=force) if force: changes[0].extend(changes[6]) # mq may commit unchanged files