Mercurial > public > mercurial-scm > hg
comparison 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 |
comparison
equal
deleted
inserted
replaced
21394:20a30cd41d21 | 21395:f251b92d9ed9 |
---|---|
1195 ' "%s"\n' % f) | 1195 ' "%s"\n' % f) |
1196 continue | 1196 continue |
1197 sane.append(f) | 1197 sane.append(f) |
1198 return sane | 1198 return sane |
1199 | 1199 |
1200 def _checklookup(self, files): | |
1201 # check for any possibly clean files | |
1202 if not files: | |
1203 return [], [] | |
1204 | |
1205 modified = [] | |
1206 fixup = [] | |
1207 pctx = self._parents[0] | |
1208 # do a full compare of any files that might have changed | |
1209 for f in sorted(files): | |
1210 if (f not in pctx or self.flags(f) != pctx.flags(f) | |
1211 or pctx[f].cmp(self[f])): | |
1212 modified.append(f) | |
1213 else: | |
1214 fixup.append(f) | |
1215 | |
1216 # update dirstate for files that are actually clean | |
1217 if fixup: | |
1218 try: | |
1219 # updating the dirstate is optional | |
1220 # so we don't wait on the lock | |
1221 normal = self._repo.dirstate.normal | |
1222 wlock = self._repo.wlock(False) | |
1223 try: | |
1224 for f in fixup: | |
1225 normal(f) | |
1226 finally: | |
1227 wlock.release() | |
1228 except error.LockError: | |
1229 pass | |
1230 return modified, fixup | |
1231 | |
1232 | |
1200 class committablefilectx(basefilectx): | 1233 class committablefilectx(basefilectx): |
1201 """A committablefilectx provides common functionality for a file context | 1234 """A committablefilectx provides common functionality for a file context |
1202 that wants the ability to commit, e.g. workingfilectx or memfilectx.""" | 1235 that wants the ability to commit, e.g. workingfilectx or memfilectx.""" |
1203 def __init__(self, repo, path, filelog=None, ctx=None): | 1236 def __init__(self, repo, path, filelog=None, ctx=None): |
1204 self._repo = repo | 1237 self._repo = repo |