Cannot clone

Peter Hvidgaard's Avatar

Peter Hvidgaard

11 Jan, 2016 09:36 AM

I cam evaluating the latest version of HgLab, and so far have converted our repository, pushed it, and I'm trying to clone it again. I however get an error:

PS C:\Users\Peter Hvidgaard\Documents\Repo> hg clone http://username@server/hglab/hg/ff/repo
http authorization required for http://server/hglab/hg/ff/repo
realm: IMS Repositories
user: username
destination directory: repo
requesting all changes
adding changesets
adding manifests
adding file changes
transaction abort!
rollback completed
abort: stream ended unexpectedly (got 24797032 bytes, expected 1668480940)

I have disabled LAN optimizations as it gave a different error. What caught my eye, is expected 1668480940, that is 1.55GiB, and I have no such files. The repository on the machine I pushed from is ~664MiB, including the .hg directory of 314MiB.

Do I need to change something or is it a bug?

  1. Support Staff 1 Posted by Anton Gogolev on 12 Jan, 2016 06:40 AM

    Anton Gogolev's Avatar

    Hello, Peter.

    Could you please run

        hg verify

    for the repository on the server and post the output here?

  2. 2 Posted by Peter Hvidgaard on 12 Jan, 2016 08:51 AM

    Peter Hvidgaard's Avatar

    That is odd. When I run hg verify on the local repo, it checks without error. If I run the same I get a bunch of error about missing files (warning: revlog ‘file’ not in fncache!). All of those files have been renamed from something like “Bilagsmærke.cs” to “Bilagsmærke.cs”, and the changeset performing this is present when running hg log -l 10. The naming errors happened during the conversion from a git repository.

    Running a hg debugrebuildfncache did not help, however, I deleted the repo, pushed it again, and ran hf verify. This time around it produced the same warning for each and every file in the repo. Trying to clone anyway, produce

    destination directory: fakturaflow
    requesting all changes
    adding changesets
    adding manifests
    adding file changes
    transaction abort!
    rollback completed
    abort: stream ended unexpectedly (got 0 bytes, expected 4)

    After a hg debugrebuildfncache again, hg verify produce similar output to the original repo, and cloning is still not possible. If I copy the .hg to the server manually, it’s still not possible to clone. I can clone locally without problem, so I assume I have encountered a hglab bug.

    Fra: Anton Gogolev [mailto:[email blocked]]
    Sendt: 12. januar 2016 07:41
    Til: Peter Hvidgaard <[email blocked]>
    Emne: Re: Cannot clone [Problems #898]

  3. Support Staff 3 Posted by Anton Gogolev on 12 Jan, 2016 03:07 PM

    Anton Gogolev's Avatar


    Looks like a bug indeed. Could you please prepare a tiny repro case? I'd
    like you to basically create a repository with two commits: first one
    adding Bilagsmærke.cs and second one renaming it to Bilagsmærke.cs. I'd
    rather this repository came from your system.

    And while we're at it, try changing the Encoding (Administration -
    Repositories) to your "local" code page (
    ) and try cloning the repository again.

  4. 4 Posted by Peter Hvidgaard on 13 Jan, 2016 08:06 AM

    Peter Hvidgaard's Avatar

    I have attached a repo case. I set hglab repo codepage to UTF-8, push the initial repo, and then I cannot clone it, and hg verify fails. An odd thing is that hglab correctly display the filename, even though it is displayed wrong on my system. I have attached a snip showing it. Then if I try to change the hglab codepage to 28591 (Western European(ISO)), it fails with the following error when I browse to the file

    System.NullReferenceException: Object reference not set to an instance of an object.
       at HgLab.Areas.Project.Controllers.RepositoryController.<>c__DisplayClass29.<Files>b__14(HgManifestNode f) in d:\projects\hglab\src\HgLab\Areas\Project\Controllers\RepositoryController.cs:line 252
       at System.Linq.Enumerable.ToDictionary[TSource,TKey,TElement](IEnumerable`1 source, Func`2 keySelector, Func`2 elementSelector, IEqualityComparer`1 comparer)
       at HgLab.Areas.Project.Controllers.RepositoryController.Files(MainlineRepository repository, String changeset, String path) in d:\projects\hglab\src\HgLab\Areas\Project\Controllers\RepositoryController.cs:line 251
       at lambda_method(Closure , ControllerBase , Object[] )
       at System.Web.Mvc.ActionMethodDispatcher.Execute(ControllerBase controller, Object[] parameters)
       at System.Web.Mvc.ReflectedActionDescriptor.Execute(ControllerContext controllerContext, IDictionary`2 parameters)
       at System.Web.Mvc.ControllerActionInvoker.InvokeActionMethod(ControllerContext controllerContext, ActionDescriptor actionDescriptor, IDictionary`2 parameters)
       at System.Web.Mvc.ControllerActionInvoker.<>c__DisplayClass15.<InvokeActionMethodWithFilters>b__12()
       at System.Web.Mvc.ControllerActionInvoker.InvokeActionMethodFilter(IActionFilter filter, ActionExecutingContext preContext, Func`1 continuation)
       at System.Web.Mvc.ControllerActionInvoker.<>c__DisplayClass15.<>c__DisplayClass17.<InvokeActionMethodWithFilters>b__14()
       at System.Web.Mvc.ControllerActionInvoker.InvokeActionMethodFilter(IActionFilter filter, ActionExecutingContext preContext, Func`1 continuation)
       at System.Web.Mvc.ControllerActionInvoker.<>c__DisplayClass15.<>c__DisplayClass17.<InvokeActionMethodWithFilters>b__14()
       at System.Web.Mvc.ControllerActionInvoker.InvokeActionMethodWithFilters(ControllerContext controllerContext, IList`1 filters, ActionDescriptor actionDescriptor, IDictionary`2 parameters)
       at System.Web.Mvc.ControllerActionInvoker.InvokeAction(ControllerContext controllerContext, String actionName)
       at System.Web.Mvc.Controller.ExecuteCore()
       at System.Web.Mvc.ControllerBase.Execute(RequestContext requestContext)
       at HgLab.Core.Framework.Web.HgLabControllerBase.Execute(RequestContext requestContext) in d:\projects\hglab\src\HgLab.Core\Framework\Web\HgLabControllerBase.cs:line 100
       at System.Web.Mvc.ControllerBase.System.Web.Mvc.IController.Execute(RequestContext requestContext)
       at System.Web.Mvc.MvcHandler.<>c__DisplayClass6.<>c__DisplayClassb.<BeginProcessRequest>b__5()
       at System.Web.Mvc.Async.AsyncResultWrapper.<>c__DisplayClass1.<MakeVoidDelegate>b__0()
       at System.Web.Mvc.Async.AsyncResultWrapper.<>c__DisplayClass8`1.<BeginSynchronous>b__7(IAsyncResult _)
       at System.Web.Mvc.Async.AsyncResultWrapper.WrappedAsyncResult`1.End()
       at System.Web.Mvc.MvcHandler.<>c__DisplayClasse.<EndProcessRequest>b__d()
       at System.Web.Mvc.SecurityUtil.<GetCallInAppTrustThunk>b__0(Action f)
       at System.Web.Mvc.SecurityUtil.ProcessInApplicationTrust(Action action)
       at System.Web.Mvc.MvcHandler.EndProcessRequest(IAsyncResult asyncResult)
       at System.Web.Mvc.MvcHandler.System.Web.IHttpAsyncHandler.EndProcessRequest(IAsyncResult result)
       at System.Web.HttpApplication.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute()
       at System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously)

    but cloning is possible! Creating a new repo, while the encoding is set to 28591, I can also clone. However in both cases hg verify fails on the server, yet runs successful locally after the clone.

    The files are all saved in UTF8, yet it seems that the filenames are in whatever local code page there is set.

    Best regards.

    Fra: Anton Gogolev [mailto:[email blocked]]
    Sendt: 12. januar 2016 16:08
    Til: Peter Hvidgaard <[email blocked]>
    Emne: Re: Cannot clone [Problems #898]

  5. 5 Posted by Peter Hvidgaard on 21 Jan, 2016 01:52 PM

    Peter Hvidgaard's Avatar

    Is there any status update on this. I'm not exactly confident about using hglabs for our production code as it is right now.

  6. Support Staff 6 Posted by Anton Gogolev on 28 Jan, 2016 12:17 PM

    Anton Gogolev's Avatar


    Apologies for the long delay. I still cannot make heads or tails of this
    whole encoding mess. I was able to reproduce the behavior you are
    describing, but cannot find a reliable way out.

  7. 7 Posted by Peter on 03 Feb, 2016 08:15 AM

    Peter's Avatar

    I've been digging and it's apparently because of how Mercurial treat file names. To Mercurial a file name is just a binary string, it doesn't consider any encoding or the like. So during the git -> hg convert operation, it fails because it reads the file name and expect it to be in UTF8 (I believe), when it isn't. I'm not familiar with the Mercurial codebase, but it shouldn't be that hard to implement a setting of what encoding to use for interpreting filenames and then convert the strings to UTF8 (or whatever encoding it uses internally). Unfortunately I will not be able to sit down and do that for a few weeks, so for now I think I'll resort to simply rename all offending files and reconvert.

  8. 8 Posted by Peter on 03 Feb, 2016 01:51 PM

    Peter's Avatar

    I've finished the renaming operation and tried again. The push to the server feels odd, as it states it has 850mb to push, but stops around 400mb, and after a while instantly completes.

    When running hg verify on the server I see the same (warning: revlog ‘’ not in fncache!). for 3 files. After deleting the fncache and running the rebuild command it still produce the warning. I can however clone and the clone seems to work as intented, and hg verify completes without error on the newly cloned repo.

    The odd thing is that the files in question is not present on the source repo, yet it magically appear on the server after it has been pushed. E.g. the file "_resources.da._designer.cs.i" is in the .hg/store/ folder, but after a push to the server, the server repo contains "_resources.da._designer.cs.i" and "_resources.da._designer.cs.d" and it complains about the .d version missing from the fncache.

    If I push to source repo to another local empty repo, using hg, it completes correctly, so something in hgsharp is behaving differently from the official client. I don't know exactly what the warning means, or if it can safely be ignored.

  9. 9 Posted by Peter on 04 Feb, 2016 07:39 AM

    Peter's Avatar

    I forgot to say, when I clone locally from the source repo, or clone from the repo on hglab server, they produce the same working directory. Excluding the .hg folder, all the files produce the exact same SHA-256 hash, so I am at least somewhat confident that hglab works as intended.

Reply to this discussion

Internal reply

Formatting help / Preview (switch to plain text) No formatting (switch to Markdown)

Attaching KB article:


Attached Files

You can attach files up to 10MB

If you don't have an account yet, we need to confirm you're human and not a machine trying to post spam.

Keyboard shortcuts


? Show this help
ESC Blurs the current field

Comment Form

r Focus the comment reply box
^ + ↩ Submit the comment

You can use Command ⌘ instead of Control ^ on Mac

Recent Discussions

18 Feb, 2019 09:20 AM
26 Nov, 2018 01:47 PM
16 Nov, 2018 07:51 PM
06 Nov, 2018 04:30 PM
24 Oct, 2018 07:57 AM


20 Jul, 2018 11:07 PM
05 Jul, 2018 10:53 AM
27 May, 2018 01:33 AM
14 May, 2018 03:38 PM
04 May, 2018 07:45 AM
28 Feb, 2018 07:08 AM