Mercurial - Patch cannot be decoded


We've been having a problem recently with teamcity and our mercurial repository. Essentially, we're seeing the following error when trying to check for changes and then apply the changes:

stderr: transaction abort!
rollback completed
** unknown exception encountered, please report by visiting
** Python 2.6.6 (r266:84297, Aug 24 2010, 18:13:38) [MSC v.1500 64 bit (AMD64)]
** Mercurial Distributed SCM (version 2.0)
** Extensions loaded:
Traceback (most recent call last):
File "hg", line 38, in <module>
File "mercurial\dispatch.pyc", line 27, in run
File "mercurial\dispatch.pyc", line 64, in dispatch
File "mercurial\dispatch.pyc", line 87, in _runcatch
File "mercurial\dispatch.pyc", line 684, in _dispatch
File "mercurial\dispatch.pyc", line 466, in runcommand
File "mercurial\dispatch.pyc", line 738, in _runcommand
File "mercurial\dispatch.pyc", line 692, in checkargs
File "mercurial\dispatch.pyc", line 681, in <lambda>
File "mercurial\util.pyc", line 454, in check
File "mercurial\commands.pyc", line 4216, in pull
File "mercurial\localrepo.pyc", line 1486, in pull
File "mercurial\localrepo.pyc", line 1900, in addchangegroup
File "mercurial\revlog.pyc", line 1183, in addgroup
File "mercurial\revlog.pyc", line 1045, in _addrevision
File "mercurial\revlog.pyc", line 1011, in builddelta
File "mercurial\revlog.pyc", line 903, in revision
mpatch.mpatchError: patch cannot be decoded

Can anyone shed any light on where I need to look to fix this? I have tried running hg recover on the repository on the build server. One thing I noticed is using the : character in the hg commits around the same time that this started to fail, is this something teamcity can handle?


Comment actions Permalink

Further to this, when I run hg verify in the 'C:\TeamCity\.BuildServer\system\caches\mercurial' folder I am seeing 0 files, 0 changesets, 0 revisions and some 26,000 warnings which all seem to relate to orphan revlog on files that are in the repository.

This is most likely where my issues are coming from. I've ran hg recover on the repository which just reports the warnings again. I will try removing the directory as a whole and report progress.

Comment actions Permalink

OK, this issue was sorted by deleting the cached .hg folder for this particular project in this directory: C:\TeamCity\.BuildServer\system\caches\mercurial

Basically forcing a clean checkout as directed here:


Please sign in to leave a comment.