--- a/hgext/convert/common.py Mon Jun 01 17:12:39 2009 +0200
+++ b/hgext/convert/common.py Mon Jun 01 17:12:39 2009 +0200
@@ -137,6 +137,13 @@
'''Notify the source that a revision has been converted.'''
pass
+ def hasnativeorder(self):
+ """Return true if this source has a meaningful, native revision
+ order. For instance, Mercurial revisions are store sequentially
+ while there is no such global ordering with Darcs.
+ """
+ return False
+
class converter_sink(object):
"""Conversion sink (target) interface"""
--- a/hgext/convert/convcmd.py Mon Jun 01 17:12:39 2009 +0200
+++ b/hgext/convert/convcmd.py Mon Jun 01 17:12:39 2009 +0200
@@ -376,6 +376,8 @@
if len(sortmode) > 1:
raise util.Abort(_('more than one sort mode specified'))
sortmode = sortmode and sortmode[0] or 'branchsort'
+ if sortmode == 'sourcesort' and not srcc.hasnativeorder():
+ raise util.Abort(_('--sourcesort is not supported by this data source'))
fmap = opts.get('filemap')
if fmap:
--- a/hgext/convert/filemap.py Mon Jun 01 17:12:39 2009 +0200
+++ b/hgext/convert/filemap.py Mon Jun 01 17:12:39 2009 +0200
@@ -351,3 +351,6 @@
def gettags(self):
return self.base.gettags()
+
+ def hasnativeorder(self):
+ return self.base.hasnativeorder()
--- a/hgext/convert/hg.py Mon Jun 01 17:12:39 2009 +0200
+++ b/hgext/convert/hg.py Mon Jun 01 17:12:39 2009 +0200
@@ -338,3 +338,6 @@
def after(self):
self.ui.debug(_('run hg source post-conversion action\n'))
+
+ def hasnativeorder(self):
+ return True
--- a/tests/test-convert-git Mon Jun 01 17:12:39 2009 +0200
+++ b/tests/test-convert-git Mon Jun 01 17:12:39 2009 +0200
@@ -165,5 +165,9 @@
echo '% convert author committer'
hg convert git-repo4 git-repo4-hg
-cd git-repo4-hg
-hg log -v
+hg -R git-repo4-hg log -v
+
+echo '% --sourceorder should fail'
+hg convert --sourcesort git-repo4 git-repo4-sourcesort-hg
+
+true
--- a/tests/test-convert-git.out Mon Jun 01 17:12:39 2009 +0200
+++ b/tests/test-convert-git.out Mon Jun 01 17:12:39 2009 +0200
@@ -124,3 +124,6 @@
addfoo
+% --sourceorder should fail
+initializing destination git-repo4-sourcesort-hg repository
+abort: --sourcesort is not supported by this data source