--- a/hgext/convert/__init__.py Sun Jul 01 12:58:08 2007 -0700
+++ b/hgext/convert/__init__.py Sun Jul 01 15:02:15 2007 -0700
@@ -17,12 +17,15 @@
converters = [convert_cvs, convert_git, convert_mercurial]
-def converter(ui, path):
+def converter(ui, path, rev=None):
if not os.path.isdir(path):
raise util.Abort("%s: not a directory" % path)
for c in converters:
try:
- return c(ui, path)
+ if rev:
+ return c(ui, path, rev=rev)
+ else:
+ return c(ui, path)
except NoRepo:
pass
raise util.Abort("%s: unknown repository type" % path)
@@ -248,6 +251,10 @@
Accepted destination formats:
- Mercurial
+ If no revision is given, all revisions will be converted. Otherwise,
+ convert will only import up to the named revision (given in a format
+ understood by the source).
+
If destination isn't given, a new Mercurial repo named <src>-hg will
be created. If <mapfile> isn't given, it will be put in a default
location (<dest>/.hg/shamap by default)
@@ -267,7 +274,7 @@
srcauthor=whatever string you want
'''
- srcc = converter(ui, src)
+ srcc = converter(ui, src, rev=opts.get('rev'))
if not hasattr(srcc, "getcommit"):
raise util.Abort("%s: can't read from this repo type" % src)
@@ -313,6 +320,7 @@
"convert":
(_convert,
[('A', 'authors', '', 'username mapping filename'),
+ ('r', 'rev', '', 'import up to target revision REV'),
('', 'datesort', None, 'try to sort changesets by date')],
'hg convert [OPTION]... SOURCE [DEST [MAPFILE]]'),
}