diff --git a/integrations/perforce/zulip_change-commit.py b/integrations/perforce/zulip_change-commit.py index f75eb33..ed1caf5 100755 --- a/integrations/perforce/zulip_change-commit.py +++ b/integrations/perforce/zulip_change-commit.py @@ -76,6 +76,15 @@ if destination is None: # Don't forward the notice anywhere sys.exit(0) +change = metadata["change"] +p4web = None +if hasattr(config, "P4_WEB"): + p4web = config.P4_WEB + +if p4web is not None: + # linkify the change number + change = '[{change}]({p4web}/{change}?ac=10)'.format(p4web=p4web, change=change) + message = """**{user}** committed revision @{change} to `{path}`. ```quote @@ -83,7 +92,7 @@ message = """**{user}** committed revision @{change} to `{path}`. ``` """.format( user=metadata["user"], - change=metadata["change"], + change=change, path=changeroot, desc=metadata["desc"]) # type: str diff --git a/integrations/perforce/zulip_perforce_config.py b/integrations/perforce/zulip_perforce_config.py index 2a4bfeb..2b23920 100644 --- a/integrations/perforce/zulip_perforce_config.py +++ b/integrations/perforce/zulip_perforce_config.py @@ -26,6 +26,10 @@ ZULIP_USER = "p4-bot@example.com" ZULIP_API_KEY = "0123456789abcdef0123456789abcdef" ZULIP_SITE = "https://zulip.example.com" +# Set this to point at a p4web installation to get changelist IDs as links +# P4_WEB = "https://p4web.example.com" +P4_WEB = None + # commit_notice_destination() lets you customize where commit notices # are sent to with the full power of a Python function. #