]> khamidou — GitHub mirrors - arcanist.git/commitdiff
Allow amending revisions without commandeering first
authorMukunda Modell <mmodell@wikimedia.org>
Sat, 9 Apr 2016 16:47:09 +0000 (11:47 -0500)
committerMukunda Modell <mmodell@wikimedia.org>
Sat, 9 Apr 2016 16:57:42 +0000 (11:57 -0500)
Summary:
It is common practice in Wikimedia's projects to amend a contributor's
change without taking over authorship of the change. We found that
the only enforcement of commandeering before amending is in arcanist,
not validated server-side. While it would be fairly straightforward to
maintain this as a patch to arcanist, I thought I would see if upstream
is willing to support making this optional.

With this change, amending without commandeering is enabled by a flag in
`.arcconfig` and it defaults to the old behavior.

For background see [wmf T121751](https://phabricator.wikimedia.org/T121751)

Test Plan:
* ran `arc patch D146` to locally apply a revision that I did not author,
* made a trivial change and amended the commit.
* ran `arc diff --update D146 HEAD^` to send the update to differential
* Saw that https://phabricator.wikimedia.org/D146 updated as it should.

Reviewers: epriestley, #blessed_reviewers

Reviewed By: epriestley, #blessed_reviewers

Subscribers: greggrossmeier, aklapper, Luke081515.2, Korvin, dereckson

Maniphest Tasks: T10584

Differential Revision: https://secure.phabricator.com/D15468

src/workflow/ArcanistDiffWorkflow.php

index 9ffdb049bcd7ccacc94309db502dfb10096f8adb..40a179f14be41d3aaac03e577b0d15a49df63172 100644 (file)
@@ -2529,13 +2529,19 @@ EOTEXT
     $id = $revision['id'];
     $title = $revision['title'];
 
-    throw new ArcanistUsageException(
-      pht(
-        "You don't own revision %s '%s'. You can only update revisions ".
-        "you own. You can 'Commandeer' this revision from the web ".
-        "interface if you want to become the owner.",
-        "D{$id}",
-        $title));
+    $prompt = pht(
+      "You don't own revision %s: \"%s\". Normally, you should ".
+      "only update revisions you own. You can \"Commandeer\" this revision ".
+      "from the web interface if you want to become the owner.\n\n".
+      "Update this revision anyway? [y/N]",
+      "D{$id}",
+      $title);
+
+    $ok = phutil_console_confirm($prompt, $default_no = true);
+    if (!$ok) {
+      throw new ArcanistUsageException(
+        pht('Aborted update of revision: You are not the owner.'));
+    }
   }