Changeset View
Changeset View
Standalone View
Standalone View
src/workflow/ArcanistCommitWorkflow.php
| Show First 20 Lines • Show All 136 Lines • ▼ Show 20 Lines | public function run() { | ||||
| $revision_title = $revision['title']; | $revision_title = $revision['title']; | ||||
| echo "Committing 'D{$revision_id}: {$revision_title}'...\n"; | echo "Committing 'D{$revision_id}: {$revision_title}'...\n"; | ||||
| $files = $this->getCommitFileList($revision); | $files = $this->getCommitFileList($revision); | ||||
| $tmp_file = new TempFile(); | $tmp_file = new TempFile(); | ||||
| Filesystem::writeFile($tmp_file, $message); | Filesystem::writeFile($tmp_file, $message); | ||||
| $command = csprintf( | $err = $repository_api->execPassthru( | ||||
| 'svn commit %Ls --encoding utf-8 -F %s', | 'commit --encoding utf-8 -F %s -- %Ls', | ||||
| $files, | $tmp_file, | ||||
| $tmp_file); | $files); | ||||
| // make sure to specify LANG on non-windows systems to suppress any fancy | |||||
| // warnings; see @{method:getSVNLangEnvVar}. | |||||
| if (!phutil_is_windows()) { | |||||
| $command = csprintf('LANG=%C %C', $this->getSVNLangEnvVar(), $command); | |||||
| } | |||||
| chdir($repository_api->getPath()); | |||||
| $err = phutil_passthru('%C', $command); | |||||
| if ($err) { | |||||
| throw new Exception("Executing 'svn commit' failed!"); | |||||
| } | |||||
| $mark_workflow = $this->buildChildWorkflow( | $mark_workflow = $this->buildChildWorkflow( | ||||
| 'close-revision', | 'close-revision', | ||||
| array( | array( | ||||
| '--finalize', | '--finalize', | ||||
| $revision_id, | $revision_id, | ||||
| )); | )); | ||||
| $mark_workflow->run(); | $mark_workflow->run(); | ||||
| ▲ Show 20 Lines • Show All 98 Lines • ▼ Show 20 Lines | if (!phutil_console_confirm($prompt)) { | ||||
| throw new ArcanistUserAbortException(); | throw new ArcanistUserAbortException(); | ||||
| } | } | ||||
| } | } | ||||
| protected function getSupportedRevisionControlSystems() { | protected function getSupportedRevisionControlSystems() { | ||||
| return array('svn'); | 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, it happens on epriestley's Mac (10.6.7) 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; | |||||
| } | |||||
| 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']; | ||||
| $revision_title = $revision['title']; | $revision_title = $revision['title']; | ||||
| $confirm = array(); | $confirm = array(); | ||||
| if ($revision['status'] != ArcanistDifferentialRevisionStatus::ACCEPTED) { | if ($revision['status'] != ArcanistDifferentialRevisionStatus::ACCEPTED) { | ||||
| Show All 28 Lines | |||||