def hook(ui, repo, **kwargs):
 hooktype = kwargs['hooktype']
 node = kwargs['node']
 ui.debug('Zulip: received {hooktype} event\n'.format(hooktype=hooktype))
 if (hooktype != 'changegroup'):
  ui.warn('Zulip: {hooktype} not supported\n'.format(hooktype=hooktype))
  exit(1)
 ctx = repo.changectx(node)
 branch = ctx.branch()
 branch_whitelist = get_config(ui, 'branches')
 branch_blacklist = get_config(ui, 'ignore_branches')
 if branch_whitelist:
  watched_branches = [b.lower().strip() for b in branch_whitelist.split(',')]
  if (branch.lower() not in watched_branches):
   ui.debug('Zulip: ignoring event for {branch}\n'.format(branch=branch))
   exit(0)
 if branch_blacklist:
  ignored_branches = [b.lower().strip() for b in branch_blacklist.split(',')]
  if (branch.lower() in ignored_branches):
   ui.debug('Zulip: ignoring event for {branch}\n'.format(branch=branch))
   exit(0)
 base = repo[node].rev()
 tip = len(repo)
 email = get_config(ui, 'email')
 api_key = get_config(ui, 'api_key')
 site = get_config(ui, 'site')
 if (not (email and api_key)):
  ui.warn('Zulip: missing email or api_key configurations\n')
  ui.warn('in the [zulip] section of your .hg/hgrc.\n')
  exit(1)
 stream = get_config(ui, 'stream')
 if (not stream):
  stream = 'commits'
 web_url = get_config(ui, 'web_url')
 user = ctx.user()
 content = format_summary_line(web_url, user, base, tip, branch, node)
 content += format_commit_lines(web_url, repo, base, tip)
 subject = branch
 ui.debug('Sending to Zulip:\n')
 ui.debug((content + '\n'))
 send_zulip(email, api_key, site, stream, subject, content)

def hook ( ui , repo , ** kwargs ) : hooktype = kwargs [ 'hooktype' ] node = kwargs [ 'node' ] ui . debug ( 'Zulip: received {hooktype} event\n' . format ( hooktype = hooktype ) ) if ( hooktype != 'changegroup' ) : ui . warn ( 'Zulip: {hooktype} not supported\n' . format ( hooktype = hooktype ) ) exit ( 1 ) ctx = repo . changectx ( node ) branch = ctx . branch ( ) branch_whitelist = get_config ( ui , 'branches' ) branch_blacklist = get_config ( ui , 'ignore_branches' ) if branch_whitelist : watched_branches = [ b . lower ( ) . strip ( ) for b in branch_whitelist . split ( ',' ) ] if ( branch . lower ( ) not in watched_branches ) : ui . debug ( 'Zulip: ignoring event for {branch}\n' . format ( branch = branch ) ) exit ( 0 ) if branch_blacklist : ignored_branches = [ b . lower ( ) . strip ( ) for b in branch_blacklist . split ( ',' ) ] if ( branch . lower ( ) in ignored_branches ) : ui . debug ( 'Zulip: ignoring event for {branch}\n' . format ( branch = branch ) ) exit ( 0 ) base = repo [ node ] . rev ( ) tip = len ( repo ) email = get_config ( ui , 'email' ) api_key = get_config ( ui , 'api_key' ) site = get_config ( ui , 'site' ) if ( not ( email and api_key ) ) : ui . warn ( 'Zulip: missing email or api_key configurations\n' ) ui . warn ( 'in the [zulip] section of your .hg/hgrc.\n' ) exit ( 1 ) stream = get_config ( ui , 'stream' ) if ( not stream ) : stream = 'commits' web_url = get_config ( ui , 'web_url' ) user = ctx . user ( ) content = format_summary_line ( web_url , user , base , tip , branch , node ) content += format_commit_lines ( web_url , repo , base , tip ) subject = branch ui . debug ( 'Sending to Zulip:\n' ) ui . debug ( ( content + '\n' ) ) send_zulip ( email , api_key , site , stream , subject , content )
sqlalchemy 0 .