Thursday, February 17, 2011

Can I split a Mercurial repository?

I have a largish Mercurial repository that I've decided would be better as several smaller repositories. Is there a way that I can split the repository and have each piece retain its revision history?

From stackoverflow
  • Just clone it and delete the unwanted stuff out of each copy.

    Ry4an : That doesn't help. Every close still has full history, so the "too much stuff" will always be there in the ".hg" directory taking up space.
    Jason S : ah, you want the Stalinist revisionism form of version control. ;) http://en.wikipedia.org/wiki/Historical_revisionism_(negationism)
  • The best way to do this is using the 'convert' extension. You'll use mercurial and both source and destination type and then use a --filemap with entries like:

    exclude path/you/do/not/want
    rename path/you/do/want .
    

    The rename is only necessary if you want to take the parts you're keeping and move them "higher" in the directory hierarchy.

    Nathan Lee : This wont work: rename path/you/do/want / This will: rename path/you/do/want . This only applies if you are moving a path to the root.
    Ry4an : Indeed, thanks, Nathan.
    Julian : http://mercurial.selenic.com/wiki/ConvertExtension

0 comments:

Post a Comment