how to run hg recover command on a remote repository

sam picture sam · Mar 18, 2013 · Viewed 7.9k times · Source

I am getting the following error while running build in teamcity.

Failed to collect changes, error: '"C:\Program Files\TortoiseHg\hg.exe" --config ui.interactive=False pull https://test:******@hg.myrepo.co.uk/terriff' command failed.
stdout: pulling from https://test:***@hg.myrepo.co.uk/terriff
searching for changes

stderr: abort: abandoned transaction found - run hg recover!

I already tried to delete the build directories on agent machines but still getting same error. Also tried to run hg recover command but it says repository is not local. Please guide how to fix this error.

Answer

ivan.mylyanyk picture ivan.mylyanyk · Jun 2, 2015

I have the same issue, because my hg folder was missing from the repository folder. I managed to fix it running hg recover on the cached version of the repository. You can find the cached repository at the following directory:

..\ProgramData\JetBrains\TeamCity\system\caches\mercurial

You should see a few folders with the names like hg_7282240431393414416 and a file map(with no extension) at that folder. There are mappings from repository to folders stored in this file. The file contains a few lines like:

https://bitbucket.org/{teamname1}/{repo1}/ = hg_7282240431393414416
https://bitbucket.org/{teamname1}/{repo2}/ = hg_7282240431393414417
https://bitbucket.org/{teamname2}/{repo3}/ = hg_7282240431393414418

You have to find the folder corresponding to your repository(after the equation sign) in this map file and run hg recover in that corresponding folder. Running this command may take some time.

Please, note: team names, repositories and folder names are for demonstration only.

I hope it will help!