incorrectly marked as subrepo in reporegistry ?

Issue #1672 open
Johan Samyn
created an issue


I made some test repo's, a master, and 2 clones, and for some reason the clones are marked as subrepo's in the reporegistry. The structure is as follows: {{{ .../path/to/repos1/master .../path/to/repos2/clone1 .../path/to/repos2/clone2 }}} As you can see from the structure the 2 clones are not even really stored in a level directly under the master repo. So I suspect an imperfection in the way the reporegistry detects subrepos.

-- Johan

Comments (8)

  1. Johan Samyn reporter

    As far as I understand subrepos, they have to live in the working copy of the master, don't they ? And I don't think that normally they are clones of that master. And the ones in the example are clones, and do live outside of the master folder. So I don't understand why the repotree considers them subrepos then. Allthough it could well be that there is something I don't know about subrepos that can explain this behaviour.

  2. Angel Ezquerra

    The code that checks whether a repository is a subrepo or not is not 100% accurate although it should not fail in the scenario that you describe.

    The code starts at the folder that contains the repository, and looks for a .hg folder. If it does not find one it goes one folder above and tries to find an .hg folder in there. This process is repeated until an .hg folder is found or we get to the root of the drive.

    Are you sure that your repos are not inside another repository?

  3. Johan Samyn reporter

    1) I am positive that there is no repo at all in any folder between the ones the clones live in up to the root of the drive, nor between the master and the root of the drive. The 2 clones are 'neighbours' of the master, not 'children'. So they are nowhere in the working copy of the master. However the icon shown in the reporegistry was the one as used for subrepos.

    2) Am I correct in supposing that subrepos always live in/under the level of their master/main repo ? I think so, because afaik Mercurial never looks outside the folder the .hg folder lives in, right ?

    3) I added another clone, and now everything looks ok (using TortoiseHg version 2.3.1+6-dca424626920 with Mercurial-2.1). I also removed one of the problematic clones from the reporegistry, and re-added it. All went well this time. Strange. So let's consider this a 'wontfix' or 'resolved', whatever. Thanks both for taking the trouble for looking at this.

  4. Yuya Nishihara

    reporegistry: improve accuracy of subrepo detection when adding a repository (refs #1672)

    Up until now adding a subrepo that was contained inside another subrepo would always mark the inner repo as a subrepo. This is not always true.

    With this patch, we also check whether the added subrepo is _currently_ a subrepo of the outer repository. We respect the "showNetworkSubrepos" flag (i.e. we'll only check if an added repo is a subrepo if the repo is local or if the showNetworkSubrepos flag is set).

    Note that this does not a full fix issue #1672, because we only perform this check once, when adding the repo, and because we only check whether the repo is _currently_ a subrepo of the outer repo. However I think that it is an improvement over the old behavior.


  5. Log in to comment