mirror of
https://github.com/facebook/sapling.git
synced 2024-10-11 09:17:30 +03:00
4f207dd263
Summary: The phabdiff template mapping returns the phabricator diff id for the commit (based on commit message). for example: $ hg log -r master --template '{phabdiff}\n' D1485506 Test Plan: - unit tests addded Reviewers: sid0, durham Reviewed By: durham Differential Revision: https://phabricator.fb.com/D1622192 Tasks: 5124920
20 lines
567 B
Python
20 lines
567 B
Python
# phabdiff.py
|
|
#
|
|
# Copyright 2013 Facebook, Inc.
|
|
#
|
|
# This software may be used and distributed according to the terms of the
|
|
# GNU General Public License version 2 or any later version.
|
|
|
|
from mercurial import templatekw
|
|
|
|
import re
|
|
|
|
def showphabdiff(repo, ctx, templ, **args):
|
|
"""Return the phabricator diff id for a given hg rev"""
|
|
descr = ctx.description()
|
|
match = re.search('Differential Revision: https://phabricator.fb.com/(D\d+)', descr)
|
|
return match.group(1) if match else ''
|
|
|
|
def extsetup(ui):
|
|
templatekw.keywords['phabdiff'] = showphabdiff
|