Page MenuHomePhabricator

Fork_of_P1051_no_op.diff

Authored By
richardvanvelzen
Jan 28 2014, 8:30 AM
Size
1 KB
Referenced Files
None
Subscribers
None

Fork_of_P1051_no_op.diff

diff --git a/src/repository/api/ArcanistMercurialAPI.php b/src/repository/api/ArcanistMercurialAPI.php
index 3ece7d9..44f3489 100644
--- a/src/repository/api/ArcanistMercurialAPI.php
+++ b/src/repository/api/ArcanistMercurialAPI.php
@@ -750,9 +750,23 @@ final class ArcanistMercurialAPI extends ArcanistRepositoryAPI {
$tmp_file = new TempFile();
Filesystem::writeFile($tmp_file, $message);
- $this->execxLocal(
- 'commit --amend -l %s',
- $tmp_file);
+
+ try {
+ $this->execxLocal(
+ 'commit --amend -l %s',
+ $tmp_file);
+ } catch (Exception $ex) {
+ if (preg_match('/nothing changed/', $ex->getStdOut())) {
+ // NOTE: Mercurial considers it an error to make a no-op amend. Although
+ // we generally defer to the underlying VCS to dictate behavior, this
+ // 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
+ // amend failed because it's a no-op, just continue.
+ } else {
+ throw $ex;
+ }
+ }
+
$this->reloadWorkingCopy();
}

File Metadata

Mime Type
text/plain; charset=utf-8
Storage Engine
amazon-s3
Storage Format
Raw Data
Storage Handle
phabricator/rs/3r/2cxmsnlxa5gnoryj
Default Alt Text
Fork_of_P1051_no_op.diff (1 KB)

Event Timeline