Page MenuHomePhabricator

D21344.diff
No OneTemporary

D21344.diff

diff --git a/src/land/engine/ArcanistLandEngine.php b/src/land/engine/ArcanistLandEngine.php
--- a/src/land/engine/ArcanistLandEngine.php
+++ b/src/land/engine/ArcanistLandEngine.php
@@ -1547,7 +1547,7 @@
return $sets;
}
- final protected function newPassthru($pattern /* , ... */) {
+ final protected function newPassthruCommand($pattern /* , ... */) {
$workflow = $this->getWorkflow();
$argv = func_get_args();
@@ -1560,6 +1560,16 @@
$command = $workflow->newCommand($passthru)
->setResolveOnError(true);
+ return $command;
+ }
+
+ final protected function newPassthru($pattern /* , ... */) {
+ $argv = func_get_args();
+
+ $command = call_user_func_array(
+ array($this, 'newPassthruCommand'),
+ $argv);
+
return $command->execute();
}
diff --git a/src/land/engine/ArcanistMercurialLandEngine.php b/src/land/engine/ArcanistMercurialLandEngine.php
--- a/src/land/engine/ArcanistMercurialLandEngine.php
+++ b/src/land/engine/ArcanistMercurialLandEngine.php
@@ -455,18 +455,20 @@
// NOTE: We're using passthru on this because it's a remote command and
// may prompt the user for credentials.
- // TODO: This is fairly silly/confusing to show to users in the common
- // case where it does not require credentials, particularly because the
- // actual command line is full of nonsense.
-
$tmpfile = new TempFile();
Filesystem::remove($tmpfile);
- $err = $this->newPassthru(
+ $command = $this->newPassthruCommand(
'%Ls arc-ls-remote --output %s -- %s',
$api->getMercurialExtensionArguments(),
phutil_string_cast($tmpfile),
$target->getRemote());
+
+ $command->setDisplayCommand(
+ 'hg ls-remote -- %s',
+ $target->getRemote());
+
+ $err = $command->execute();
if ($err) {
throw new Exception(
pht(
diff --git a/src/toolset/command/ArcanistCommand.php b/src/toolset/command/ArcanistCommand.php
--- a/src/toolset/command/ArcanistCommand.php
+++ b/src/toolset/command/ArcanistCommand.php
@@ -6,6 +6,7 @@
private $logEngine;
private $executableFuture;
private $resolveOnError = false;
+ private $displayCommand;
public function setExecutableFuture(PhutilExecutableFuture $future) {
$this->executableFuture = $future;
@@ -34,10 +35,27 @@
return $this->resolveOnError;
}
+ public function setDisplayCommand($pattern /* , ... */) {
+ $argv = func_get_args();
+ $command = call_user_func_array('csprintf', $argv);
+ $this->displayCommand = $command;
+ return $this;
+ }
+
+ public function getDisplayCommand() {
+ return $this->displayCommand;
+ }
+
public function execute() {
$log = $this->getLogEngine();
$future = $this->getExecutableFuture();
- $command = $future->getCommand();
+
+ $display_command = $this->getDisplayCommand();
+ if ($display_command !== null) {
+ $command = $display_command;
+ } else {
+ $command = $future->getCommand();
+ }
$log->writeNewline();

File Metadata

Mime Type
text/plain
Expires
Fri, Nov 22, 5:42 AM (1 h, 34 m)
Storage Engine
blob
Storage Format
Encrypted (AES-256-CBC)
Storage Handle
6717349
Default Alt Text
D21344.diff (2 KB)

Event Timeline