mercurial/localrepo.py
changeset 2474 1e32e2fe8a67
parent 2463 6ab016edd5c4
child 2475 7a77934ece46
equal deleted inserted replaced
2473:30c267cb4c2f 2474:1e32e2fe8a67
   616             for fn in mf.keys():
   616             for fn in mf.keys():
   617                 if not match(fn):
   617                 if not match(fn):
   618                     del mf[fn]
   618                     del mf[fn]
   619             return mf
   619             return mf
   620 
   620 
   621         if node1:
   621         compareworking = False
       
   622         if not node1 or node1 == self.dirstate.parents()[0]:
       
   623             compareworking = True
       
   624 
       
   625         if not compareworking:
   622             # read the manifest from node1 before the manifest from node2,
   626             # read the manifest from node1 before the manifest from node2,
   623             # so that we'll hit the manifest cache if we're going through
   627             # so that we'll hit the manifest cache if we're going through
   624             # all the revisions in parent->child order.
   628             # all the revisions in parent->child order.
   625             mf1 = mfmatches(node1)
   629             mf1 = mfmatches(node1)
   626 
   630 
   633                     wlock = None
   637                     wlock = None
   634             lookup, modified, added, removed, deleted, unknown, ignored = (
   638             lookup, modified, added, removed, deleted, unknown, ignored = (
   635                 self.dirstate.changes(files, match, show_ignored))
   639                 self.dirstate.changes(files, match, show_ignored))
   636 
   640 
   637             # are we comparing working dir against its parent?
   641             # are we comparing working dir against its parent?
   638             if not node1:
   642             if compareworking:
   639                 if lookup:
   643                 if lookup:
   640                     # do a full compare of any files that might have changed
   644                     # do a full compare of any files that might have changed
   641                     mf2 = mfmatches(self.dirstate.parents()[0])
   645                     mf2 = mfmatches(self.dirstate.parents()[0])
   642                     for f in lookup:
   646                     for f in lookup:
   643                         if fcmp(f, mf2):
   647                         if fcmp(f, mf2):
   656         else:
   660         else:
   657             # we are comparing two revisions
   661             # we are comparing two revisions
   658             deleted, unknown, ignored = [], [], []
   662             deleted, unknown, ignored = [], [], []
   659             mf2 = mfmatches(node2)
   663             mf2 = mfmatches(node2)
   660 
   664 
   661         if node1:
   665         if not compareworking:
   662             # flush lists from dirstate before comparing manifests
   666             # flush lists from dirstate before comparing manifests
   663             modified, added = [], []
   667             modified, added = [], []
   664 
   668 
   665             for fn in mf2:
   669             # make sure to sort the files so we talk to the disk in a
       
   670             # reasonable order
       
   671             mf2keys = mf2.keys()
       
   672             mf2keys.sort()
       
   673             for fn in mf2keys:
   666                 if mf1.has_key(fn):
   674                 if mf1.has_key(fn):
   667                     if mf1[fn] != mf2[fn] and (mf2[fn] != "" or fcmp(fn, mf1)):
   675                     if mf1[fn] != mf2[fn] and (mf2[fn] != "" or fcmp(fn, mf1)):
   668                         modified.append(fn)
   676                         modified.append(fn)
   669                     del mf1[fn]
   677                     del mf1[fn]
   670                 else:
   678                 else: