mirror of
https://we.phorge.it/source/phorge.git
synced 2025-01-31 08:58:20 +01:00
Fix "arc diff --verbatim" when updating a revision
Summary: Fixes T4601. The "Differential Revision" field needs to be present in the "editable" version of the message so that `--verbatim` works correctly. Some day all of this might get rewritten to be a little easier to follow, maybe, but keep things working properly for now. Test Plan: Used `arc diff`, `arc diff --edit`, `arc diff --verbatim` Reviewers: btrahan Reviewed By: btrahan Subscribers: aran, epriestley Maniphest Tasks: T4601 Differential Revision: https://secure.phabricator.com/D8526
This commit is contained in:
parent
c7079b52a2
commit
ab117c2baf
1 changed files with 11 additions and 5 deletions
|
@ -3,6 +3,8 @@
|
||||||
final class DifferentialRevisionIDField
|
final class DifferentialRevisionIDField
|
||||||
extends DifferentialCustomField {
|
extends DifferentialCustomField {
|
||||||
|
|
||||||
|
private $revisionID;
|
||||||
|
|
||||||
public function getFieldKey() {
|
public function getFieldKey() {
|
||||||
return 'differential:revision-id';
|
return 'differential:revision-id';
|
||||||
}
|
}
|
||||||
|
@ -29,16 +31,20 @@ final class DifferentialRevisionIDField
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function shouldAllowEditInCommitMessage() {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
public function parseValueFromCommitMessage($value) {
|
public function parseValueFromCommitMessage($value) {
|
||||||
return self::parseRevisionIDFromURI($value);
|
return self::parseRevisionIDFromURI($value);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function renderCommitMessageValue(array $handles) {
|
public function renderCommitMessageValue(array $handles) {
|
||||||
return PhabricatorEnv::getProductionURI('/D'.$this->getObject()->getID());
|
$id = coalesce($this->revisionID, $this->getObject()->getID());
|
||||||
|
if (!$id) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
return PhabricatorEnv::getProductionURI('/D'.$id);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function readValueFromCommitMessage($value) {
|
||||||
|
$this->revisionID = $value;
|
||||||
}
|
}
|
||||||
|
|
||||||
private static function parseRevisionIDFromURI($uri) {
|
private static function parseRevisionIDFromURI($uri) {
|
||||||
|
|
Loading…
Add table
Reference in a new issue