]> khamidou — GitHub mirrors - arcanist.git/commitdiff
Deprecate ArcanistBaseWorkflow::getUserGUID in favor of "PHID"
authorepriestley <git@epriestley.com>
Fri, 15 Jul 2011 19:44:03 +0000 (12:44 -0700)
committerepriestley <git@epriestley.com>
Fri, 15 Jul 2011 19:52:17 +0000 (12:52 -0700)
Summary: One day all "GUID" references will be gone, maybe.
Test Plan: grep, ran workflow before changing and got a warning about
deprecation
Reviewed By: aran
Reviewers: mgummelt, tuomaspelkonen, aran, jungejason
CC: aran
Differential Revision: 671

src/workflow/base/ArcanistBaseWorkflow.php
src/workflow/base/__init__.php
src/workflow/commit/ArcanistCommitWorkflow.php
src/workflow/diff/ArcanistDiffWorkflow.php
src/workflow/list/ArcanistListWorkflow.php
src/workflow/mark-committed/ArcanistMarkCommittedWorkflow.php

index 4d9999d75aa898d28dad2512b44137e9202b5e1a..7d0de227bf90ac1b7391252c29e9a535344f867c 100644 (file)
@@ -34,7 +34,7 @@
  * and/or @{method:authenticateConduit} later in a workflow to upgrade it.
  * Once a conduit is open, you can access the client by calling
  * @{method:getConduit}, which allows you to invoke methods. You can get
- * verified information about the user identity by calling @{method:getUserGUID}
+ * verified information about the user identity by calling @{method:getUserPHID}
  * or @{method:getUserName} after authentication occurs.
  *
  * @task  conduit   Conduit
@@ -47,7 +47,7 @@ class ArcanistBaseWorkflow {
   private $conduitCredentials;
   private $conduitAuthenticated;
 
-  private $userGUID;
+  private $userPHID;
   private $userName;
   private $repositoryAPI;
   private $workingCopy;
@@ -175,7 +175,7 @@ class ArcanistBaseWorkflow {
    *    - ##certificate## (required) The Conduit certificate to use.
    *    - ##description## (optional) Description of the invoking command.
    *
-   * Successful authentication allows you to call @{method:getUserGUID} and
+   * Successful authentication allows you to call @{method:getUserPHID} and
    * @{method:getUserName}, as well as use the client you access with
    * @{method:getConduit} to make authenticated calls.
    *
@@ -240,7 +240,7 @@ class ArcanistBaseWorkflow {
     }
 
     $this->userName = $user;
-    $this->userGUID = $connection['userPHID'];
+    $this->userPHID = $connection['userPHID'];
 
     $this->conduitAuthenticated = true;
 
@@ -280,20 +280,29 @@ class ArcanistBaseWorkflow {
   /**
    * Returns the PHID for the user once they've authenticated via Conduit.
    *
-   * NOTE: This method will be deprecated and renamed to ##getUserPHID()## at
-   * some point.
-   *
    * @return phid Authenticated user PHID.
    * @task conduit
    */
-  final public function getUserGUID() {
-    if (!$this->userGUID) {
+  final public function getUserPHID() {
+    if (!$this->userPHID) {
       $workflow = get_class($this);
       throw new Exception(
         "This workflow ('{$workflow}') requires authentication, override ".
         "requiresAuthentication() to return true.");
     }
-    return $this->userGUID;
+    return $this->userPHID;
+  }
+
+  /**
+   * Deprecated. See @{method:getUserPHID}.
+   *
+   * @deprecated
+   */
+  final public function getUserGUID() {
+    phutil_deprecated(
+      'ArcanistBaseWorkflow::getUserGUID',
+      'This method has been renamed to getUserPHID().');
+    return $this->getUserPHID();
   }
 
   /**
@@ -391,8 +400,8 @@ class ArcanistBaseWorkflow {
       $workflow->setRepositoryAPI($this->repositoryAPI);
     }
 
-    if ($this->userGUID) {
-      $workflow->userGUID = $this->getUserGUID();
+    if ($this->userPHID) {
+      $workflow->userPHID = $this->getUserPHID();
       $workflow->userName = $this->getUserName();
     }
 
index 139552c760e53da828f0b9006a90a7f310c07a30..a7a8889fb8afe27c77f1c720d257178271b0b436 100644 (file)
@@ -19,6 +19,7 @@ phutil_require_module('phutil', 'conduit/client');
 phutil_require_module('phutil', 'console');
 phutil_require_module('phutil', 'filesystem');
 phutil_require_module('phutil', 'future/exec');
+phutil_require_module('phutil', 'moduleutils');
 phutil_require_module('phutil', 'utils');
 
 
index e455f1c16d4200a7e6222a5f60ac4d8614117fd7..ab6fb52535908594e7747e74a54d23e191ac09f1 100644 (file)
@@ -73,7 +73,7 @@ EOTEXT
       array(
         'query' => 'committable',
         'guids' => array(
-          $this->getUserGUID(),
+          $this->getUserPHID(),
         ),
       ));
 
index 0f376827a02807a48663ac7730e17ddb267f5203..f5ddd206af5c5208f6fc106e9dc3020b69939c24 100644 (file)
@@ -302,7 +302,7 @@ EOTEXT
       'repositoryUUID'            => $repo_uuid,
       'creationMethod'            => 'arc',
       'arcanistProject'           => $working_copy->getProjectID(),
-      'authorPHID'                => $this->getUserGUID(),
+      'authorPHID'                => $this->getUserPHID(),
     );
 
     $diff_info = $conduit->callMethodSynchronous(
@@ -493,7 +493,7 @@ EOTEXT
         $result = $future->resolve();
         echo "Updated an existing Differential revision:\n";
       } else {
-        $revision['user'] = $this->getUserGUID();
+        $revision['user'] = $this->getUserPHID();
         $future = $conduit->callMethod(
           'differential.createrevision',
           $revision);
@@ -955,7 +955,7 @@ EOTEXT
         if (!phutil_console_confirm($message)) {
           throw new ArcanistUsageException('Specify reviewers and retry.');
         }
-      } else if (in_array($this->getUserGUID(), $reviewers)) {
+      } else if (in_array($this->getUserPHID(), $reviewers)) {
         throw new ArcanistUsageException(
           "You can not be a reviewer for your own revision.");
       }
index 19312b24d95665fcaf58a1e7089ba431064f147f..0ab5fd65612c6027a8b557bad4ab220443a6f0e6 100644 (file)
@@ -52,7 +52,7 @@ EOTEXT
     $revision_future = $conduit->callMethod(
       'differential.find',
       array(
-        'guids' => array($this->getUserGUID()),
+        'guids' => array($this->getUserPHID()),
         'query' => 'open',
       ));
 
index 483de58e4dd91b60a58526daabb7e01ca78d0eb5..8ed7ac8318b22c7cee90f1400095df1806bd538f 100644 (file)
@@ -69,7 +69,7 @@ EOTEXT
       array(
         'query' => 'committable',
         'guids' => array(
-          $this->getUserGUID(),
+          $this->getUserPHID(),
         ),
       ));