savannah-hackers-public
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Savannah-hackers-public] bzr post-commit email hook


From: Glenn Morris
Subject: Re: [Savannah-hackers-public] bzr post-commit email hook
Date: Sat, 11 Feb 2017 20:47:28 -0500
User-agent: Gnus (www.gnus.org), GNU Emacs (www.gnu.org/software/emacs/)

Assaf Gordon wrote:

> I assume it happens because over long period of time,
> various savannah admins changed various files
> (e.g. scripts on 'vcs'), but never checked them into the 'savane'
> repository.

I never knew anything about the repository. :)

> I'll have some time tomorrow, so I'll commit your updates
> to the repository as needed - otherwise we'll lose them
> again the next time savane in updated/installed.

Thanks. For the record, I also patched the installed bzr-email plugin
as shown at the end of this message.

>> I no longer have any writable bzr repos on Savannah to test with.
>
> I took the liberty of adding you (Glenn) to our dedicated test-project
>   https://savannah.nongnu.org/projects/test-project/

Thanks, but probably not needed.
I see there are only 8 bzr projects on Savannah that updated in the past
year (frankly, this is more than I expected). Only 3 Savannah projects
ever seem to have used the bzr-email plugin, and gsrc is the only one
still active. So I expect never to have to go through any of this again. :)

*** /usr/share/pyshared/bzrlib/plugins/email/emailer.py.ORIG    2012-07-13 
08:57:32.000000000 -0400
--- /usr/share/pyshared/bzrlib/plugins/email/emailer.py 2017-02-10 
22:07:52.808398220 -0500
***************
*** 58,63 ****
--- 58,64 ----
          fields = {
              'committer': self.revision.committer,
              'message': self.revision.get_summary(),
+             'nick': self.branch._get_nick(local=True),
              'revision': '%d' % self.revno,
              'url': self.url()
          }
***************
*** 92,98 ****
                                 to_file=outf
                                 )
  
!         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)
--- 93,101 ----
                                 to_file=outf
                                 )
  
!         # rgm: hack to always get the effect of verbose=True.
!         # https://bugs.launchpad.net/bzr-email/+bug/1189292
!         if len(self.revision.parent_ids) <= 0:
              # 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)
***************
*** 188,194 ****
              return
          for line in headers:
              key, value = line.split(": ", 1)
!             result[key] = value
          return result
  
      def send(self):
--- 191,197 ----
              return
          for line in headers:
              key, value = line.split(": ", 1)
!             result[key] = self._format(value)
          return result
  
      def send(self):
***************
*** 205,212 ****
              mailer = self.mailer()
              if mailer == 'smtplib':
                  self._send_using_smtplib()
!             else:
                  self._send_using_process()
          finally:
              self.repository.unlock()
              self.branch.unlock()
--- 208,217 ----
              mailer = self.mailer()
              if mailer == 'smtplib':
                  self._send_using_smtplib()
!             elif mailer == '/usr/bin/mail':
                  self._send_using_process()
+             else:
+                 raise errors.BzrError("Bad value for post_commit_mailer")
          finally:
              self.repository.unlock()
              self.branch.unlock()
***************
*** 247,253 ****
          msg = EmailMessage(from_addr, to_addrs, subject, body)
          
          if diff:
!             msg.add_inline_attachment(diff, self.diff_filename())
  
          # Add revision_mail_headers to the headers
          if header != None:
--- 252,258 ----
          msg = EmailMessage(from_addr, to_addrs, subject, body)
          
          if diff:
!             msg.add_inline_attachment(diff, self.diff_filename(), 'x-diff')
  
          # Add revision_mail_headers to the headers
          if header != None:
***************
*** 291,300 ****
  opt_post_commit_log_format = Option('post_commit_log_format',
      default='long', help="Log format for option.")
  opt_post_commit_difflimit = Option('post_commit_difflimit',
!     default=1000, from_unicode=int_from_store,
      help="Maximum number of lines in diffs.")
  opt_post_commit_push_pull = Option('post_commit_push_pull',
!     from_unicode=bool_from_store,
      help="Whether to send emails on push and pull.")
  opt_post_commit_diffoptions = Option('post_commit_diffoptions',
      help="Diff options to use.")
--- 296,305 ----
  opt_post_commit_log_format = Option('post_commit_log_format',
      default='long', help="Log format for option.")
  opt_post_commit_difflimit = Option('post_commit_difflimit',
!     default=10000, from_unicode=int_from_store,
      help="Maximum number of lines in diffs.")
  opt_post_commit_push_pull = Option('post_commit_push_pull',
!     default=True, from_unicode=bool_from_store,
      help="Whether to send emails on push and pull.")
  opt_post_commit_diffoptions = Option('post_commit_diffoptions',
      help="Diff options to use.")
***************
*** 303,309 ****
  opt_post_commit_to = ListOption('post_commit_to',
      help='Address to send commit emails to.')
  opt_post_commit_mailer = Option('post_commit_mailer',
!     help='Mail client to use.', default='mail')
  opt_post_commit_url = Option('post_commit_url',
      help='URL to mention for branch in post commit messages.')
  opt_revision_mail_headers = ListOption('revision_mail_headers',
--- 308,314 ----
  opt_post_commit_to = ListOption('post_commit_to',
      help='Address to send commit emails to.')
  opt_post_commit_mailer = Option('post_commit_mailer',
!     help='Mail client to use.', default='smtplib')
  opt_post_commit_url = Option('post_commit_url',
      help='URL to mention for branch in post commit messages.')
  opt_revision_mail_headers = ListOption('revision_mail_headers',



reply via email to

[Prev in Thread] Current Thread [Next in Thread]