1
0
Fork 0
mirror of https://we.phorge.it/source/arcanist.git synced 2024-11-10 08:52:39 +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:
Bob Trahan 2012-10-03 14:54:43 -07:00
parent d83a884a91
commit 383fb42ba8

View file

@ -153,17 +153,17 @@ EOTEXT
$files = $this->getCommitFileList($revision);
$files = implode(' ', array_map('escapeshellarg', $files));
$message = escapeshellarg($message);
$root = escapeshellarg($repository_api->getPath());
$tmp_file = new TempFile();
Filesystem::writeFile($tmp_file, $message);
$lang = $this->getSVNLangEnvVar();
$command = $this->getSVNCommitCommand();
chdir($repository_api->getPath());
// Specify LANG explicitly so that UTF-8 commit messages don't break
// subversion.
$command = "(cd {$root} && LANG={$lang} svn commit {$files} -m {$message})";
$err = phutil_passthru('%C', $command);
$err = phutil_passthru(
$command,
$files,
$tmp_file
);
if ($err) {
throw new Exception("Executing 'svn commit' failed!");
@ -289,7 +289,8 @@ EOTEXT
* 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.
* For example, it happens on epriestley's Mac (10.6.7) with
* Subversion 1.6.15.
*/
private function getSVNLangEnvVar() {
$locale = 'en_US.utf8';
@ -306,6 +307,16 @@ EOTEXT
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) {
$repository_api = $this->getRepositoryAPI();
$revision_id = $revision['id'];