##// END OF EJS Templates
manifest: add match argument to diff and filesnotin...
Durham Goode -
r31255:959ebff3 default
parent child Browse files
Show More
@@ -445,8 +445,12 b' class manifestdict(object):'
445 def keys(self):
445 def keys(self):
446 return list(self.iterkeys())
446 return list(self.iterkeys())
447
447
448 def filesnotin(self, m2):
448 def filesnotin(self, m2, match=None):
449 '''Set of files in this manifest that are not in the other'''
449 '''Set of files in this manifest that are not in the other'''
450 if match:
451 m1 = self.matches(match)
452 m2 = m2.matches(match)
453 return m1.filesnotin(m2)
450 diff = self.diff(m2)
454 diff = self.diff(m2)
451 files = set(filepath
455 files = set(filepath
452 for filepath, hashflags in diff.iteritems()
456 for filepath, hashflags in diff.iteritems()
@@ -523,7 +527,7 b' class manifestdict(object):'
523 m._lm = self._lm.filtercopy(match)
527 m._lm = self._lm.filtercopy(match)
524 return m
528 return m
525
529
526 def diff(self, m2, clean=False):
530 def diff(self, m2, match=None, clean=False):
527 '''Finds changes between the current manifest and m2.
531 '''Finds changes between the current manifest and m2.
528
532
529 Args:
533 Args:
@@ -538,6 +542,10 b' class manifestdict(object):'
538 the nodeid will be None and the flags will be the empty
542 the nodeid will be None and the flags will be the empty
539 string.
543 string.
540 '''
544 '''
545 if match:
546 m1 = self.matches(match)
547 m2 = m2.matches(match)
548 return m1.diff(m2, clean=clean)
541 return self._lm.diff(m2._lm, clean)
549 return self._lm.diff(m2._lm, clean)
542
550
543 def setflag(self, key, flag):
551 def setflag(self, key, flag):
@@ -906,8 +914,13 b' class treemanifest(object):'
906 copy._copyfunc = self._copyfunc
914 copy._copyfunc = self._copyfunc
907 return copy
915 return copy
908
916
909 def filesnotin(self, m2):
917 def filesnotin(self, m2, match=None):
910 '''Set of files in this manifest that are not in the other'''
918 '''Set of files in this manifest that are not in the other'''
919 if match:
920 m1 = self.matches(match)
921 m2 = m2.matches(match)
922 return m1.filesnotin(m2)
923
911 files = set()
924 files = set()
912 def _filesnotin(t1, t2):
925 def _filesnotin(t1, t2):
913 if t1._node == t2._node and not t1._dirty and not t2._dirty:
926 if t1._node == t2._node and not t1._dirty and not t2._dirty:
@@ -1025,7 +1038,7 b' class treemanifest(object):'
1025 ret._dirty = True
1038 ret._dirty = True
1026 return ret
1039 return ret
1027
1040
1028 def diff(self, m2, clean=False):
1041 def diff(self, m2, match=None, clean=False):
1029 '''Finds changes between the current manifest and m2.
1042 '''Finds changes between the current manifest and m2.
1030
1043
1031 Args:
1044 Args:
@@ -1040,6 +1053,10 b' class treemanifest(object):'
1040 the nodeid will be None and the flags will be the empty
1053 the nodeid will be None and the flags will be the empty
1041 string.
1054 string.
1042 '''
1055 '''
1056 if match:
1057 m1 = self.matches(match)
1058 m2 = m2.matches(match)
1059 return m1.diff(m2, clean=clean)
1043 result = {}
1060 result = {}
1044 emptytree = treemanifest()
1061 emptytree = treemanifest()
1045 def _diff(t1, t2):
1062 def _diff(t1, t2):
@@ -320,7 +320,7 b' class basemanifesttests(object):'
320 'bar/baz/qux.py': None,
320 'bar/baz/qux.py': None,
321 'foo': (MISSING, (BIN_HASH_1, '')),
321 'foo': (MISSING, (BIN_HASH_1, '')),
322 }
322 }
323 self.assertEqual(want, pruned.diff(short, True))
323 self.assertEqual(want, pruned.diff(short, clean=True))
324
324
325 def testReversedLines(self):
325 def testReversedLines(self):
326 backwards = ''.join(
326 backwards = ''.join(
General Comments 0
You need to be logged in to leave comments. Login now