Solve hg "abandoned transaction" issue
This commit is contained in:
parent
4aee93d5ce
commit
fa5143c722
1 changed files with 16 additions and 1 deletions
|
@ -93,7 +93,22 @@ HgInfo exportMercurial(ref<Store> store, const std::string & uri,
|
||||||
Activity act(*logger, lvlTalkative, actUnknown, fmt("fetching Mercurial repository '%s'", uri));
|
Activity act(*logger, lvlTalkative, actUnknown, fmt("fetching Mercurial repository '%s'", uri));
|
||||||
|
|
||||||
if (pathExists(cacheDir)) {
|
if (pathExists(cacheDir)) {
|
||||||
runProgram("hg", true, { "pull", "-R", cacheDir, "--", uri });
|
try {
|
||||||
|
runProgram("hg", true, { "pull", "-R", cacheDir, "--", uri });
|
||||||
|
}
|
||||||
|
catch (ExecError & e){
|
||||||
|
string transJournal = cacheDir + "/.hg/store/journal";
|
||||||
|
/* hg throws "abandoned transaction" error only if this file exists */
|
||||||
|
if (pathExists(transJournal))
|
||||||
|
{
|
||||||
|
runProgram("hg", true, { "recover", "-R", cacheDir });
|
||||||
|
runProgram("hg", true, { "pull", "-R", cacheDir, "--", uri });
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
throw ExecError(e.status, fmt("program hg '%1%' ", statusToString(e.status)));
|
||||||
|
}
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
createDirs(dirOf(cacheDir));
|
createDirs(dirOf(cacheDir));
|
||||||
runProgram("hg", true, { "clone", "--noupdate", "--", uri, cacheDir });
|
runProgram("hg", true, { "clone", "--noupdate", "--", uri, cacheDir });
|
||||||
|
|
Loading…
Reference in a new issue