Changeset View
Changeset View
Standalone View
Standalone View
src/repository/api/ArcanistMercurialAPI.php
Show First 20 Lines • Show All 785 Lines • ▼ Show 20 Lines | public function amendCommit($message = null) { | ||||
$tmp_file = new TempFile(); | $tmp_file = new TempFile(); | ||||
Filesystem::writeFile($tmp_file, $message); | Filesystem::writeFile($tmp_file, $message); | ||||
try { | try { | ||||
$this->execxLocal( | $this->execxLocal( | ||||
'commit --amend -l %s', | 'commit --amend -l %s', | ||||
$tmp_file); | $tmp_file); | ||||
} catch (CommandException $ex) { | } catch (CommandException $ex) { | ||||
if (preg_match('/nothing changed/', $ex->getStdOut())) { | if (preg_match('/nothing changed/', $ex->getStdout())) { | ||||
// NOTE: Mercurial considers it an error to make a no-op amend. Although | // NOTE: Mercurial considers it an error to make a no-op amend. Although | ||||
// we generally defer to the underlying VCS to dictate behavior, this | // we generally defer to the underlying VCS to dictate behavior, this | ||||
// one seems a little goofy, and we use amend as part of various | // one seems a little goofy, and we use amend as part of various | ||||
// workflows under the assumption that no-op amends are fine. If this | // workflows under the assumption that no-op amends are fine. If this | ||||
// amend failed because it's a no-op, just continue. | // amend failed because it's a no-op, just continue. | ||||
} else { | } else { | ||||
throw $ex; | throw $ex; | ||||
} | } | ||||
▲ Show 20 Lines • Show All 326 Lines • Show Last 20 Lines |