mercurial/localrepo.py
changeset 4956 312c845edef5
parent 4954 fd96bc61a18b
child 4957 46e39935ce33
equal deleted inserted replaced
4955:8b6efc8fc23c 4956:312c845edef5
   873             # read the manifest from node1 before the manifest from node2,
   873             # read the manifest from node1 before the manifest from node2,
   874             # so that we'll hit the manifest cache if we're going through
   874             # so that we'll hit the manifest cache if we're going through
   875             # all the revisions in parent->child order.
   875             # all the revisions in parent->child order.
   876             mf1 = mfmatches(node1)
   876             mf1 = mfmatches(node1)
   877 
   877 
   878         mywlock = False
       
   879 
       
   880         # are we comparing the working directory?
   878         # are we comparing the working directory?
   881         if not node2:
   879         if not node2:
   882             (lookup, modified, added, removed, deleted, unknown,
   880             (lookup, modified, added, removed, deleted, unknown,
   883              ignored, clean) = self.dirstate.status(files, match,
   881              ignored, clean) = self.dirstate.status(files, match,
   884                                                     list_ignored, list_clean)
   882                                                     list_ignored, list_clean)
   885 
   883 
   886             # are we comparing working dir against its parent?
   884             # are we comparing working dir against its parent?
   887             if compareworking:
   885             if compareworking:
   888                 if lookup:
   886                 if lookup:
       
   887                     fixup = []
   889                     # do a full compare of any files that might have changed
   888                     # do a full compare of any files that might have changed
   890                     ctx = self.changectx()
   889                     ctx = self.changectx()
   891                     for f in lookup:
   890                     for f in lookup:
   892                         if f not in ctx or ctx[f].cmp(self.wread(f)):
   891                         if f not in ctx or ctx[f].cmp(self.wread(f)):
   893                             modified.append(f)
   892                             modified.append(f)
   894                         else:
   893                         else:
       
   894                             fixup.append(f)
   895                             if list_clean:
   895                             if list_clean:
   896                                 clean.append(f)
   896                                 clean.append(f)
   897                             if not wlock and not mywlock:
   897 
   898                                 mywlock = True
   898                     # update dirstate for files that are actually clean
   899                                 try:
   899                     if fixup:
   900                                     wlock = self.wlock(wait=0)
   900                         cleanup = False
   901                                 except lock.LockException:
   901                         if not wlock:
   902                                     pass
   902                             try:
   903                             if wlock:
   903                                 wlock = self.wlock(wait=0)
       
   904                                 cleanup = True
       
   905                             except lock.LockException:
       
   906                                 pass
       
   907                         if wlock:
       
   908                             for f in fixup:
   904                                 self.dirstate.normal(f)
   909                                 self.dirstate.normal(f)
       
   910                         if cleanup:
       
   911                                 wlock.release()
   905             else:
   912             else:
   906                 # we are comparing working dir against non-parent
   913                 # we are comparing working dir against non-parent
   907                 # generate a pseudo-manifest for the working dir
   914                 # generate a pseudo-manifest for the working dir
   908                 # XXX: create it in dirstate.py ?
   915                 # XXX: create it in dirstate.py ?
   909                 mf2 = mfmatches(self.dirstate.parents()[0])
   916                 mf2 = mfmatches(self.dirstate.parents()[0])
   914                     mf2.set(f, is_exec(f), is_link(f))
   921                     mf2.set(f, is_exec(f), is_link(f))
   915                 for f in removed:
   922                 for f in removed:
   916                     if f in mf2:
   923                     if f in mf2:
   917                         del mf2[f]
   924                         del mf2[f]
   918 
   925 
   919             if mywlock and wlock:
       
   920                 wlock.release()
       
   921         else:
   926         else:
   922             # we are comparing two revisions
   927             # we are comparing two revisions
   923             mf2 = mfmatches(node2)
   928             mf2 = mfmatches(node2)
   924 
   929 
   925         if not compareworking:
   930         if not compareworking: