Search code examples
mercurialmercurial-subrepos

Mercurial subrepos, what am I doing wrong?


I've got a checkout of a project on my machine to which I've added subrepo. Works fine on that checkout, but when I clone the project in other location it doesn't clone subrepos. .hgsub is pushed to default.

Dir structure is

./projA/            ## - the main project directory
./projA/lib/projB/  ## - the sub-repo project directory

And .hgsub:

lib/projB = [hg]ssh://[email protected]/username/projB

Now when I do hg clone ssh://[email protected]/username/projA it makes no attempts whatsoever to fetch subrepo. What am I missing?


Solution

  • I've kind of found solution. The problem was that .hgsubstate file was not generated. I've manually created one using hashes obtained via hg --debug id -i lib/projB/ thus situation was like:

    .hgsubs

    lib/projB = [hg]ssh://[email protected]/user/projB/
    

    .hgsubstate

    1e07729703d0e9447ae174a732bfd3e1cbdd96f4 lib/projB
    

    Interestingly enough, after committing .hgsubstate it did get auto-regenerated.

    After that change cloning works as expected, cloning recursively both main repo and subrepo:

    hg clone ssh://[email protected]/user/projA
    
    destination directory: projA
    requesting all changes
    adding changesets
    adding manifests
    adding file changes
    added 13 changesets with 24 changes to 10 files
    updating to branch default
    cloning subrepo lib/projB from ssh://[email protected]/user/projB
    requesting all changes
    adding changesets
    adding manifests
    adding file changes
    added 653 changesets with 3864 changes to 1899 files