1
0
Fork 0
mirror of https://we.phorge.it/source/arcanist.git synced 2024-11-22 14:52:40 +01:00

Support an 'editor' config in arc

Summary: See D2955. Allow "arc set-config editor ..." to override all other editor settings.

Test Plan: Ran "arc set-config editor 'mate -w'", am typing this in textmate.

Reviewers: btrahan, ezfoxie

Reviewed By: btrahan

CC: aran

Maniphest Tasks: T1309

Differential Revision: https://secure.phabricator.com/D2956
This commit is contained in:
epriestley 2012-07-11 16:55:11 -07:00
parent 1f65a115cc
commit 1b4205c1a1
3 changed files with 15 additions and 4 deletions

View file

@ -1276,4 +1276,15 @@ abstract class ArcanistBaseWorkflow {
return $value; return $value;
} }
protected function newInteractiveEditor($text) {
$editor = new PhutilInteractiveEditor($text);
$preferred = $this->getWorkingCopy()->getConfigFromAnySource('editor');
if ($preferred) {
$editor->setPreferredEditor($preferred);
}
return $editor;
}
} }

View file

@ -447,7 +447,7 @@ EOTEXT
$should_edit = $this->getArgument('edit'); $should_edit = $this->getArgument('edit');
if ($should_edit) { if ($should_edit) {
$remote_corpus = id(new PhutilInteractiveEditor($remote_corpus)) $remote_corpus = $this->newInteractiveEditor($remote_corpus)
->setName('differential-edit-revision-info') ->setName('differential-edit-revision-info')
->editInteractively(); ->editInteractively();
} }
@ -1412,7 +1412,7 @@ EOTEXT
if ($first && $this->getArgument('verbatim') && !$template_is_default) { if ($first && $this->getArgument('verbatim') && !$template_is_default) {
$new_template = $template; $new_template = $template;
} else { } else {
$new_template = id(new PhutilInteractiveEditor($template)) $new_template = $this->newInteractiveEditor($template)
->setName('new-commit') ->setName('new-commit')
->editInteractively(); ->editInteractively();
} }
@ -1599,7 +1599,7 @@ EOTEXT
"# $ arc diff --create\n". "# $ arc diff --create\n".
"\n"; "\n";
$comments = id(new PhutilInteractiveEditor($template)) $comments = $this->newInteractiveEditor($template)
->setName('differential-update-comments') ->setName('differential-update-comments')
->editInteractively(); ->editInteractively();

View file

@ -658,7 +658,7 @@ EOTEXT
$prompt_message. $prompt_message.
"\n"; "\n";
$commit_message = id(new PhutilInteractiveEditor($template)) $commit_message = $this->newInteractiveEditor($template)
->setName('arcanist-patch-commit-message') ->setName('arcanist-patch-commit-message')
->editInteractively(); ->editInteractively();