##// END OF EJS Templates
treemanifest: make diff() faster...
Martin von Zweigbergk -
r24404:96cccf1e default
parent child Browse files
Show More
@@ -527,25 +527,33 b' class treemanifest(object):'
527 527 the nodeid will be None and the flags will be the empty
528 528 string.
529 529 '''
530 diff = {}
530 result = {}
531 emptytree = treemanifest()
532 def _diff(t1, t2):
533 for d, m1 in t1._dirs.iteritems():
534 m2 = t2._dirs.get(d, emptytree)
535 _diff(m1, m2)
536
537 for d, m2 in t2._dirs.iteritems():
538 if d not in t1._dirs:
539 _diff(emptytree, m2)
531 540
532 for fn, n1 in self.iteritems():
533 fl1 = self.flags(fn)
534 n2 = m2.get(fn, None)
535 fl2 = m2.flags(fn)
536 if n2 is None:
537 fl2 = ''
538 if n1 != n2 or fl1 != fl2:
539 diff[fn] = ((n1, fl1), (n2, fl2))
540 elif clean:
541 diff[fn] = None
541 for fn, n1 in t1._files.iteritems():
542 fl1 = t1._flags.get(fn, '')
543 n2 = t2._files.get(fn, None)
544 fl2 = t2._flags.get(fn, '')
545 if n1 != n2 or fl1 != fl2:
546 result[t1._subpath(fn)] = ((n1, fl1), (n2, fl2))
547 elif clean:
548 result[t1._subpath(fn)] = None
542 549
543 for fn, n2 in m2.iteritems():
544 if fn not in self:
545 fl2 = m2.flags(fn)
546 diff[fn] = ((None, ''), (n2, fl2))
550 for fn, n2 in t2._files.iteritems():
551 if fn not in t1._files:
552 fl2 = t2._flags.get(fn, '')
553 result[t2._subpath(fn)] = ((None, ''), (n2, fl2))
547 554
548 return diff
555 _diff(self, m2)
556 return result
549 557
550 558 def text(self):
551 559 """Get the full data of this manifest as a bytestring."""
General Comments 0
You need to be logged in to leave comments. Login now