contrib/phabricator.py
changeset 33564 91e3dcefc9b7
parent 33498 b7a75b9a3386
child 33601 850d2ec2cf6a
--- a/contrib/phabricator.py	Tue Jul 18 08:14:10 2017 -0400
+++ b/contrib/phabricator.py	Mon Jul 10 18:02:03 2017 -0700
@@ -138,7 +138,7 @@
 
 _differentialrevisiontagre = re.compile('\AD([1-9][0-9]*)\Z')
 _differentialrevisiondescre = re.compile(
-    '^Differential Revision:.*D([1-9][0-9]*)$', re.M)
+    '^Differential Revision:\s*(.*)D([1-9][0-9]*)$', re.M)
 
 def getoldnodedrevmap(repo, nodelist):
     """find previous nodes that has been sent to Phabricator
@@ -172,10 +172,14 @@
                         toconfirm[node] = (n, set(precnodes), int(m.group(1)))
                         continue
 
-        # Check commit message
+        # Check commit message (make sure URL matches)
         m = _differentialrevisiondescre.search(ctx.description())
         if m:
-            result[node] = (None, int(m.group(1)))
+            if m.group(1).rstrip('/') == url.rstrip('/'):
+                result[node] = (None, int(m.group(2)))
+            else:
+                unfi.ui.warn(_('%s: Differential Revision URL ignored - host '
+                               'does not match config\n') % ctx)
 
     # Double check if tags are genuine by collecting all old nodes from
     # Phabricator, and expect precursors overlap with it.