@recaptime-dev's working patches + fork for Phorge, a community fork of Phabricator. (Upstream dev and stable branches are at upstream/main and upstream/stable respectively.) hq.recaptime.dev/wiki/Phorge
phorge phabricator
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

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

+26 -1
+26 -1
src/applications/differential/xaction/DifferentialRevisionUpdateTransaction.php
··· 137 137 continue; 138 138 } 139 139 140 - if ($diff->getRevisionID()) { 140 + $is_attached = ($diff->getRevisionID() == $object->getID()); 141 + if ($is_attached) { 142 + $is_active = ($diff_phid == $object->getActiveDiffPHID()); 143 + } else { 144 + $is_active = false; 145 + } 146 + 147 + if ($is_attached) { 148 + if ($is_active) { 149 + // This is a no-op: we're reattaching the current active diff to the 150 + // revision it is already attached to. This is valid and will just 151 + // be dropped later on in the process. 152 + } else { 153 + // At least for now, there's no support for "undoing" a diff and 154 + // reverting to an older proposed change without just creating a 155 + // new diff from whole cloth. 156 + $errors[] = $this->newInvalidError( 157 + pht( 158 + 'You can not update this revision with the specified diff '. 159 + '("%s") because this diff is already attached to the revision '. 160 + 'as an older version of the change.', 161 + $diff_phid), 162 + $xaction); 163 + continue; 164 + } 165 + } else if ($diff->getRevisionID()) { 141 166 $errors[] = $this->newInvalidError( 142 167 pht( 143 168 'You can not update this revision with the specified diff ("%s") '.