]> khamidou — GitHub mirrors - arcanist.git/commitdiff
Drop support for parsing non-URL differential IDs from commit message.
authorJoshua Spence <josh@joshuaspence.com>
Tue, 17 Jun 2014 15:39:28 +0000 (01:39 +1000)
committerJoshua Spence <josh@joshuaspence.com>
Tue, 17 Jun 2014 15:39:28 +0000 (01:39 +1000)
Summary: This has been a `TODO` for a few years now... no-one should be using the old-school (non-URL) syntax anymore.

Test Plan: I'm actually not sure if it's okay to drop support for this... please verify.

Reviewers: epriestley, #blessed_reviewers

Reviewed By: epriestley, #blessed_reviewers

Subscribers: epriestley, Korvin

Differential Revision: https://secure.phabricator.com/D9595

src/differential/ArcanistDifferentialCommitMessage.php

index 9a0d3779ba42aaa1b4308f1f2c14a1985e3d258e..4381556b25ab452b7b8e13fdeba3fbeaf78b5f1b 100644 (file)
@@ -19,27 +19,20 @@ final class ArcanistDifferentialCommitMessage {
     $obj = new ArcanistDifferentialCommitMessage();
     $obj->rawCorpus = $corpus;
 
-    // Parse older-style "123" fields, or newer-style full-URI fields.
-    // TODO: Remove support for older-style fields.
-
     $match = null;
     if (preg_match('/^Differential Revision:\s*(.*)/im', $corpus, $match)) {
       $revision_id = trim($match[1]);
       if (strlen($revision_id)) {
-        if (preg_match('/^D?\d+$/', $revision_id)) {
-          $obj->revisionID = (int)trim($revision_id, 'D');
+        $uri = new PhutilURI($revision_id);
+        $path = $uri->getPath();
+        $path = trim($path, '/');
+        if (preg_match('/^D\d+$/', $path)) {
+          $obj->revisionID = (int)trim($path, 'D');
         } else {
-          $uri = new PhutilURI($revision_id);
-          $path = $uri->getPath();
-          $path = trim($path, '/');
-          if (preg_match('/^D\d+$/', $path)) {
-            $obj->revisionID = (int)trim($path, 'D');
-          } else {
-            throw new ArcanistUsageException(
-              "Invalid 'Differential Revision' field. The field should have a ".
-              "Phabricator URI like 'http://phabricator.example.com/D123', ".
-              "but has '{$match[1]}'.");
-          }
+          throw new ArcanistUsageException(
+            "Invalid 'Differential Revision' field. The field should have a ".
+            "Phabricator URI like 'http://phabricator.example.com/D123', ".
+            "but has '{$match[1]}'.");
         }
       }
     }