Mercurial > hg
comparison hgext/notify.py @ 7308:b6f5490effbf
patch: turn patch.diff() into a generator
This should even be a little faster than passing in an fp argument.
author | Dirkjan Ochtman <dirkjan@ochtman.nl> |
---|---|
date | Mon, 03 Nov 2008 16:48:23 +0100 |
parents | 9df67ee30ef5 |
children | 87158be081b8 |
comparison
equal
deleted
inserted
replaced
7307:56380212d630 | 7308:b6f5490effbf |
---|---|
236 | 236 |
237 def diff(self, node, ref): | 237 def diff(self, node, ref): |
238 maxdiff = int(self.ui.config('notify', 'maxdiff', 300)) | 238 maxdiff = int(self.ui.config('notify', 'maxdiff', 300)) |
239 prev = self.repo.changelog.parents(node)[0] | 239 prev = self.repo.changelog.parents(node)[0] |
240 | 240 |
241 self.ui.pushbuffer() | 241 chunks = patch.diff(self.repo, prev, ref, opts=patch.diffopts(self.ui)) |
242 patch.diff(self.repo, prev, ref, opts=patch.diffopts(self.ui)) | 242 difflines = ''.join(chunks).splitlines() |
243 difflines = self.ui.popbuffer().splitlines() | |
244 | 243 |
245 if self.ui.configbool('notify', 'diffstat', True): | 244 if self.ui.configbool('notify', 'diffstat', True): |
246 s = patch.diffstat(difflines) | 245 s = patch.diffstat(difflines) |
247 # s may be nil, don't include the header if it is | 246 # s may be nil, don't include the header if it is |
248 if s: | 247 if s: |