1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2024-12-23 22:10:55 +01:00

Make updating a revision with the same active diff a no-op

Summary: Ref T13114. See PHI515. Updating a revision with the same, currently active diff became an error at some point (probably D19175). This is inconsistent; make it an allowable no-op instead.

Test Plan:
  - Updated a revision's diff via Conduit.
  - Updated to the same diff, no-op.
  - Tried to update a different revision, error ("already attached elsewhere").
  - Updated with a different diff.
  - Tried to update with the original diff, error ("previously attached version").

Maniphest Tasks: T13114

Differential Revision: https://secure.phabricator.com/D19267
This commit is contained in:
epriestley 2018-03-29 09:51:18 -07:00
parent 74216ea8e0
commit 93cb6e3bde

View file

@ -137,7 +137,32 @@ final class DifferentialRevisionUpdateTransaction
continue; continue;
} }
if ($diff->getRevisionID()) { $is_attached = ($diff->getRevisionID() == $object->getID());
if ($is_attached) {
$is_active = ($diff_phid == $object->getActiveDiffPHID());
} else {
$is_active = false;
}
if ($is_attached) {
if ($is_active) {
// This is a no-op: we're reattaching the current active diff to the
// revision it is already attached to. This is valid and will just
// be dropped later on in the process.
} else {
// At least for now, there's no support for "undoing" a diff and
// reverting to an older proposed change without just creating a
// new diff from whole cloth.
$errors[] = $this->newInvalidError(
pht(
'You can not update this revision with the specified diff '.
'("%s") because this diff is already attached to the revision '.
'as an older version of the change.',
$diff_phid),
$xaction);
continue;
}
} else if ($diff->getRevisionID()) {
$errors[] = $this->newInvalidError( $errors[] = $this->newInvalidError(
pht( pht(
'You can not update this revision with the specified diff ("%s") '. 'You can not update this revision with the specified diff ("%s") '.