##// END OF EJS Templates
notify: permit suppression of merge changeset notification...
David Champion -
r9516:f8048c33 default
parent child Browse files
Show More
@@ -43,6 +43,7 b' Optional configuration items::'
43 43 diffstat = True # add a diffstat before the diff content
44 44 sources = serve # notify if source of incoming changes in this list
45 45 # (serve == ssh or http, push, pull, bundle)
46 merge = False # send notification for merges (default True)
46 47 [email]
47 48 from = user@host.com # email address to send as if none given
48 49 [web]
@@ -111,6 +112,7 b' class notifier(object):'
111 112 self.test = self.ui.configbool('notify', 'test', True)
112 113 self.charsets = mail._charsets(self.ui)
113 114 self.subs = self.subscribers()
115 self.merge = self.ui.configbool('notify', 'merge', True)
114 116
115 117 mapfile = self.ui.config('notify', 'style')
116 118 template = (self.ui.config('notify', hooktype) or
@@ -166,10 +168,13 b' class notifier(object):'
166 168 return self.ui.config('web', 'baseurl') + (path or self.root)
167 169
168 170 def node(self, ctx, **props):
169 '''format one changeset.'''
171 '''format one changeset, unless it is a suppressed merge.'''
172 if not self.merge and len(ctx.parents()) > 1:
173 return False
170 174 self.t.show(ctx, changes=ctx.changeset(),
171 175 baseurl=self.ui.config('web', 'baseurl'),
172 176 root=self.repo.root, webroot=self.root, **props)
177 return True
173 178
174 179 def skipsource(self, source):
175 180 '''true if incoming changes from this source should be skipped.'''
@@ -283,16 +288,29 b' def hook(ui, repo, hooktype, node=None, '
283 288 return
284 289
285 290 ui.pushbuffer()
291 data = ''
292 count = 0
286 293 if hooktype == 'changegroup':
287 294 start, end = ctx.rev(), len(repo)
288 count = end - start
289 295 for rev in xrange(start, end):
290 n.node(repo[rev])
296 if n.node(repo[rev]):
297 count += 1
298 else:
299 data += ui.popbuffer()
300 ui.note(_('notify: suppressing notification for merge %d:%s\n') %
301 (rev, repo[rev].hex()[:12]))
302 ui.pushbuffer()
303 if count:
291 304 n.diff(ctx, repo['tip'])
292 305 else:
293 count = 1
294 n.node(ctx)
306 if not n.node(ctx):
307 ui.popbuffer()
308 ui.note(_('notify: suppressing notification for merge %d:%s\n') %
309 (ctx.rev(), ctx.hex()[:12]))
310 return
311 count += 1
295 312 n.diff(ctx)
296 313
297 data = ui.popbuffer()
314 data += ui.popbuffer()
315 if count:
298 316 n.send(ctx, count, data)
General Comments 0
You need to be logged in to leave comments. Login now