comparison hgext/convert/bzr.py @ 7973:db3a68fd9387

convert: attempt to check repo type before checking for tool
author Matt Mackall <mpm@selenic.com>
date Sat, 04 Apr 2009 12:28:13 -0500
parents 972cce34f345
children ffbebfb6b8d4
comparison
equal deleted inserted replaced
7972:425a30ddfff6 7973:db3a68fd9387
25 """Reads Bazaar repositories by using the Bazaar Python libraries""" 25 """Reads Bazaar repositories by using the Bazaar Python libraries"""
26 26
27 def __init__(self, ui, path, rev=None): 27 def __init__(self, ui, path, rev=None):
28 super(bzr_source, self).__init__(ui, path, rev=rev) 28 super(bzr_source, self).__init__(ui, path, rev=rev)
29 29
30 if not os.path.exists(os.path.join(path, '.bzr')):
31 raise NoRepo('%s does not look like a Bazaar repo' % path)
32
30 try: 33 try:
31 # access bzrlib stuff 34 # access bzrlib stuff
32 branch 35 branch
33 except NameError: 36 except NameError:
34 raise NoRepo('Bazaar modules could not be loaded') 37 raise NoRepo('Bazaar modules could not be loaded')
35
36 if not os.path.exists(os.path.join(path, '.bzr')):
37 raise NoRepo('%s does not look like a Bazaar repo' % path)
38 38
39 path = os.path.abspath(path) 39 path = os.path.abspath(path)
40 self.branch = branch.Branch.open(path) 40 self.branch = branch.Branch.open(path)
41 self.sourcerepo = self.branch.repository 41 self.sourcerepo = self.branch.repository
42 self._parentids = {} 42 self._parentids = {}