changeset 35626:a0d33f4ddff9

phabricator: use named group for parsing differential reviews lines Differential Revision: https://phab.mercurial-scm.org/D1801
author Tom Prince <mozilla@hocat.ca>
date Sun, 14 Jan 2018 11:24:43 -0800
parents 390f860228ba
children 882998f08c3c
files contrib/phabricator.py
diffstat 1 files changed, 3 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/contrib/phabricator.py	Sat Jan 13 13:47:10 2018 +0900
+++ b/contrib/phabricator.py	Sun Jan 14 11:24:43 2018 -0800
@@ -166,7 +166,7 @@
 
 _differentialrevisiontagre = re.compile('\AD([1-9][0-9]*)\Z')
 _differentialrevisiondescre = re.compile(
-    '^Differential Revision:\s*(?:.*)D([1-9][0-9]*)$', re.M)
+    '^Differential Revision:\s*(?P<url>(?:.*)D(?P<id>[1-9][0-9]*))$', re.M)
 
 def getoldnodedrevmap(repo, nodelist):
     """find previous nodes that has been sent to Phabricator
@@ -207,7 +207,7 @@
         # Check commit message
         m = _differentialrevisiondescre.search(ctx.description())
         if m:
-            toconfirm[node] = (1, set(precnodes), int(m.group(1)))
+            toconfirm[node] = (1, set(precnodes), int(m.group('id')))
 
     # Double check if tags are genuine by collecting all old nodes from
     # Phabricator, and expect precursors overlap with it.
@@ -442,7 +442,7 @@
             # Create a local tag to note the association, if commit message
             # does not have it already
             m = _differentialrevisiondescre.search(ctx.description())
-            if not m or int(m.group(1)) != newrevid:
+            if not m or int(m.group('id')) != newrevid:
                 tagname = 'D%d' % newrevid
                 tags.tag(repo, tagname, ctx.node(), message=None, user=None,
                          date=None, local=True)