Mercurial > public > mercurial-scm > hg-stable
diff mercurial/context.py @ 21395:f251b92d9ed9
localrepo: factor out parentworking logic for comparing files
We will temporarily call a private method of the context class while we are in
the process of removing the need of having localrepo.status.
author | Sean Farley <sean.michael.farley@gmail.com> |
---|---|
date | Tue, 11 Mar 2014 18:10:00 -0500 |
parents | a45af4da0421 |
children | 3925d9460d27 |
line wrap: on
line diff
--- a/mercurial/context.py Tue Mar 11 17:44:09 2014 -0500 +++ b/mercurial/context.py Tue Mar 11 18:10:00 2014 -0500 @@ -1197,6 +1197,39 @@ sane.append(f) return sane + def _checklookup(self, files): + # check for any possibly clean files + if not files: + return [], [] + + modified = [] + fixup = [] + pctx = self._parents[0] + # do a full compare of any files that might have changed + for f in sorted(files): + if (f not in pctx or self.flags(f) != pctx.flags(f) + or pctx[f].cmp(self[f])): + modified.append(f) + else: + fixup.append(f) + + # update dirstate for files that are actually clean + if fixup: + try: + # updating the dirstate is optional + # so we don't wait on the lock + normal = self._repo.dirstate.normal + wlock = self._repo.wlock(False) + try: + for f in fixup: + normal(f) + finally: + wlock.release() + except error.LockError: + pass + return modified, fixup + + class committablefilectx(basefilectx): """A committablefilectx provides common functionality for a file context that wants the ability to commit, e.g. workingfilectx or memfilectx."""