hgext/notify.py
changeset 2873 4ec58b157265
parent 2783 6b27a7125b67
child 2909 20b95aef3fe0
equal deleted inserted replaced
2872:5dd6631c8238 2873:4ec58b157265
    65 # push changes to, they can manage their own subscriptions.
    65 # push changes to, they can manage their own subscriptions.
    66 
    66 
    67 from mercurial.demandload import *
    67 from mercurial.demandload import *
    68 from mercurial.i18n import gettext as _
    68 from mercurial.i18n import gettext as _
    69 from mercurial.node import *
    69 from mercurial.node import *
    70 demandload(globals(), 'email.Parser mercurial:commands,templater,util')
    70 demandload(globals(), 'email.Parser mercurial:commands,patch,templater,util')
    71 demandload(globals(), 'fnmatch socket time')
    71 demandload(globals(), 'fnmatch socket time')
    72 
    72 
    73 # template for single changeset can include email headers.
    73 # template for single changeset can include email headers.
    74 single_template = '''
    74 single_template = '''
    75 Subject: changeset in {webroot}: {desc|firstline|strip}
    75 Subject: changeset in {webroot}: {desc|firstline|strip}
   236         maxdiff = int(self.ui.config('notify', 'maxdiff', 300))
   236         maxdiff = int(self.ui.config('notify', 'maxdiff', 300))
   237         if maxdiff == 0:
   237         if maxdiff == 0:
   238             return
   238             return
   239         fp = templater.stringio()
   239         fp = templater.stringio()
   240         prev = self.repo.changelog.parents(node)[0]
   240         prev = self.repo.changelog.parents(node)[0]
   241         commands.dodiff(fp, self.ui, self.repo, prev, ref)
   241         patch.diff(self.repo, fp, prev, ref)
   242         difflines = fp.getvalue().splitlines(1)
   242         difflines = fp.getvalue().splitlines(1)
   243         if maxdiff > 0 and len(difflines) > maxdiff:
   243         if maxdiff > 0 and len(difflines) > maxdiff:
   244             self.sio.write(_('\ndiffs (truncated from %d to %d lines):\n\n') %
   244             self.sio.write(_('\ndiffs (truncated from %d to %d lines):\n\n') %
   245                            (len(difflines), maxdiff))
   245                            (len(difflines), maxdiff))
   246             difflines = difflines[:maxdiff]
   246             difflines = difflines[:maxdiff]