]> khamidou — GitHub mirrors - arcanist.git/commitdiff
Detect repo for 'browse'; don't require project ID
authorBen Alpert <spicyjalapeno@gmail.com>
Sun, 9 Feb 2014 16:55:16 +0000 (08:55 -0800)
committerepriestley <git@epriestley.com>
Sun, 9 Feb 2014 16:55:16 +0000 (08:55 -0800)
Test Plan: Ran 'arc browse' in a repo that contains a .arcconfig and one without.

Reviewers: epriestley, #blessed_reviewers

Reviewed By: epriestley

CC: Korvin, epriestley, aran
Differential Revision: https://secure.phabricator.com/D8173

src/workflow/ArcanistBaseWorkflow.php
src/workflow/ArcanistBrowseWorkflow.php

index cb5e27a5dbc15a69152135ac74f8cdaf81d1c9cc..421b04962939e50cade68987735dd4830c1566bc 100644 (file)
@@ -1527,7 +1527,7 @@ abstract class ArcanistBaseWorkflow extends Phobject {
 
   /**
    * Get the PHID of the Phabricator repository this working copy corresponds
-   * to. Returns `null` no repository can be identified.
+   * to. Returns `null` if no repository can be identified.
    *
    * @return phid|null  Repository PHID, or null if no repository can be
    *                    identified.
@@ -1541,7 +1541,7 @@ abstract class ArcanistBaseWorkflow extends Phobject {
 
   /**
    * Get the callsign of the Phabricator repository this working copy
-   * corresponds to. Returns `null` no repository can be identified.
+   * corresponds to. Returns `null` if no repository can be identified.
    *
    * @return string|null  Repository callsign, or null if no repository can be
    *                      identified.
@@ -1553,6 +1553,20 @@ abstract class ArcanistBaseWorkflow extends Phobject {
   }
 
 
+  /**
+   * Get the URI of the Phabricator repository this working copy
+   * corresponds to. Returns `null` if no repository can be identified.
+   *
+   * @return string|null  Repository URI, or null if no repository can be
+   *                      identified.
+   *
+   * @task phabrep
+   */
+  protected function getRepositoryURI() {
+    return idx($this->getRepositoryInformation(), 'uri');
+  }
+
+
   /**
    * Get human-readable reasoning explaining how `arc` evaluated which
    * Phabricator repository corresponds to this working copy. Used by
index 55dfc6137334cacf489982f0c14fcf723d8991d9..e5e13ec01c523066bb0e5c053bcfe129550ad52f 100644 (file)
@@ -108,18 +108,10 @@ EOTEXT
   }
 
   private function getBaseURI() {
-    $conduit = $this->getConduit();
-    $project_id = $this->getWorkingCopy()->getProjectID();
-    $project_info = $this->getConduit()->callMethodSynchronous(
-      'arcanist.projectinfo',
-      array(
-        'name' => $project_id,
-      ));
-
-    $repo_info = $project_info['repository'];
+    $repo_uri = $this->getRepositoryURI();
     $branch = $this->getArgument('branch', 'master');
 
-    return $repo_info['uri'].'browse/'.$branch.'/';
+    return $repo_uri.'browse/'.$branch.'/';
   }
 
   private function getBrowserCommand() {