]> khamidou — GitHub mirrors - arcanist.git/commitdiff
T4670 Remove the any-author flag from the which command, make any-author the default...
authorGabriel Guzman <gabriel.guzman@gammaemail.com>
Thu, 3 Apr 2014 18:28:24 +0000 (11:28 -0700)
committerepriestley <git@epriestley.com>
Thu, 3 Apr 2014 18:30:38 +0000 (11:30 -0700)
Summary: Remove any-author flag from 'arc which' make any-author be the default behavior.  Annotate revision with the owners username.

Test Plan:
Apply a patch that you don't own (arc patch Dxxx) run 'arc which' verify that:
   1. You see the revision
   2. You see the original authors username next to the revision (owned by sjobs) etc.

Reviewers: epriestley, #blessed_reviewers

Reviewed By: epriestley, #blessed_reviewers

Subscribers: epriestley, Korvin

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

src/workflow/ArcanistWhichWorkflow.php

index 604b515c4da9e9c103d6857923774bfaa7e933aa..0f74c80273051482b7b1ba7445020b45c1f28f29 100644 (file)
@@ -43,9 +43,6 @@ EOTEXT
 
   public function getArguments() {
     return array(
-      'any-author' => array(
-        'help' => "Show revisions by any author, not just you.",
-      ),
       'any-status' => array(
         'help' => "Show committed and abandoned revisions.",
       ),
@@ -138,13 +135,9 @@ EOTEXT
       echo $commits."\n\n\n";
     }
 
-    $any_author = $this->getArgument('any-author');
     $any_status = $this->getArgument('any-status');
 
     $query = array(
-      'authors' => $any_author
-        ? null
-        : array($this->getUserPHID()),
       'status' => $any_status
         ? 'status-any'
         : 'status-open',
@@ -169,8 +162,34 @@ EOTEXT
           "working copy, a new revision will be **created** if you run ".
           "'arc diff{$arg}'.\n\n"));
     } else {
+      $other_author_phids = array();
       foreach ($revisions as $revision) {
-        echo '    D'.$revision['id'].' '.$revision['title']."\n";
+        if ($revision['authorPHID'] != $this->getUserPHID()) {
+          $other_author_phids[] = $revision['authorPHID'];
+        }
+      }
+
+      $other_authors = array();
+      if ($other_author_phids) {
+        $other_authors = $this->getConduit()->callMethodSynchronous(
+          'user.query',
+          array(
+            'phids' => $other_author_phids,
+          ));
+        $other_authors = ipull($other_authors, 'userName', 'phid');
+      }
+
+      foreach ($revisions as $revision) {
+        $title = $revision['title'];
+        $monogram = 'D'.$revision['id'];
+
+        if ($revision['authorPHID'] != $this->getUserPHID()) {
+          $author = $other_authors[$revision['authorPHID']];
+          echo pht("    %s (%s) %s\n", $monogram, $author, $title);
+        } else {
+          echo pht("    %s %s\n", $monogram, $title);
+        }
+
         echo '        Reason: '.$revision['why']."\n";
         echo "\n";
       }