comparison hgext/convert/__init__.py @ 5127:39b6eaee6fd7

convert: replace fork with subprocess call.
author Patrick Mezard <pmezard@gmail.com>
date Mon, 06 Aug 2007 21:49:26 +0200
parents ef338e34a906
children 745cffe59ca8
comparison
equal deleted inserted replaced
5126:117dab48ca99 5127:39b6eaee6fd7
3 # Copyright 2005-2007 Matt Mackall <mpm@selenic.com> 3 # Copyright 2005-2007 Matt Mackall <mpm@selenic.com>
4 # 4 #
5 # This software may be used and distributed according to the terms 5 # This software may be used and distributed according to the terms
6 # of the GNU General Public License, incorporated herein by reference. 6 # of the GNU General Public License, incorporated herein by reference.
7 7
8 from common import NoRepo, converter_source, converter_sink 8 from common import NoRepo, converter_source, converter_sink, decodeargs
9 from cvs import convert_cvs 9 from cvs import convert_cvs
10 from git import convert_git 10 from git import convert_git
11 from hg import mercurial_source, mercurial_sink 11 from hg import mercurial_source, mercurial_sink
12 from subversion import convert_svn 12 from subversion import convert_svn
13 13
14 import os, shlex, shutil 14 import os, shlex, shutil, sys
15 from mercurial import hg, ui, util, commands 15 from mercurial import hg, ui, util, commands
16 from mercurial.i18n import _ 16 from mercurial.i18n import _
17 17
18 commands.norepo += " convert" 18 commands.norepo += " convert debug-svn-log"
19 19
20 converters = [convert_cvs, convert_git, convert_svn, mercurial_source, 20 converters = [convert_cvs, convert_git, convert_svn, mercurial_source,
21 mercurial_sink] 21 mercurial_sink]
22 22
23 def convertsource(ui, path, **opts): 23 def convertsource(ui, path, **opts):
429 429
430 c = convert(ui, srcc, destc, revmapfile, filemapper(ui, opts['filemap']), 430 c = convert(ui, srcc, destc, revmapfile, filemapper(ui, opts['filemap']),
431 opts) 431 opts)
432 c.convert() 432 c.convert()
433 433
434 def debugsvnlog(ui, **opts):
435 """Fetch SVN log in a subprocess and channel them back to parent to
436 avoid memory collection issues.
437 """
438 util.set_binary(sys.stdin)
439 util.set_binary(sys.stdout)
440 args = decodeargs(sys.stdin.read())
441 subversion.get_log_child(sys.stdout, *args)
442
434 cmdtable = { 443 cmdtable = {
435 "convert": 444 "convert":
436 (_convert, 445 (_convert,
437 [('A', 'authors', '', 'username mapping filename'), 446 [('A', 'authors', '', 'username mapping filename'),
438 ('', 'filemap', '', 'remap file names using contents of file'), 447 ('', 'filemap', '', 'remap file names using contents of file'),
439 ('r', 'rev', '', 'import up to target revision REV'), 448 ('r', 'rev', '', 'import up to target revision REV'),
440 ('', 'datesort', None, 'try to sort changesets by date')], 449 ('', 'datesort', None, 'try to sort changesets by date')],
441 'hg convert [OPTION]... SOURCE [DEST [MAPFILE]]'), 450 'hg convert [OPTION]... SOURCE [DEST [MAPFILE]]'),
451 "debug-svn-log":
452 (debugsvnlog,
453 [],
454 'hg debug-svn-log'),
442 } 455 }
456