Patchwork D1801: Use named group for parsing differential reviews lines.

login
register
mail settings
Submitter phabricator
Date Jan. 14, 2018, 7:34 p.m.
Message ID <5ae33408628b1451ae5ee8973883fa23@localhost.localdomain>
Download mbox | patch
Permalink /patch/26741/
State Not Applicable
Headers show

Comments

phabricator - Jan. 14, 2018, 7:34 p.m.
This revision was automatically updated to reflect the committed changes.
Closed by commit rHGa0d33f4ddff9: phabricator: use named group for parsing differential reviews lines (authored by tom.prince, committed by ).

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D1801?vs=4680&id=4818

REVISION DETAIL
  https://phab.mercurial-scm.org/D1801

AFFECTED FILES
  contrib/phabricator.py

CHANGE DETAILS




To: tom.prince, #hg-reviewers, indygreg
Cc: indygreg, mercurial-devel

Patch

diff --git a/contrib/phabricator.py b/contrib/phabricator.py
--- a/contrib/phabricator.py
+++ b/contrib/phabricator.py
@@ -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)