Mercurial > hg > mercurial-crew-with-dirclash
comparison hgext/notify.py @ 2224:e8f47dfb70f4
notify extension: generate right number of diffs
author | Vadim Gelfer <vadim.gelfer@gmail.com> |
---|---|
date | Mon, 08 May 2006 11:16:09 -0700 |
parents | 05b6c13f43c6 |
children | ff43ea94eff4 |
comparison
equal
deleted
inserted
replaced
2221:05b6c13f43c6 | 2224:e8f47dfb70f4 |
---|---|
223 def diff(self, node): | 223 def diff(self, node): |
224 maxdiff = int(self.ui.config('notify', 'maxdiff', 300)) | 224 maxdiff = int(self.ui.config('notify', 'maxdiff', 300)) |
225 if maxdiff == 0: | 225 if maxdiff == 0: |
226 return | 226 return |
227 fp = templater.stringio() | 227 fp = templater.stringio() |
228 commands.dodiff(fp, self.ui, self.repo, node, | 228 prev = self.repo.changelog.parents(node)[0] |
229 commands.dodiff(fp, self.ui, self.repo, prev, | |
229 self.repo.changelog.tip()) | 230 self.repo.changelog.tip()) |
230 difflines = fp.getvalue().splitlines(1) | 231 difflines = fp.getvalue().splitlines(1) |
231 if maxdiff > 0 and len(difflines) > maxdiff: | 232 if maxdiff > 0 and len(difflines) > maxdiff: |
232 self.sio.write(_('\ndiffs (truncated from %d to %d lines):\n\n') % | 233 self.sio.write(_('\ndiffs (truncated from %d to %d lines):\n\n') % |
233 (len(difflines), maxdiff)) | 234 (len(difflines), maxdiff)) |