mercurial: Update changegroup hook according to new mercurial API.
Fixes #322
This commit is contained in:
parent
d14a025ff9
commit
9b9070808f
|
@ -31,7 +31,7 @@ import zulip
|
||||||
import sys
|
import sys
|
||||||
from six.moves import range
|
from six.moves import range
|
||||||
from typing import Any, Optional, Text
|
from typing import Any, Optional, Text
|
||||||
from mercurial import ui, repo
|
from mercurial import ui, repository as repo
|
||||||
|
|
||||||
VERSION = "0.9"
|
VERSION = "0.9"
|
||||||
|
|
||||||
|
@ -73,7 +73,7 @@ def format_commit_lines(web_url, repo, base, tip):
|
||||||
commit_summaries = []
|
commit_summaries = []
|
||||||
for rev in range(base, tip):
|
for rev in range(base, tip):
|
||||||
rev_node = repo.changelog.node(rev)
|
rev_node = repo.changelog.node(rev)
|
||||||
rev_ctx = repo.changectx(rev_node)
|
rev_ctx = repo[rev_node]
|
||||||
one_liner = rev_ctx.description().split("\n")[0]
|
one_liner = rev_ctx.description().split("\n")[0]
|
||||||
|
|
||||||
if web_url:
|
if web_url:
|
||||||
|
@ -109,8 +109,8 @@ def send_zulip(email, api_key, site, stream, subject, content):
|
||||||
def get_config(ui, item):
|
def get_config(ui, item):
|
||||||
# type: (ui, str) -> str
|
# type: (ui, str) -> str
|
||||||
try:
|
try:
|
||||||
# configlist returns everything in lists.
|
# config returns configuration value.
|
||||||
return ui.configlist('zulip', item)[0]
|
return ui.config('zulip', item)
|
||||||
except IndexError:
|
except IndexError:
|
||||||
ui.warn("Zulip: Could not find required item {} in hg config.".format(item))
|
ui.warn("Zulip: Could not find required item {} in hg config.".format(item))
|
||||||
sys.exit(1)
|
sys.exit(1)
|
||||||
|
@ -129,7 +129,7 @@ def hook(ui, repo, **kwargs):
|
||||||
ui.warn("Zulip: {hooktype} not supported\n".format(hooktype=hooktype))
|
ui.warn("Zulip: {hooktype} not supported\n".format(hooktype=hooktype))
|
||||||
sys.exit(1)
|
sys.exit(1)
|
||||||
|
|
||||||
ctx = repo.changectx(node)
|
ctx = repo[node]
|
||||||
branch = ctx.branch()
|
branch = ctx.branch()
|
||||||
|
|
||||||
# If `branches` isn't specified, notify on all branches.
|
# If `branches` isn't specified, notify on all branches.
|
||||||
|
|
Loading…
Reference in a new issue