mirror of
https://we.phorge.it/source/arcanist.git
synced 2024-11-26 08:42:40 +01:00
make arc commit work on windows with multiline messages
Summary: cd && cmd won't work so use chdir; -m $multiline_message won't work so use -F $tmp_file Test Plan: this is actually un-tested at the moment. Reviewers: epriestley Reviewed By: epriestley CC: aran, Korvin Maniphest Tasks: T1617 Differential Revision: https://secure.phabricator.com/D3592
This commit is contained in:
parent
d83a884a91
commit
383fb42ba8
1 changed files with 21 additions and 10 deletions
|
@ -153,17 +153,17 @@ EOTEXT
|
||||||
|
|
||||||
$files = $this->getCommitFileList($revision);
|
$files = $this->getCommitFileList($revision);
|
||||||
|
|
||||||
$files = implode(' ', array_map('escapeshellarg', $files));
|
$tmp_file = new TempFile();
|
||||||
$message = escapeshellarg($message);
|
Filesystem::writeFile($tmp_file, $message);
|
||||||
$root = escapeshellarg($repository_api->getPath());
|
|
||||||
|
|
||||||
$lang = $this->getSVNLangEnvVar();
|
$command = $this->getSVNCommitCommand();
|
||||||
|
chdir($repository_api->getPath());
|
||||||
|
|
||||||
// Specify LANG explicitly so that UTF-8 commit messages don't break
|
$err = phutil_passthru(
|
||||||
// subversion.
|
$command,
|
||||||
$command = "(cd {$root} && LANG={$lang} svn commit {$files} -m {$message})";
|
$files,
|
||||||
|
$tmp_file
|
||||||
$err = phutil_passthru('%C', $command);
|
);
|
||||||
|
|
||||||
if ($err) {
|
if ($err) {
|
||||||
throw new Exception("Executing 'svn commit' failed!");
|
throw new Exception("Executing 'svn commit' failed!");
|
||||||
|
@ -289,7 +289,8 @@ EOTEXT
|
||||||
* svn: warning: environment variable LANG is en_US.utf8
|
* svn: warning: environment variable LANG is en_US.utf8
|
||||||
* svn: warning: please check that your locale name is correct
|
* 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.
|
* For example, it happens on epriestley's Mac (10.6.7) with
|
||||||
|
* Subversion 1.6.15.
|
||||||
*/
|
*/
|
||||||
private function getSVNLangEnvVar() {
|
private function getSVNLangEnvVar() {
|
||||||
$locale = 'en_US.utf8';
|
$locale = 'en_US.utf8';
|
||||||
|
@ -306,6 +307,16 @@ EOTEXT
|
||||||
return $locale;
|
return $locale;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private function getSVNCommitCommand() {
|
||||||
|
$command = 'svn commit %Ls --encoding utf-8 -F %s';
|
||||||
|
// make sure to specify LANG on non-windows systems to surpress any fancy
|
||||||
|
// warnings; see @{method:getSVNLangEnvVar}.
|
||||||
|
if (!phutil_is_windows()) {
|
||||||
|
$command = 'LANG='.$this->getSVNLangEnvVar().' '.$command;
|
||||||
|
}
|
||||||
|
return $command;
|
||||||
|
}
|
||||||
|
|
||||||
private function runSanityChecks(array $revision) {
|
private function runSanityChecks(array $revision) {
|
||||||
$repository_api = $this->getRepositoryAPI();
|
$repository_api = $this->getRepositoryAPI();
|
||||||
$revision_id = $revision['id'];
|
$revision_id = $revision['id'];
|
||||||
|
|
Loading…
Reference in a new issue