Skip to content

Commit

Permalink
watchman: pass --traceback when calling Mercurial
Browse files Browse the repository at this point in the history
Summary:
This updates Watchman to pass `--traceback` when it calls Mercurial. This
should make it easier to understand what failed if we get a Mercurial error
reported in Watchman.

Reviewed By: farnz

Differential Revision: D19409201

fbshipit-source-id: efe489b692be646bbfc96d807a2058d78a041003
  • Loading branch information
krallin authored and facebook-github-bot committed Jan 15, 2020
1 parent 404cc3f commit ce8a810
Showing 1 changed file with 22 additions and 3 deletions.
25 changes: 22 additions & 3 deletions scm/Mercurial.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -193,7 +193,13 @@ std::vector<w_string> Mercurial::getFilesChangedSinceMergeBaseWith(
// The "" argument at the end causes paths to be printed out relative to the
// cwd (set to root path above).
ChildProcess proc(
{hgExecutablePath(), "status", "-n", "--rev", commitId, ""},
{hgExecutablePath(),
"--traceback",
"status",
"-n",
"--rev",
commitId,
""},
makeHgOptions(requestId));

auto outputs = proc.communicate();
Expand Down Expand Up @@ -225,6 +231,7 @@ SCM::StatusResult Mercurial::getFilesChangedBetweenCommits(
// relative to the cwd (set to root path above).
ChildProcess proc(
{hgExecutablePath(),
"--traceback",
"status",
"--print0",
"--rev",
Expand Down Expand Up @@ -276,7 +283,13 @@ time_point<system_clock> Mercurial::getCommitDate(
w_string_piece commitId,
w_string requestId) const {
ChildProcess proc(
{hgExecutablePath(), "log", "-r", commitId.data(), "-T", "{date}\n"},
{hgExecutablePath(),
"--traceback",
"log",
"-r",
commitId.data(),
"-T",
"{date}\n"},
makeHgOptions(requestId));
auto outputs = proc.communicate();
auto status = proc.wait();
Expand Down Expand Up @@ -308,7 +321,13 @@ std::vector<w_string> Mercurial::getCommitsPriorToAndIncluding(
auto revset = to<std::string>(
"reverse(last(_firstancestors(", commitId, "), ", numCommits, "))\n");
ChildProcess proc(
{hgExecutablePath(), "log", "-r", revset, "-T", "{node}\n"},
{hgExecutablePath(),
"--traceback",
"log",
"-r",
revset,
"-T",
"{node}\n"},
makeHgOptions(requestId));
auto outputs = proc.communicate();
auto status = proc.wait();
Expand Down

0 comments on commit ce8a810

Please sign in to comment.