##// 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 diffstat = True # add a diffstat before the diff content
43 diffstat = True # add a diffstat before the diff content
44 sources = serve # notify if source of incoming changes in this list
44 sources = serve # notify if source of incoming changes in this list
45 # (serve == ssh or http, push, pull, bundle)
45 # (serve == ssh or http, push, pull, bundle)
46 merge = False # send notification for merges (default True)
46 [email]
47 [email]
47 from = user@host.com # email address to send as if none given
48 from = user@host.com # email address to send as if none given
48 [web]
49 [web]
@@ -111,6 +112,7 b' class notifier(object):'
111 self.test = self.ui.configbool('notify', 'test', True)
112 self.test = self.ui.configbool('notify', 'test', True)
112 self.charsets = mail._charsets(self.ui)
113 self.charsets = mail._charsets(self.ui)
113 self.subs = self.subscribers()
114 self.subs = self.subscribers()
115 self.merge = self.ui.configbool('notify', 'merge', True)
114
116
115 mapfile = self.ui.config('notify', 'style')
117 mapfile = self.ui.config('notify', 'style')
116 template = (self.ui.config('notify', hooktype) or
118 template = (self.ui.config('notify', hooktype) or
@@ -166,10 +168,13 b' class notifier(object):'
166 return self.ui.config('web', 'baseurl') + (path or self.root)
168 return self.ui.config('web', 'baseurl') + (path or self.root)
167
169
168 def node(self, ctx, **props):
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 self.t.show(ctx, changes=ctx.changeset(),
174 self.t.show(ctx, changes=ctx.changeset(),
171 baseurl=self.ui.config('web', 'baseurl'),
175 baseurl=self.ui.config('web', 'baseurl'),
172 root=self.repo.root, webroot=self.root, **props)
176 root=self.repo.root, webroot=self.root, **props)
177 return True
173
178
174 def skipsource(self, source):
179 def skipsource(self, source):
175 '''true if incoming changes from this source should be skipped.'''
180 '''true if incoming changes from this source should be skipped.'''
@@ -283,16 +288,29 b' def hook(ui, repo, hooktype, node=None, '
283 return
288 return
284
289
285 ui.pushbuffer()
290 ui.pushbuffer()
291 data = ''
292 count = 0
286 if hooktype == 'changegroup':
293 if hooktype == 'changegroup':
287 start, end = ctx.rev(), len(repo)
294 start, end = ctx.rev(), len(repo)
288 count = end - start
289 for rev in xrange(start, end):
295 for rev in xrange(start, end):
290 n.node(repo[rev])
296 if n.node(repo[rev]):
291 n.diff(ctx, repo['tip'])
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:
304 n.diff(ctx, repo['tip'])
292 else:
305 else:
293 count = 1
306 if not n.node(ctx):
294 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 n.diff(ctx)
312 n.diff(ctx)
296
313
297 data = ui.popbuffer()
314 data += ui.popbuffer()
298 n.send(ctx, count, data)
315 if count:
316 n.send(ctx, count, data)
General Comments 0
You need to be logged in to leave comments. Login now