[PATCH] convert into subdir

Johannes Hofmann Johannes.Hofmann at gmx.de
Mon Nov 5 16:20:08 UTC 2007


Hi,

I want to convert a cvs repository into a subdirectory of the
destination repository (to combine multiple cvs repos into one
mercurial repo). The patch below makes this possible by using
'.' as the source path in a rename directive in the filemap.
Does this sound reasonable, or is there already another way to
do this?

Regards,
Johannes



diff -r 3aa5c45874c6 hgext/convert/__init__.py
--- a/hgext/convert/__init__.py	Sat Oct 20 03:04:34 2007 +0200
+++ b/hgext/convert/__init__.py	Mon Nov 05 17:17:37 2007 +0100
@@ -346,7 +346,9 @@ def convert(ui, src, dest=None, revmapfi
     'exclude' directive causes files or directories to be omitted.
     The 'rename' directive renames a file or directory.  To rename
     from a subdirectory into the root of the repository, use '.' as
-    the path to rename to.
+    the path to rename to. To rename the whole source repository 
+    into a subdir of the destination repository use '.' as source
+    path.
     """
 
     util._encoding = 'UTF-8'
diff -r 3aa5c45874c6 hgext/convert/filemap.py
--- a/hgext/convert/filemap.py	Sat Oct 20 03:04:34 2007 +0200
+++ b/hgext/convert/filemap.py	Mon Nov 05 17:17:37 2007 +0100
@@ -14,6 +14,7 @@ def rpairs(name):
     while e != -1:
         yield name[:e], name[e+1:]
         e = name.rfind('/', 0, e)
+    yield ".", name
 
 class filemapper(object):
     '''Map and filter filenames when importing.



More information about the Mercurial-devel mailing list