hgext/convert/darcs.py
changeset 15457 1470f8b00694
parent 15381 c519cd8f0169
child 16514 363e808de349
equal deleted inserted replaced
15456:abcaaf51d568 15457:1470f8b00694
    22             from elementtree.cElementTree import ElementTree, XMLParser
    22             from elementtree.cElementTree import ElementTree, XMLParser
    23         except ImportError:
    23         except ImportError:
    24             try:
    24             try:
    25                 from elementtree.ElementTree import ElementTree, XMLParser
    25                 from elementtree.ElementTree import ElementTree, XMLParser
    26             except ImportError:
    26             except ImportError:
    27                 ElementTree = None
    27                 pass
    28 
    28 
    29 class darcs_source(converter_source, commandline):
    29 class darcs_source(converter_source, commandline):
    30     def __init__(self, ui, path, rev=None):
    30     def __init__(self, ui, path, rev=None):
    31         converter_source.__init__(self, ui, path, rev=rev)
    31         converter_source.__init__(self, ui, path, rev=rev)
    32         commandline.__init__(self, ui, 'darcs')
    32         commandline.__init__(self, ui, 'darcs')
    40         version = self.run0('--version').splitlines()[0].strip()
    40         version = self.run0('--version').splitlines()[0].strip()
    41         if version < '2.1':
    41         if version < '2.1':
    42             raise util.Abort(_('darcs version 2.1 or newer needed (found %r)') %
    42             raise util.Abort(_('darcs version 2.1 or newer needed (found %r)') %
    43                              version)
    43                              version)
    44 
    44 
    45         if ElementTree is None:
    45         if "ElementTree" not in globals():
    46             raise util.Abort(_("Python ElementTree module is not available"))
    46             raise util.Abort(_("Python ElementTree module is not available"))
    47 
    47 
    48         self.path = os.path.realpath(path)
    48         self.path = os.path.realpath(path)
    49 
    49 
    50         self.lastrev = None
    50         self.lastrev = None