[darcs-users] Question/Wish: Forking a subset of a repo?

Benedikt Schmidt Benedikt.Schmidt at inf.ethz.ch
Mon Oct 27 19:40:29 UTC 2008


"Stephen Hicks" <sdh33 at cornell.edu> writes:

> I've wondered a few times if there's any way to do a special sort of
> 'darcs get' to get a new repo with only certain files in it?  For
> instance, suppose I have repo A with files a, b, c, and d.  And I want
> to end up with a repo B with just files a and b?  (in particular, A
> might be a private repo and I just want to make a subset of it public
> - maybe c and d contain personal information in them...  or maybe it's
> just a really big repo and I want to reduce the overhead from files
> that aren't relevant)

Do you need support for any sort of interaction between the repo
A and B or would you be OK with two completely unrelated repos?

If you need no interaction, then this shouldn't be so hard to
accomplish by removing patches that only touch c and d completely,
keeping all patches that touch only a and b (no problem for
interaction so far) and modifying all patches that touch files
from {a,b} and {c,d} by removing all primitive patches that
touch c or d. Of course these patches would be completely unrelated
to the patches in the old repo then.

> So what I want is something to go through all the patches (in reverse
> order, presumably, to track renames, etc) and only cherry-pick the
> changes that pertain to the files I want, and then pull these
> cherry-picked changes into a new repository.  Thus, the history is
> maintained on the files I wanted to get, while everything else is left
> behind.
>
> Is this at all possible at the moment (short of writing a rather
> frightening perl script to pull patches one at a time, deleting
> extraneous files, and then amend-recording... on second thought this
> doesn't work anyway)?

It seems doable, but not that easy if one is familiar with the
relevant parts of the darcs code. I'm not sure, but perhaps I'm
going to need something similar for optimizing annotate.

  Benedikt




More information about the darcs-users mailing list