Mercurial > hg
comparison mercurial/localrepo.py @ 18660:7e6946ed5756
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.
author | David Schleimer <dschleimer@fb.com> |
---|---|
date | Fri, 08 Feb 2013 05:36:08 -0800 |
parents | b946470efed9 |
children | 4fb92f14a97a |
comparison
equal
deleted
inserted
replaced
18659:b946470efed9 | 18660:7e6946ed5756 |
---|---|
1231 fail(f, _("file not tracked!")) | 1231 fail(f, _("file not tracked!")) |
1232 | 1232 |
1233 cctx = context.workingctx(self, text, user, date, extra, changes) | 1233 cctx = context.workingctx(self, text, user, date, extra, changes) |
1234 | 1234 |
1235 if (not force and not extra.get("close") and not merge | 1235 if (not force and not extra.get("close") and not merge |
1236 and not (changes[0] or changes[1] or changes[2]) | 1236 and not cctx.files() |
1237 and wctx.branch() == wctx.p1().branch()): | 1237 and wctx.branch() == wctx.p1().branch()): |
1238 return None | 1238 return None |
1239 | 1239 |
1240 if merge and changes[3]: | 1240 if merge and cctx.deleted(): |
1241 raise util.Abort(_("cannot commit merge with missing files")) | 1241 raise util.Abort(_("cannot commit merge with missing files")) |
1242 | 1242 |
1243 ms = mergemod.mergestate(self) | 1243 ms = mergemod.mergestate(self) |
1244 for f in changes[0]: | 1244 for f in changes[0]: |
1245 if f in ms and ms[f] == 'u': | 1245 if f in ms and ms[f] == 'u': |