Rev 34: Special case showing a single revision without a merge. in http://bzr.arbash-meinel.com/plugins/email
John Arbash Meinel
john at arbash-meinel.com
Thu Jun 5 18:41:14 BST 2008
At http://bzr.arbash-meinel.com/plugins/email
------------------------------------------------------------
revno: 34
revision-id: john at arbash-meinel.com-20080605174057-dmtofft54dr4snri
parent: john at arbash-meinel.com-20080501225950-1qerrg9fp54ifmel
committer: John Arbash Meinel <john at arbash-meinel.com>
branch nick: email
timestamp: Thu 2008-06-05 12:40:57 -0500
message:
Special case showing a single revision without a merge.
This cuts out 2s of 'bzr commit' time for committing to a bzr.dev tree.
-------------- next part --------------
=== modified file 'emailer.py'
--- a/emailer.py 2007-09-19 21:38:05 +0000
+++ b/emailer.py 2008-06-05 17:40:57 +0000
@@ -46,7 +46,7 @@
self.revno = self.branch.revision_id_to_revno(self._revision_id)
def body(self):
- from bzrlib.log import log_formatter, show_log
+ from bzrlib import log
rev1 = rev2 = self.revno
if rev1 == 0:
@@ -63,17 +63,25 @@
outf.write('At %s\n\n' % self.url())
- lf = log_formatter('long',
- show_ids=True,
- to_file=outf
- )
+ lf = log.log_formatter('long',
+ show_ids=True,
+ to_file=outf
+ )
- show_log(self.branch,
- lf,
- start_revision=rev1,
- end_revision=rev2,
- verbose=True
- )
+ if len(self.revision.parent_ids) <= 1:
+ # This is not a merge, so we can special case the display of one
+ # revision, and not have to encur the show_log overhead.
+ lr = log.LogRevision(self.revision, self.revno, 0, None)
+ lf.log_revision(lr)
+ else:
+ # let the show_log code figure out what revisions need to be
+ # displayed, as this is a merge
+ log.show_log(self.branch,
+ lf,
+ start_revision=rev1,
+ end_revision=rev2,
+ verbose=True
+ )
return outf.getvalue()
More information about the bazaar-commits
mailing list