Mercurial > hg
changeset 4912:312c845edef5
simplify dirstate fixups in repo.status()
author | Matt Mackall <mpm@selenic.com> |
---|---|
date | Sat, 21 Jul 2007 16:02:09 -0500 |
parents | 8b6efc8fc23c |
children | 46e39935ce33 |
files | mercurial/localrepo.py |
diffstat | 1 files changed, 16 insertions(+), 11 deletions(-) [+] |
line wrap: on
line diff
--- a/mercurial/localrepo.py Sat Jul 21 16:02:09 2007 -0500 +++ b/mercurial/localrepo.py Sat Jul 21 16:02:09 2007 -0500 @@ -875,8 +875,6 @@ # all the revisions in parent->child order. mf1 = mfmatches(node1) - mywlock = False - # are we comparing the working directory? if not node2: (lookup, modified, added, removed, deleted, unknown, @@ -886,22 +884,31 @@ # are we comparing working dir against its parent? if compareworking: if lookup: + fixup = [] # do a full compare of any files that might have changed ctx = self.changectx() for f in lookup: if f not in ctx or ctx[f].cmp(self.wread(f)): modified.append(f) else: + fixup.append(f) if list_clean: clean.append(f) - if not wlock and not mywlock: - mywlock = True - try: - wlock = self.wlock(wait=0) - except lock.LockException: - pass - if wlock: + + # update dirstate for files that are actually clean + if fixup: + cleanup = False + if not wlock: + try: + wlock = self.wlock(wait=0) + cleanup = True + except lock.LockException: + pass + if wlock: + for f in fixup: self.dirstate.normal(f) + if cleanup: + wlock.release() else: # we are comparing working dir against non-parent # generate a pseudo-manifest for the working dir @@ -916,8 +923,6 @@ if f in mf2: del mf2[f] - if mywlock and wlock: - wlock.release() else: # we are comparing two revisions mf2 = mfmatches(node2)