##// END OF EJS Templates
convert: bzr use absolute_import
timeless -
r28411:098bb566 default
parent child Browse files
Show More
@@ -7,9 +7,16 b''
7
7
8 # This module is for handling 'bzr', that was formerly known as Bazaar-NG;
8 # This module is for handling 'bzr', that was formerly known as Bazaar-NG;
9 # it cannot access 'bar' repositories, but they were never used very much
9 # it cannot access 'bar' repositories, but they were never used very much
10 from __future__ import absolute_import
10
11
11 import os
12 import os
12 from mercurial import demandimport, error
13 from mercurial import (
14 demandimport,
15 error
16 )
17 from mercurial.i18n import _
18 from . import common
19
13 # these do not work with demandimport, blacklist
20 # these do not work with demandimport, blacklist
14 demandimport.ignore.extend([
21 demandimport.ignore.extend([
15 'bzrlib.transactions',
22 'bzrlib.transactions',
@@ -17,42 +24,42 b' demandimport.ignore.extend(['
17 'ElementPath',
24 'ElementPath',
18 ])
25 ])
19
26
20 from mercurial.i18n import _
21 from mercurial import error
22 from common import NoRepo, commit, converter_source
23
24 try:
27 try:
25 # bazaar imports
28 # bazaar imports
26 from bzrlib import bzrdir, revision, errors
29 from bzrlib import (
30 bzrdir,
31 errors,
32 revision,
33 )
27 from bzrlib.revisionspec import RevisionSpec
34 from bzrlib.revisionspec import RevisionSpec
28 except ImportError:
35 except ImportError:
29 pass
36 pass
30
37
31 supportedkinds = ('file', 'symlink')
38 supportedkinds = ('file', 'symlink')
32
39
33 class bzr_source(converter_source):
40 class bzr_source(common.converter_source):
34 """Reads Bazaar repositories by using the Bazaar Python libraries"""
41 """Reads Bazaar repositories by using the Bazaar Python libraries"""
35
42
36 def __init__(self, ui, path, revs=None):
43 def __init__(self, ui, path, revs=None):
37 super(bzr_source, self).__init__(ui, path, revs=revs)
44 super(bzr_source, self).__init__(ui, path, revs=revs)
38
45
39 if not os.path.exists(os.path.join(path, '.bzr')):
46 if not os.path.exists(os.path.join(path, '.bzr')):
40 raise NoRepo(_('%s does not look like a Bazaar repository')
47 raise common.NoRepo(_('%s does not look like a Bazaar repository')
41 % path)
48 % path)
42
49
43 try:
50 try:
44 # access bzrlib stuff
51 # access bzrlib stuff
45 bzrdir
52 bzrdir
46 except NameError:
53 except NameError:
47 raise NoRepo(_('Bazaar modules could not be loaded'))
54 raise common.NoRepo(_('Bazaar modules could not be loaded'))
48
55
49 path = os.path.abspath(path)
56 path = os.path.abspath(path)
50 self._checkrepotype(path)
57 self._checkrepotype(path)
51 try:
58 try:
52 self.sourcerepo = bzrdir.BzrDir.open(path).open_repository()
59 self.sourcerepo = bzrdir.BzrDir.open(path).open_repository()
53 except errors.NoRepositoryPresent:
60 except errors.NoRepositoryPresent:
54 raise NoRepo(_('%s does not look like a Bazaar repository')
61 raise common.NoRepo(_('%s does not look like a Bazaar repository')
55 % path)
62 % path)
56 self._parentids = {}
63 self._parentids = {}
57
64
58 def _checkrepotype(self, path):
65 def _checkrepotype(self, path):
@@ -160,7 +167,7 b' class bzr_source(converter_source):'
160 branch = self.recode(rev.properties.get('branch-nick', u'default'))
167 branch = self.recode(rev.properties.get('branch-nick', u'default'))
161 if branch == 'trunk':
168 if branch == 'trunk':
162 branch = 'default'
169 branch = 'default'
163 return commit(parents=parents,
170 return common.commit(parents=parents,
164 date='%d %d' % (rev.timestamp, -rev.timezone),
171 date='%d %d' % (rev.timestamp, -rev.timezone),
165 author=self.recode(rev.committer),
172 author=self.recode(rev.committer),
166 desc=self.recode(rev.message),
173 desc=self.recode(rev.message),
@@ -22,7 +22,6 b''
22 hgext/__init__.py not using absolute_import
22 hgext/__init__.py not using absolute_import
23 hgext/color.py not using absolute_import
23 hgext/color.py not using absolute_import
24 hgext/convert/__init__.py not using absolute_import
24 hgext/convert/__init__.py not using absolute_import
25 hgext/convert/bzr.py not using absolute_import
26 hgext/convert/cvs.py not using absolute_import
25 hgext/convert/cvs.py not using absolute_import
27 hgext/convert/transport.py not using absolute_import
26 hgext/convert/transport.py not using absolute_import
28 hgext/eol.py not using absolute_import
27 hgext/eol.py not using absolute_import
General Comments 0
You need to be logged in to leave comments. Login now