Changeset View
Changeset View
Standalone View
Standalone View
src/repository/api/ArcanistMercurialAPI.php
Show First 20 Lines • Show All 666 Lines • ▼ Show 20 Lines | public function doCommit($message) { | ||||
Filesystem::writeFile($tmp_file, $message); | Filesystem::writeFile($tmp_file, $message); | ||||
$this->execxLocal('commit --logfile %s', $tmp_file); | $this->execxLocal('commit --logfile %s', $tmp_file); | ||||
$this->reloadWorkingCopy(); | $this->reloadWorkingCopy(); | ||||
} | } | ||||
public function amendCommit($message = null) { | public function amendCommit($message = null) { | ||||
$path_statuses = $this->buildUncommittedStatus(); | $path_statuses = $this->buildUncommittedStatus(); | ||||
if ($message === null) { | $existing_message = $this->getCommitMessage( | ||||
$this->getWorkingCopyRevision()); | |||||
if ($message === null || $message == $existing_message) { | |||||
if (empty($path_statuses)) { | if (empty($path_statuses)) { | ||||
// If there are no changes to the working directory and the message is | // If there are no changes to the working directory and the message is | ||||
// not being changed then there's nothing to amend. Notably Mercurial | // not being changed then there's nothing to amend. Notably Mercurial | ||||
// will return an error code if trying to amend a commit with no change | // will return an error code if trying to amend a commit with no change | ||||
// to the commit metadata or file changes. | // to the commit metadata or file changes. | ||||
return; | return; | ||||
} | } | ||||
▲ Show 20 Lines • Show All 578 Lines • Show Last 20 Lines |