Selectively merging distinct repositories

Francois Tigeot ftigeot at wolfpond.org
Mon Nov 1 15:19:22 UTC 2010


On Sun, Oct 31, 2010 at 12:05:46PM +0100, Francois Tigeot wrote:
> On Fri, Oct 29, 2010 at 04:53:41PM +0200, Francois Tigeot wrote:
> 
> 1. I need to exclude one complete svn revision
> 
> 2. I need to exclude a range of revisions, but only for one and only one
> specific file.
> 
> 3. One file contains 3 lines of confidential data for almost its entire
> history. I'd like to replace them with some innocuous text string and
> keep all other things the same.

I finally used hg import / hg export. Here's what I did:

1. convert most of the existing svn repository to a temporary mercurial one:

	hg convert svn-repo repo-hg.tmp \
	      --authors authors.txt --filemap filemap.txt

2. from this first hg repository, generate one patch file for each existing
revision:

	hg export -r0:tip -o patch-%r

3. create a new hg repository from scratch

	hg init final-repo

4. and apply patches selectively, following the chronological order

	hg import patch-000
	hg import patch-001
	...

I wanted to discard one complete revision; I just had to not apply the
relevant patch.

For excluding some files from a range of revisions, I edited the patches
and removed all data corresponding to the file name. In the patch
corresponding to the last revision, I replaced the original data by a diff
between the first and last revisions of the file in the original repository.

The one-liner changes were the easiest: I replaced the names in the first and
last patch by some innocuous text string.

In the end, I can't believe it was so easy.

-- 
Francois Tigeot



More information about the Mercurial mailing list