def convert(ui, src, dest=None, revmapfile=None, **opts): global orig_encoding orig_encoding = util._encoding util._encoding = 'UTF-8' if not dest: dest = hg.defaultdest(src) + "-hg" ui.status("assuming destination %s\n" % dest) destc = convertsink(ui, dest, opts.get('dest_type')) try: srcc = convertsource(ui, src, opts.get('source_type'), opts.get('rev')) except Exception: for path in destc.created: shutil.rmtree(path, True) raise fmap = opts.get('filemap') if fmap: srcc = filemap.filemap_source(ui, srcc, fmap) destc.setfilemapmode(True) if not revmapfile: try: revmapfile = destc.revmapfile() except: revmapfile = os.path.join(destc, "map") c = converter(ui, srcc, destc, revmapfile, opts) c.convert()
def convert(ui, src, dest=None, revmapfile=None, **opts): global orig_encoding orig_encoding = encoding.encoding encoding.encoding = 'UTF-8' # support --authors as an alias for --authormap if not opts.get('authormap'): opts['authormap'] = opts.get('authors') if not dest: dest = hg.defaultdest(src) + "-hg" ui.status(_("assuming destination %s\n") % dest) destc = convertsink(ui, dest, opts.get('dest_type')) try: srcc, defaultsort = convertsource(ui, src, opts.get('source_type'), opts.get('rev')) except Exception: for path in destc.created: shutil.rmtree(path, True) raise sortmodes = ('branchsort', 'datesort', 'sourcesort', 'closesort') sortmode = [m for m in sortmodes if opts.get(m)] if len(sortmode) > 1: raise util.Abort(_('more than one sort mode specified')) if sortmode: sortmode = sortmode[0] else: sortmode = defaultsort if sortmode == 'sourcesort' and not srcc.hasnativeorder(): raise util.Abort( _('--sourcesort is not supported by this data source')) if sortmode == 'closesort' and not srcc.hasnativeclose(): raise util.Abort(_('--closesort is not supported by this data source')) fmap = opts.get('filemap') if fmap: srcc = filemap.filemap_source(ui, srcc, fmap) destc.setfilemapmode(True) if not revmapfile: revmapfile = destc.revmapfile() c = converter(ui, srcc, destc, revmapfile, opts) c.convert(sortmode)
def convert(ui, src, dest=None, revmapfile=None, **opts): global orig_encoding orig_encoding = encoding.encoding encoding.encoding = 'UTF-8' # support --authors as an alias for --authormap if not opts.get('authormap'): opts['authormap'] = opts.get('authors') if not dest: dest = hg.defaultdest(src) + "-hg" ui.status(_("assuming destination %s\n") % dest) destc = convertsink(ui, dest, opts.get('dest_type')) try: srcc, defaultsort = convertsource(ui, src, opts.get('source_type'), opts.get('rev')) except Exception: for path in destc.created: shutil.rmtree(path, True) raise sortmodes = ('branchsort', 'datesort', 'sourcesort', 'closesort') sortmode = [m for m in sortmodes if opts.get(m)] if len(sortmode) > 1: raise error.Abort(_('more than one sort mode specified')) if sortmode: sortmode = sortmode[0] else: sortmode = defaultsort if sortmode == 'sourcesort' and not srcc.hasnativeorder(): raise error.Abort(_('--sourcesort is not supported by this data source') ) if sortmode == 'closesort' and not srcc.hasnativeclose(): raise error.Abort(_('--closesort is not supported by this data source')) fmap = opts.get('filemap') if fmap: srcc = filemap.filemap_source(ui, srcc, fmap) destc.setfilemapmode(True) if not revmapfile: revmapfile = destc.revmapfile() c = converter(ui, srcc, destc, revmapfile, opts) c.convert(sortmode)
def convert(ui, src, dest=None, revmapfile=None, **opts): global orig_encoding orig_encoding = encoding.encoding encoding.encoding = "UTF-8" if not dest: dest = hg.defaultdest(src) + "-hg" ui.status(_("assuming destination %s\n") % dest) destc = convertsink(ui, dest, opts.get("dest_type")) try: srcc, defaultsort = convertsource(ui, src, opts.get("source_type"), opts.get("rev")) except Exception: for path in destc.created: shutil.rmtree(path, True) raise 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 if sortmode == "sourcesort" and not srcc.hasnativeorder(): raise util.Abort(_("--sourcesort is not supported by this data source")) fmap = opts.get("filemap") if fmap: srcc = filemap.filemap_source(ui, srcc, fmap) destc.setfilemapmode(True) if not revmapfile: try: revmapfile = destc.revmapfile() except: revmapfile = os.path.join(destc, "map") c = converter(ui, srcc, destc, revmapfile, opts) c.convert(sortmode)