Support subrepositories
Are there any plans for this?
I am in need of this feature. I'm happy to take a crack if anyone can help me get pointed in the right direction. I have 0 TypeScript skills, but have used mercurial for a long time.
@kchangtetrion A PR for this feature would be very welcome! TypeScript is not too difficult if you've used typed languages before. I don't have bandwidth currently to start on this, so if you started on it that might be the fastest way to make it happen, especially if you have a good working knowledge of subrepos.
In general, this extension tries to mirror the structure of the vscode git extension. VSCode has an API for extensions that provide access to a version-control system, so that is also useful documentation: https://code.visualstudio.com/api/extension-guides/scm-provider
hg.ts corresponds to git.ts and is the TypeScript interface to the hg executable. There are a couple of commands in the git version that mention submodules, so you'll probably end up writing equivalent subrepo commands in hg.ts. In particular, you'll want a getSubrepos() function, which should open up .hgsub and return objects that encapsulate data about the subrepos.
From there, call getSubrepos() in Repository.updateModelState() and store the results in a property on the Repository object. Then, you'd look at the Model object, which keeps track of all the repos in a project, including subrepos. Model.open() is called when the extension is activated, so that's where the setup happens. Look at how the git version of that function works with submodules.
The magic happens in Model.eventuallyScanPossibleHgRepositories, which operates on a list of paths. The subrepo list should be added to that list of paths. Can use this function, which is cribbed from the git version:
private eventuallyScanPossibleHgRepository(path: string) {
this.possibleHgRepositoryPaths.add(path);
this.eventuallyScanPossibleHgRepositories();
}
ok, when time allows, I'll go through the examples and see if I can make some sense of it.