Mercurial > hg > hg-fastimport
comparison hgfastimport/__init__.py @ 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 | 7ff36dc9f0b1 |
| children | 9275d497b7ea 76bd0ea8add3 |
comparison
equal
deleted
inserted
replaced
| 49:ed66bd7bd2f6 | 50:b027552d517b |
|---|---|
| 1 from mercurial import encoding | 1 from mercurial import encoding |
| 2 from mercurial.i18n import _ | |
| 2 from hgext.convert import convcmd, hg | 3 from hgext.convert import convcmd, hg |
| 3 | 4 |
| 4 from fastimport import parser | 5 from fastimport import parser |
| 5 from hgfastimport.hgimport import fastimport_source | 6 from hgfastimport.hgimport import fastimport_source |
| 6 | 7 |
| 27 | 28 |
| 28 # sink is the current repo, src is the list of fastimport streams | 29 # sink is the current repo, src is the list of fastimport streams |
| 29 destc = hg.mercurial_sink(ui, repo.root) | 30 destc = hg.mercurial_sink(ui, repo.root) |
| 30 srcc = fastimport_source(ui, repo, sources) | 31 srcc = fastimport_source(ui, repo, sources) |
| 31 | 32 |
| 32 # TEMP hack to keep old behaviour and minimize test churn | 33 # XXX figuring out sortmode copied straight from hgext/convert/convcmd.py |
| 33 # (this should be an option to fastimport) | 34 defaultsort = 'branchsort' # for efficiency and consistency |
| 34 opts['datesort'] = True | 35 sortmodes = ('branchsort', 'datesort', 'sourcesort') |
| 35 | 36 sortmode = [m for m in sortmodes if opts.get(m)] |
| 37 if len(sortmode) > 1: | |
| 38 raise util.Abort(_('more than one sort mode specified')) | |
| 39 sortmode = sortmode and sortmode[0] or defaultsort | |
| 40 | |
| 36 # not implemented: filemap, revmapfile | 41 # not implemented: filemap, revmapfile |
| 37 revmapfile = destc.revmapfile() | 42 revmapfile = destc.revmapfile() |
| 38 c = convcmd.converter(ui, srcc, destc, revmapfile, opts) | 43 c = convcmd.converter(ui, srcc, destc, revmapfile, opts) |
| 39 c.convert() | 44 c.convert(sortmode) |
| 40 | 45 |
| 46 # XXX sort options copied straight from hgext/convert/__init__.py | |
| 41 cmdtable = { | 47 cmdtable = { |
| 42 "fastimport": | 48 "fastimport": |
| 43 (fastimport, | 49 (fastimport, |
| 44 [], | 50 [('', 'branchsort', None, _('try to sort changesets by branches')), |
| 51 ('', 'datesort', None, _('try to sort changesets by date')), | |
| 52 ('', 'sourcesort', None, _('preserve source changesets order')), | |
| 53 ], | |
| 45 'hg fastimport SOURCE ...') | 54 'hg fastimport SOURCE ...') |
| 46 } | 55 } |
