mirror of
https://github.com/facebook/sapling.git
synced 2024-10-11 09:17:30 +03:00
8a3a99ba21
Summary: Be a better citizen under system python path. Fix all tests issues and change setup.py to use glob pattern to include all extensions. Test Plan: Run tests and `make local`. Also build and install the package and run `hg sl` in major repos. Reviewers: #mercurial, ttung, rmcelroy Reviewed By: rmcelroy Subscribers: rmcelroy, durham, mjpieters Differential Revision: https://phabricator.intern.facebook.com/D3534311 Signature: t1:3534311:1468275426:fe122646c8bd6c541e1889e73e9df28f86747ff2
32 lines
997 B
Python
32 lines
997 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
|
|
from phabricator import diffprops
|
|
import re
|
|
|
|
def showphabdiff(repo, ctx, templ, **args):
|
|
""":phabdiff: String. Return the phabricator diff id for a given hg rev."""
|
|
descr = ctx.description()
|
|
revision = diffprops.parserevfromcommitmsg(descr)
|
|
return 'D' + revision if revision else ''
|
|
|
|
def showtasks(**args):
|
|
""":tasks: String. Return the tasks associated with given hg rev."""
|
|
descr = args['ctx'].description()
|
|
match = re.search('(Tasks|Task ID): (\d+)(,\s*\d+)*', descr)
|
|
|
|
tasks = []
|
|
if match:
|
|
tasksline = match.group(0)
|
|
tasks = re.findall("\d+", tasksline)
|
|
return templatekw.showlist('task', tasks, **args)
|
|
|
|
def extsetup(ui):
|
|
templatekw.keywords['phabdiff'] = showphabdiff
|
|
templatekw.keywords['tasks'] = showtasks
|