I want to split a repository

Martin Geisler mg at lazybytes.net
Sun Sep 6 18:00:21 CDT 2009


"Eric M. Hopper" <hopper at omnifarious.org> writes:

> I have a subdirectory of a repository that should be its own
> repository. I would like to split that subdirectory out into a new
> repository that still has the history of changes to it. I realize the
> new reppository will necessarily have all new hashes as well, but at
> least all the other details of the changes will be approximately the
> same.
>
> Is there an 'approved' method of doing this?
>
> One method would be to export all the patch sets containing changes to
> the subdirectory, then re-import them, handling merges specially.  This
> seems laborious and error prone and I'm hoping there's a better way I
> haven't thought of and/or don't know about.

The convert extension can do hg -> hg conversions, i.e., read a
Mercurial repository and spit out another Mercurial repository.

Now, why would you do that? Because of all the conversion options this
extension offers:

--authors: The [username mapping] file is a simple text file that maps
    each source commit author to a destination commit author. It is
    handy for source SCMs that use unix logins to identify authors (eg:
    CVS). One line per author mapping and the line format is:
    srcauthor=whatever string you want

--filemap: The filemap is a file that allows filtering and remapping of
    files and directories. Comment lines start with '#'. Each line can
    contain one of the following directives:

      include path/to/file

      exclude path/to/file

      rename from/file to/file

--branchmap: The branchmap is a file that allows you to rename a branch
    when it is being brought in from whatever external repository. When
    used in conjunction with a splicemap, it allows for a powerful
    combination to help fix even the most badly mismanaged repositories
    and turn them into nicely structured Mercurial repositories.

(see 'hg help convert')

You'll want the --filemap option with something like

  include foo/bar
  rename foo/bar .

in order to make foo/bar the root of your converted repository.

-- 
Martin Geisler

VIFF (Virtual Ideal Functionality Framework) brings easy and efficient
SMPC (Secure Multiparty Computation) to Python. See: http://viff.dk/.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 196 bytes
Desc: not available
Url : http://selenic.com/pipermail/mercurial/attachments/20090907/51cfdd69/attachment.pgp 


More information about the Mercurial mailing list