Mercurial > hg-fastimport
changeset 50:b027552d517b
Do sort options just like hgext.convert.
Necessary for compatibility with Mercurial 1.3, and also makes this
extension require 1.3!
author | Greg Ward <greg-hg@gerg.ca> |
---|---|
date | Fri, 10 Jul 2009 14:07:30 -0400 |
parents | ed66bd7bd2f6 |
children | d3ae32b7f282 |
files | hgfastimport/__init__.py |
diffstat | 1 files changed, 15 insertions(+), 6 deletions(-) [+] |
line wrap: on
line diff
--- a/hgfastimport/__init__.py +++ b/hgfastimport/__init__.py @@ -1,4 +1,5 @@ from mercurial import encoding +from mercurial.i18n import _ from hgext.convert import convcmd, hg from fastimport import parser @@ -29,18 +30,26 @@ destc = hg.mercurial_sink(ui, repo.root) srcc = fastimport_source(ui, repo, sources) - # TEMP hack to keep old behaviour and minimize test churn - # (this should be an option to fastimport) - opts['datesort'] = True - + # XXX figuring out sortmode copied straight from hgext/convert/convcmd.py + defaultsort = 'branchsort' # for efficiency and consistency + sortmodes = ('branchsort', 'datesort', 'sourcesort') + sortmode = [m for m in sortmodes if opts.get(m)] + if len(sortmode) > 1: + raise util.Abort(_('more than one sort mode specified')) + sortmode = sortmode and sortmode[0] or defaultsort + # not implemented: filemap, revmapfile revmapfile = destc.revmapfile() c = convcmd.converter(ui, srcc, destc, revmapfile, opts) - c.convert() + c.convert(sortmode) +# XXX sort options copied straight from hgext/convert/__init__.py cmdtable = { "fastimport": (fastimport, - [], + [('', 'branchsort', None, _('try to sort changesets by branches')), + ('', 'datesort', None, _('try to sort changesets by date')), + ('', 'sourcesort', None, _('preserve source changesets order')), + ], 'hg fastimport SOURCE ...') }