diff --git a/src/applications/repository/daemon/mercurialpull/PhabricatorRepositoryMercurialPullDaemon.php b/src/applications/repository/daemon/mercurialpull/PhabricatorRepositoryMercurialPullDaemon.php index 1204cd78b8..b1a7a784b1 100644 --- a/src/applications/repository/daemon/mercurialpull/PhabricatorRepositoryMercurialPullDaemon.php +++ b/src/applications/repository/daemon/mercurialpull/PhabricatorRepositoryMercurialPullDaemon.php @@ -1,7 +1,7 @@ getRemoteCommandFuture('pull -u'); $future->setCWD($local_path); - $future->resolvex(); + + try { + $future->resolvex(); + } catch (CommandException $ex) { + $err = $ex->getError(); + $stdout = $ex->getStdOut(); + + // NOTE: Between versions 2.1 and 2.1.1, Mercurial changed the behavior + // of "hg pull" to return 1 in case of a successful pull with no changes. + // This behavior has been reverted, but users who updated between Feb 1, + // 2012 and Mar 1, 2012 will have the erroring version. Do a dumb test + // against stdout to check for this possibility. + // See: https://github.com/facebook/phabricator/issues/101/ + + // NOTE: Mercurial has translated versions, which translate this error + // string. In a translated version, the string will be something else, + // like "aucun changement trouve". There didn't seem to be an easy way + // to handle this (there are hard ways but this is not a common problem + // and only creates log spam, not application failures). Assume English. + + // TODO: Remove this once we're far enough in the future that deployment + // of 2.1 is exceedingly rare? + if ($err == 1 && preg_match('/no changes found/', $stdout)) { + return; + } else { + throw $ex; + } + } + } }