diff --git a/resources/sql/patches/differentialbookmarks.sql b/resources/sql/patches/differentialbookmarks.sql new file mode 100644 index 0000000000..36d4d14ce4 --- /dev/null +++ b/resources/sql/patches/differentialbookmarks.sql @@ -0,0 +1,3 @@ +ALTER TABLE `{$NAMESPACE}_differential`.`differential_diff` + ADD `bookmark` VARCHAR(255) COLLATE utf8_general_ci DEFAULT NULL + AFTER `branch`; diff --git a/src/applications/conduit/method/differential/ConduitAPI_differential_creatediff_Method.php b/src/applications/conduit/method/differential/ConduitAPI_differential_creatediff_Method.php index 5f0557e9c0..8780afc012 100644 --- a/src/applications/conduit/method/differential/ConduitAPI_differential_creatediff_Method.php +++ b/src/applications/conduit/method/differential/ConduitAPI_differential_creatediff_Method.php @@ -31,6 +31,7 @@ final class ConduitAPI_differential_creatediff_Method extends ConduitAPIMethod { 'sourceMachine' => 'required string', 'sourcePath' => 'required string', 'branch' => 'required string', + 'bookmark' => 'optional string', 'sourceControlSystem' => 'required enum', 'sourceControlPath' => 'required string', 'sourceControlBaseRevision' => 'required string', @@ -70,6 +71,7 @@ final class ConduitAPI_differential_creatediff_Method extends ConduitAPIMethod { $diff->setBranch($request->getValue('branch')); $diff->setCreationMethod($request->getValue('creationMethod')); $diff->setAuthorPHID($request->getValue('authorPHID')); + $diff->setBookmark($request->getValue('bookmark')); $parent_id = $request->getValue('parentRevisionID'); if ($parent_id) { diff --git a/src/applications/differential/field/specification/DifferentialBranchFieldSpecification.php b/src/applications/differential/field/specification/DifferentialBranchFieldSpecification.php index fb7446748a..12ae748c37 100644 --- a/src/applications/differential/field/specification/DifferentialBranchFieldSpecification.php +++ b/src/applications/differential/field/specification/DifferentialBranchFieldSpecification.php @@ -31,7 +31,14 @@ final class DifferentialBranchFieldSpecification $diff = $this->getDiff(); $branch = $diff->getBranch(); - if ($branch == '') { + $bookmark = $diff->getBookmark(); + $has_branch = ($branch != ''); + $has_bookmark = ($bookmark != ''); + if ($has_branch && $has_bookmark) { + $branch = "{$bookmark} bookmark on {$branch} branch"; + } else if ($has_bookmark) { + $branch = "{$bookmark} bookmark"; + } else if (!$has_branch) { return null; } diff --git a/src/applications/differential/storage/DifferentialDiff.php b/src/applications/differential/storage/DifferentialDiff.php index 2bf90f1c46..5fdffe1d1b 100644 --- a/src/applications/differential/storage/DifferentialDiff.php +++ b/src/applications/differential/storage/DifferentialDiff.php @@ -34,6 +34,7 @@ final class DifferentialDiff extends DifferentialDAO { protected $lineCount; protected $branch; + protected $bookmark; protected $parentRevisionID; protected $arcanistProjectPHID; @@ -257,6 +258,7 @@ final class DifferentialDiff extends DifferentialDAO { 'sourceControlPath' => $this->getSourceControlPath(), 'sourceControlSystem' => $this->getSourceControlSystem(), 'branch' => $this->getBranch(), + 'bookmark' => $this->getBookmark(), 'creationMethod' => $this->getCreationMethod(), 'description' => $this->getDescription(), 'unitStatus' => $this->getUnitStatus(), diff --git a/src/infrastructure/setup/sql/PhabricatorBuiltinPatchList.php b/src/infrastructure/setup/sql/PhabricatorBuiltinPatchList.php index 8da08b96c3..ccfc1200aa 100644 --- a/src/infrastructure/setup/sql/PhabricatorBuiltinPatchList.php +++ b/src/infrastructure/setup/sql/PhabricatorBuiltinPatchList.php @@ -895,6 +895,10 @@ final class PhabricatorBuiltinPatchList extends PhabricatorSQLPatchList { 'type' => 'sql', 'name' => $this->getPatchPath('usertranslation.sql'), ), + 'differentialbookmarks.sql' => array( + 'type' => 'sql', + 'name' => $this->getPatchPath('differentialbookmarks.sql'), + ), ); }