MercurialException: The executable did not complete within the allotted time


This doesn't happen all the time, but when it does it breaks our build. I don't know what causes it to happen when it does. Here is the relevant code:
var Repo = new Mercurial.Repository(RepoPath);
var Since = DateTime.Now.AddHours(-1);
var Commits = Repo.Log().Where(x => x.Timestamp > Since).ToList();
It fails on the third line. I found an issue from last year relating to this exception but his code wasn't relevant and I can't seem to find any way to set a timeout in my code. Also the solution provided seems like more of a work-around. Should it really be taking this long?


lassevk wrote Feb 18, 2013 at 4:36 PM

Well, it depends on how long it takes for that command to complete.

If you run that command, ie. the "log" command, against that repository, approximately how long does it take to complete?

There is a timeout property you can set if the preset timeout is not enough, but typically it will be enough but for large repositorities with complex branch histories, it may take longer.

theyshookhands wrote Feb 20, 2013 at 3:12 PM

I doubled the timeout property this morning and it worked on my test run. I'll have to wait and see what happens this evening (which is when it is actually run). We are using Jenkins, so I have it set up so when Jenkins does its hourly build it runs an app the check the commits and update our Trello boards. When I run this code on my local machine, it seems to find the commits within seconds, without any problem. When run on our devserver (which is where Jenkins and our main repositories are located), it looks like it takes a lot more time to find the same commits. I don't know if this is something on our end or not.

Also, our repository is not complex but is a little bit large.

theyshookhands wrote Mar 14, 2014 at 6:51 PM

I am still having an issue with this, more so than before. It times out nearly every time. I have upped the timeout to 240. We have 1400 commits in our repository. The following code
var Repo = new Mercurial.Repository(@"C:\Repositories\GreenField");
Repo.Log(new Mercurial.LogCommand().WithTimeout(1000));
takes 332.9 seconds or over 5 minutes to run.

Is there not a way to just load the most recent commits? I am really only trying to load commits made within the last hour.