mirror of
https://we.phorge.it/source/phorge.git
synced 2024-11-25 16:22:43 +01:00
[Phabricator] track Mercurial bookmarks for differential diffs
Summary: This adds all the changes necessary to track the active Mercurial bookmark for differential diffs. We render both branch and bookmark information in the branch field of the Differential revison view, as seen in https://secure.phabricator.com/file/data/kzpmu3evfkukxdjyxrfz/PHID-FILE-eqorsqupxvwirqi2s5lo/bookmark_differential.jpg The Arcanist half of this is https://secure.phabricator.com/D2896 Test Plan: Mostly D2896. Additionally, loaded a diff created with a bookmark, as per the link in the summary. Reviewers: epriestley Reviewed By: epriestley CC: aran, Korvin Maniphest Tasks: T1331 Differential Revision: https://secure.phabricator.com/D2897
This commit is contained in:
parent
f666c3d559
commit
86fa4fd97f
5 changed files with 19 additions and 1 deletions
3
resources/sql/patches/differentialbookmarks.sql
Normal file
3
resources/sql/patches/differentialbookmarks.sql
Normal file
|
@ -0,0 +1,3 @@
|
|||
ALTER TABLE `{$NAMESPACE}_differential`.`differential_diff`
|
||||
ADD `bookmark` VARCHAR(255) COLLATE utf8_general_ci DEFAULT NULL
|
||||
AFTER `branch`;
|
|
@ -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<svn, git>',
|
||||
'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) {
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
||||
|
|
|
@ -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(),
|
||||
|
|
|
@ -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'),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue