Show More
@@ -4,39 +4,52 b'' | |||||
4 | # |
|
4 | # | |
5 | # This software may be used and distributed according to the terms of the |
|
5 | # This software may be used and distributed according to the terms of the | |
6 | # GNU General Public License version 2 or any later version. |
|
6 | # GNU General Public License version 2 or any later version. | |
|
7 | from __future__ import absolute_import | |||
7 |
|
8 | |||
8 | from common import NoRepo, checktool, commandline, commit, converter_source |
|
9 | import errno | |
|
10 | import os | |||
|
11 | import re | |||
|
12 | import shutil | |||
|
13 | import tempfile | |||
9 | from mercurial.i18n import _ |
|
14 | from mercurial.i18n import _ | |
10 |
from mercurial import |
|
15 | from mercurial import ( | |
11 | import os, shutil, tempfile, re, errno |
|
16 | error, | |
|
17 | util, | |||
|
18 | ) | |||
|
19 | from . import common | |||
|
20 | NoRepo = common.NoRepo | |||
12 |
|
21 | |||
13 | # The naming drift of ElementTree is fun! |
|
22 | # The naming drift of ElementTree is fun! | |
14 |
|
23 | |||
15 | try: |
|
24 | try: | |
16 |
|
|
25 | import xml.etree.cElementTree.ElementTree as ElementTree | |
|
26 | import xml.etree.cElementTree.XMLParser as XMLParser | |||
17 | except ImportError: |
|
27 | except ImportError: | |
18 | try: |
|
28 | try: | |
19 |
|
|
29 | import xml.etree.ElementTree.ElementTree as ElementTree | |
|
30 | import xml.etree.ElementTree.XMLParser as XMLParser | |||
20 | except ImportError: |
|
31 | except ImportError: | |
21 | try: |
|
32 | try: | |
22 |
|
|
33 | import elementtree.cElementTree.ElementTree as ElementTree | |
|
34 | import elementtree.cElementTree.XMLParser as XMLParser | |||
23 | except ImportError: |
|
35 | except ImportError: | |
24 | try: |
|
36 | try: | |
25 |
|
|
37 | import elementtree.ElementTree.ElementTree as ElementTree | |
|
38 | import elementtree.ElementTree.XMLParser as XMLParser | |||
26 | except ImportError: |
|
39 | except ImportError: | |
27 | pass |
|
40 | pass | |
28 |
|
41 | |||
29 | class darcs_source(converter_source, commandline): |
|
42 | class darcs_source(common.converter_source, common.commandline): | |
30 | def __init__(self, ui, path, revs=None): |
|
43 | def __init__(self, ui, path, revs=None): | |
31 | converter_source.__init__(self, ui, path, revs=revs) |
|
44 | common.converter_source.__init__(self, ui, path, revs=revs) | |
32 | commandline.__init__(self, ui, 'darcs') |
|
45 | common.commandline.__init__(self, ui, 'darcs') | |
33 |
|
46 | |||
34 | # check for _darcs, ElementTree so that we can easily skip |
|
47 | # check for _darcs, ElementTree so that we can easily skip | |
35 | # test-convert-darcs if ElementTree is not around |
|
48 | # test-convert-darcs if ElementTree is not around | |
36 | if not os.path.exists(os.path.join(path, '_darcs')): |
|
49 | if not os.path.exists(os.path.join(path, '_darcs')): | |
37 | raise NoRepo(_("%s does not look like a darcs repository") % path) |
|
50 | raise NoRepo(_("%s does not look like a darcs repository") % path) | |
38 |
|
51 | |||
39 | checktool('darcs') |
|
52 | common.checktool('darcs') | |
40 | version = self.run0('--version').splitlines()[0].strip() |
|
53 | version = self.run0('--version').splitlines()[0].strip() | |
41 | if version < '2.1': |
|
54 | if version < '2.1': | |
42 | raise error.Abort(_('darcs version 2.1 or newer needed (found %r)') |
|
55 | raise error.Abort(_('darcs version 2.1 or newer needed (found %r)') | |
@@ -139,10 +152,10 b' class darcs_source(converter_source, com' | |||||
139 | desc = elt.findtext('name') + '\n' + elt.findtext('comment', '') |
|
152 | desc = elt.findtext('name') + '\n' + elt.findtext('comment', '') | |
140 | # etree can return unicode objects for name, comment, and author, |
|
153 | # etree can return unicode objects for name, comment, and author, | |
141 | # so recode() is used to ensure str objects are emitted. |
|
154 | # so recode() is used to ensure str objects are emitted. | |
142 | return commit(author=self.recode(elt.get('author')), |
|
155 | return common.commit(author=self.recode(elt.get('author')), | |
143 | date=util.datestr(date, '%Y-%m-%d %H:%M:%S %1%2'), |
|
156 | date=util.datestr(date, '%Y-%m-%d %H:%M:%S %1%2'), | |
144 | desc=self.recode(desc).strip(), |
|
157 | desc=self.recode(desc).strip(), | |
145 | parents=self.parents[rev]) |
|
158 | parents=self.parents[rev]) | |
146 |
|
159 | |||
147 | def pull(self, rev): |
|
160 | def pull(self, rev): | |
148 | output, status = self.run('pull', self.path, all=True, |
|
161 | output, status = self.run('pull', self.path, all=True, |
@@ -30,7 +30,6 b'' | |||||
30 | hgext/convert/convcmd.py not using absolute_import |
|
30 | hgext/convert/convcmd.py not using absolute_import | |
31 | hgext/convert/cvs.py not using absolute_import |
|
31 | hgext/convert/cvs.py not using absolute_import | |
32 | hgext/convert/cvsps.py not using absolute_import |
|
32 | hgext/convert/cvsps.py not using absolute_import | |
33 | hgext/convert/darcs.py not using absolute_import |
|
|||
34 | hgext/convert/hg.py not using absolute_import |
|
33 | hgext/convert/hg.py not using absolute_import | |
35 | hgext/convert/monotone.py not using absolute_import |
|
34 | hgext/convert/monotone.py not using absolute_import | |
36 | hgext/convert/p4.py not using absolute_import |
|
35 | hgext/convert/p4.py not using absolute_import |
General Comments 0
You need to be logged in to leave comments.
Login now