mirror of
https://we.phorge.it/source/arcanist.git
synced 2024-11-21 22:32:41 +01:00
Use phutil_passthru() in "arc commit" instead of passthru().
Summary: passthru() doesn't show up on --trace, and one time a while ago someone had an issue which was harder than necessary to debug because the command wasn't avialable in the log. Use the logged version. Also fix a locale issue I ran into on my local machine, with "en_US.utf8" not being a valid locale. Test Plan: Created an SVN repo and used "arc commit" to make commits against it. Reviewed By: jungejason Reviewers: jungejason, tuomaspelkonen, aran CC: aran, epriestley, jungejason Differential Revision: 306
This commit is contained in:
parent
399c505f1a
commit
292c995d57
2 changed files with 30 additions and 3 deletions
|
@ -116,13 +116,14 @@ EOTEXT
|
|||
$message = escapeshellarg($message);
|
||||
$root = escapeshellarg($repository_api->getPath());
|
||||
|
||||
$lang = $this->getSVNLangEnvVar();
|
||||
|
||||
// Specify LANG explicitly so that UTF-8 commit messages don't break
|
||||
// subversion.
|
||||
$command =
|
||||
"(cd {$root} && LANG=en_US.utf8 svn commit {$files} -m {$message})";
|
||||
"(cd {$root} && LANG={$lang} svn commit {$files} -m {$message})";
|
||||
|
||||
$err = null;
|
||||
passthru($command, $err);
|
||||
$err = phutil_passthru('%C', $command);
|
||||
|
||||
if ($err) {
|
||||
throw new Exception("Executing 'svn commit' failed!");
|
||||
|
@ -258,4 +259,29 @@ EOTEXT
|
|||
return array('svn');
|
||||
}
|
||||
|
||||
/**
|
||||
* On some systems, we need to specify "en_US.UTF-8" instead of "en_US.utf8",
|
||||
* and SVN spews some bewildering warnings if we don't:
|
||||
*
|
||||
* svn: warning: cannot set LC_CTYPE locale
|
||||
* svn: warning: environment variable LANG is en_US.utf8
|
||||
* svn: warning: please check that your locale name is correct
|
||||
*
|
||||
* For example, is happens on my 10.6.7 machine with Subversion 1.6.15.
|
||||
*/
|
||||
private function getSVNLangEnvVar() {
|
||||
$locale = 'en_US.utf8';
|
||||
try {
|
||||
list($locales) = execx('locale -a');
|
||||
$locales = explode("\n", trim($locales));
|
||||
$locales = array_fill_keys($locales, true);
|
||||
if (isset($locales['en_US.UTF-8'])) {
|
||||
$locale = 'en_US.UTF-8';
|
||||
}
|
||||
} catch (Exception $ex) {
|
||||
// Ignore.
|
||||
}
|
||||
return $locale;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -13,6 +13,7 @@ phutil_require_module('arcanist', 'workflow/base');
|
|||
|
||||
phutil_require_module('phutil', 'console');
|
||||
phutil_require_module('phutil', 'filesystem');
|
||||
phutil_require_module('phutil', 'future/exec');
|
||||
phutil_require_module('phutil', 'utils');
|
||||
|
||||
|
||||
|
|
Loading…
Reference in a new issue