##// END OF EJS Templates
record: simplify header methods with util.any
Patrick Mezard -
r13294:98f0adfc default
parent child Browse files
Show More
@@ -81,9 +81,7 b' class header(object):'
81 81 self.hunks = []
82 82
83 83 def binary(self):
84 for h in self.header:
85 if h.startswith('index '):
86 return True
84 return util.any(h.startswith('index ') for h in self.header)
87 85
88 86 def pretty(self, fp):
89 87 for h in self.header:
@@ -106,9 +104,7 b' class header(object):'
106 104 fp.write(''.join(self.header))
107 105
108 106 def allhunks(self):
109 for h in self.header:
110 if self.allhunks_re.match(h):
111 return True
107 return util.any(self.allhunks_re.match(h) for h in self.header)
112 108
113 109 def files(self):
114 110 match = self.diffgit_re.match(self.header[0])
@@ -127,9 +123,7 b' class header(object):'
127 123 return '<header %s>' % (' '.join(map(repr, self.files())))
128 124
129 125 def special(self):
130 for h in self.header:
131 if self.special_re.match(h):
132 return True
126 return util.any(self.special_re.match(h) for h in self.header)
133 127
134 128 def countchanges(hunk):
135 129 """hunk -> (n+,n-)"""
General Comments 0
You need to be logged in to leave comments. Login now