D35: phabricator: sanity check Differential Revision from commit message

quark (Jun Wu) phabricator at mercurial-scm.org
Tue Jul 18 14:41:50 EDT 2017


This revision was automatically updated to reflect the committed changes.
Closed by commit rHG9132c5150af0: phabricator: sanity check Differential Revision from commit message (authored by quark).

CHANGED PRIOR TO COMMIT
  https://phab.mercurial-scm.org/D35?vs=51&id=282#toc

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D35?vs=51&id=282

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

AFFECTED FILES
  contrib/phabricator.py

CHANGE DETAILS

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



EMAIL PREFERENCES
  https://phab.mercurial-scm.org/settings/panel/emailpreferences/

To: quark, durin42, phillco, krbullock
Cc: krbullock, mercurial-devel


More information about the Mercurial-devel mailing list