hgext/convert/subversion.py
changeset 5112 18abf13064cb
parent 5111 9cda2315c7a9
child 5113 792c1d979097
equal deleted inserted replaced
5111:9cda2315c7a9 5112:18abf13064cb
    13 #
    13 #
    14 #   hg convert --config convert.svn.trunk=wackoname [...]
    14 #   hg convert --config convert.svn.trunk=wackoname [...]
    15 
    15 
    16 import locale
    16 import locale
    17 import os
    17 import os
       
    18 import sys
    18 import cPickle as pickle
    19 import cPickle as pickle
    19 from mercurial import util
    20 from mercurial import util
    20 
    21 
    21 # Subversion stuff. Works best with very recent Python SVN bindings
    22 # Subversion stuff. Works best with very recent Python SVN bindings
    22 # e.g. SVN 1.5 or backports. Thanks to the bzr folks for enhancing
    23 # e.g. SVN 1.5 or backports. Thanks to the bzr folks for enhancing
    23 # these bindings.
    24 # these bindings.
    24 
    25 
    25 from cStringIO import StringIO
    26 from cStringIO import StringIO
    26 
    27 
    27 from common import NoRepo, commit, converter_source, encodeargs
    28 from common import NoRepo, commit, converter_source, encodeargs, decodeargs
    28 
    29 
    29 try:
    30 try:
    30     from svn.core import SubversionException, Pool
    31     from svn.core import SubversionException, Pool
    31     import svn
    32     import svn
    32     import svn.client
    33     import svn.client
    79     except SubversionException, (_, num):
    80     except SubversionException, (_, num):
    80         pickle.dump(num, fp, protocol)
    81         pickle.dump(num, fp, protocol)
    81     else:
    82     else:
    82         pickle.dump(None, fp, protocol)
    83         pickle.dump(None, fp, protocol)
    83     fp.close()
    84     fp.close()
       
    85 
       
    86 def debugsvnlog(ui, **opts):
       
    87     """Fetch SVN log in a subprocess and channel them back to parent to
       
    88     avoid memory collection issues.
       
    89     """
       
    90     util.set_binary(sys.stdin)
       
    91     util.set_binary(sys.stdout)
       
    92     args = decodeargs(sys.stdin.read())
       
    93     get_log_child(sys.stdout, *args)
    84 
    94 
    85 # SVN conversion code stolen from bzr-svn and tailor
    95 # SVN conversion code stolen from bzr-svn and tailor
    86 class convert_svn(converter_source):
    96 class convert_svn(converter_source):
    87     def __init__(self, ui, url, rev=None):
    97     def __init__(self, ui, url, rev=None):
    88         super(convert_svn, self).__init__(ui, url, rev=rev)
    98         super(convert_svn, self).__init__(ui, url, rev=rev)