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