diff --git a/contrib/phabricator.py b/contrib/phabricator.py --- a/contrib/phabricator.py +++ b/contrib/phabricator.py @@ -137,7 +137,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 @@ -169,10 +169,14 @@ result[node] = (n, 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) return result