--- a/hgext/convert/convcmd.py Mon Jun 01 17:12:37 2009 +0200
+++ b/hgext/convert/convcmd.py Mon Jun 01 17:12:38 2009 +0200
@@ -114,7 +114,7 @@
return parents
- def toposort(self, parents):
+ def toposort(self, parents, sortmode):
'''Return an ordering such that every uncommitted changeset is
preceeded by all its uncommitted ancestors.'''
@@ -182,10 +182,12 @@
return picknext
- if self.opts.get('datesort'):
+ if sortmode == 'branchsort':
+ picknext = makebranchsorter()
+ elif sortmode == 'datesort':
picknext = makedatesorter()
else:
- picknext = makebranchsorter()
+ raise util.Abort(_('unknown sort mode: %s') % sortmode)
children, actives = mapchildren(parents)
@@ -290,8 +292,7 @@
self.source.converted(rev, newnode)
self.map[rev] = newnode
- def convert(self):
-
+ def convert(self, sortmode):
try:
self.source.before()
self.dest.before()
@@ -300,7 +301,7 @@
heads = self.source.getheads()
parents = self.walktree(heads)
self.ui.status(_("sorting...\n"))
- t = self.toposort(parents)
+ t = self.toposort(parents, sortmode)
num = len(t)
c = None
@@ -361,6 +362,10 @@
shutil.rmtree(path, True)
raise
+ sortmode = 'branchsort'
+ if opts.get('datesort'):
+ sortmode = 'datesort'
+
fmap = opts.get('filemap')
if fmap:
srcc = filemap.filemap_source(ui, srcc, fmap)
@@ -373,5 +378,5 @@
revmapfile = os.path.join(destc, "map")
c = converter(ui, srcc, destc, revmapfile, opts)
- c.convert()
+ c.convert(sortmode)