[PATCH 1 of 2 stable] notify: use util.ellipsis() to truncate long subject
Yuya Nishihara
yuya at tcha.org
Thu Dec 23 10:37:12 CST 2010
# HG changeset patch
# User Yuya Nishihara <yuya at tcha.org>
# Date 1293121038 -32400
# Branch stable
# Node ID 0ed736fe75b467ad9191f2ef52129992381659e5
# Parent 2fa2e6444645563835537e889dd7b5d230348430
notify: use util.ellipsis() to truncate long subject
diff --git a/hgext/notify.py b/hgext/notify.py
--- a/hgext/notify.py
+++ b/hgext/notify.py
@@ -215,8 +215,8 @@ class notifier(object):
s = ctx.description().lstrip().split('\n', 1)[0].rstrip()
subject = '%s: %s' % (self.root, s)
maxsubject = int(self.ui.config('notify', 'maxsubject', 67))
- if maxsubject and len(subject) > maxsubject:
- subject = subject[:maxsubject - 3] + '...'
+ if maxsubject:
+ subject = util.ellipsis(subject, maxsubject)
msg['Subject'] = mail.headencode(self.ui, subject,
self.charsets, self.test)
More information about the Mercurial-devel
mailing list