PartialClone feature -- how hard would it be to do?

Matt Mackall mpm at selenic.com
Sat Dec 15 16:00:02 UTC 2007


On Sat, Dec 15, 2007 at 12:40:41AM +0000, TK Soh wrote:
> On Dec 14, 2007 7:38 PM, Matt Mackall <mpm at selenic.com> wrote:
> > On Fri, Dec 14, 2007 at 10:40:08AM -0800, Chris Quenelle wrote:
> > >
> > > There is a wiki page here:
> > >   http://www.selenic.com/mercurial/wiki/index.cgi/PartialClone
> > > and an issue record here:
> > >   http://www.selenic.com/mercurial/bts/issue105
> > >
> > > that describe a proposed feature "Partial Clone" which would allow you
> > > to create a clone with only some subtrees of the your sources.  Not
> > > just in your working directory, but also in the history DB itself.
> > >
> > > I've always assumed this would difficult because of the way the revision
> > > checksums are created and used globally.  But I can't find a more in-depth
> > > discussion of how hard this would be.   Was this addressed in a previous
> > > email someplace?  Maybe I could copy/paste that discussion onto the wiki
> > > page?
> > >
> > > How hard would this be to implement?
> >
> > On a scale of 1 to 10, I'd rate it about a 7.
> >
> > The simplest approach is probably "allow cloning of subdirectories".
> > Here's how that would work:
> >
> > - add a file called "subdir" to .hg/store containing the
> >   subdirectory we're cloning
> > - do a clone as usual, but don't write out revlogs that aren't in subdir
> > - adjust the functions dealing with paths (localrepo.wjoin, etc.)
> >   appropriately
> > - teach various things (checkout, status, etc.) to skip files outside
> >   the subdirectory
> > - teach merge not allow merging when files outside the subdirectory
> >   conflict
> >
> > Merging is the tricky part, and I expect there's a gotcha or two
> > buried in there.
> 
> Any thought about pulling and pushing?

Missed a point here:

- disallow pull of any changeset that contains a file outside of
  subdir

The push code goes through the same path, so it basically comes for free.

-- 
Mathematics is the supreme nostalgia of our time.



More information about the Mercurial mailing list