0

Is it possible to do a partial clone of a mercurial repository as either a subrepository or a guestrepo?

description:

given a repo at https://blah/hg/foo/ named foo and another repo named cat , I'd like to create a guestrepo in cat from a certain directory under foo, eg. from c in foo:/a/b/c/.

To my best knowledge c is not available as a stand-alone repository. Read-only access to foo is assumed.

My intent is to have cat:/d/e/c/, the guest location, update if foo:/a/b/c/ changes. This is considered to be similar behavior to svn:externals in svn.

GuestrepoExtension:

I started out with trying the GuestrepoExtension:

.hggrmapping:

c = https://blah/hg/foo

.hgguestrepo:

/d/e/c/ = ??? ???

The problem is I don't know how to reference the sub-directory given that I don't need the whole foo repository, only this directory and it's contents from it.

According to https://www.mercurial-scm.org/wiki/PartialClone partial cloning / cloning of subdirectories is not implemented in mercurial (referred Bug 105 is already closed since 2012). This is why,

Subrepository:

Currently I resorted to using a subrepository since coincidentally the c directory exists in an svn mirror.

.hgsub:

/d/e/c = [svn]https://dog/svn/a/b/c/

This has the drawback that I don't want to rely on external version control, ie. svn, repository and tool availability.

Could this be handled somehow purely in mercurial?

n611x007
  • 8,952
  • 8
  • 59
  • 102
  • There's the [NarrowHG extension](https://bitbucket.org/Google/narrowhg), but that requires that the remote repository also has it installed. – Reimer Behrends Mar 18 '16 at 14:53
  • 1
    More tricky, but obvious way - convert `c/` dir to separate repo, link it to both `foo` (remove original c/) and `cat` – Lazy Badger Mar 19 '16 at 02:35

0 Answers0