localrepo: use workingctx for validation in commit

This changes localrepo.commit to use the workingctx it creates form
the munged output of localrepo.status while running some precommit
validation.  Specifically, it uses functions that were already present
on the workingctx.  I believe this is a net readabilty improvement,
and that this makes these lines consistent with the refactoring in a
subsequent patch that pulls some of the validation logic into
workingctx so that it can be reused elsewhere.
This commit is contained in:
David Schleimer 2013-02-08 05:36:08 -08:00
parent 6086bc3471
commit 21ed11fec2

View File

@ -1233,11 +1233,11 @@ class localrepository(object):
cctx = context.workingctx(self, text, user, date, extra, changes)
if (not force and not extra.get("close") and not merge
and not (changes[0] or changes[1] or changes[2])
and not cctx.files()
and wctx.branch() == wctx.p1().branch()):
return None
if merge and changes[3]:
if merge and cctx.deleted():
raise util.Abort(_("cannot commit merge with missing files"))
ms = mergemod.mergestate(self)