##// END OF EJS Templates
record: move countChanges in the hunk class...
Laurent Charignon -
r24262:7f24b2a0 default
parent child Browse files
Show More
@@ -69,12 +69,6 b' def scanpatch(fp):'
69 else:
69 else:
70 yield 'other', line
70 yield 'other', line
71
71
72 def countchanges(hunk):
73 """hunk -> (n+,n-)"""
74 add = len([h for h in hunk if h[0] == '+'])
75 rem = len([h for h in hunk if h[0] == '-'])
76 return add, rem
77
78 class hunk(object):
72 class hunk(object):
79 """patch hunk
73 """patch hunk
80
74
@@ -94,7 +88,13 b' class hunk(object):'
94 self.toline, self.after = trimcontext(toline, after)
88 self.toline, self.after = trimcontext(toline, after)
95 self.proc = proc
89 self.proc = proc
96 self.hunk = hunk
90 self.hunk = hunk
97 self.added, self.removed = countchanges(self.hunk)
91 self.added, self.removed = self.countchanges(self.hunk)
92
93 def countchanges(self, hunk):
94 """hunk -> (n+,n-)"""
95 add = len([h for h in hunk if h[0] == '+'])
96 rem = len([h for h in hunk if h[0] == '-'])
97 return add, rem
98
98
99 def write(self, fp):
99 def write(self, fp):
100 delta = len(self.before) + len(self.after)
100 delta = len(self.before) + len(self.after)
General Comments 0
You need to be logged in to leave comments. Login now