hgext/convert/bzr.py
changeset 28479 d62b00318c19
parent 28411 098bb5660580
child 29205 a0939666b836
equal deleted inserted replaced
28478:e6e183687545 28479:d62b00318c19
    24         'ElementPath',
    24         'ElementPath',
    25     ])
    25     ])
    26 
    26 
    27 try:
    27 try:
    28     # bazaar imports
    28     # bazaar imports
    29     from bzrlib import (
    29     import bzrlib.bzrdir
    30         bzrdir,
    30     import bzrlib.errors
    31         errors,
    31     import bzrlib.revision
    32         revision,
    32     import bzrlib.revisionspec.RevisionSpec
    33     )
    33     bzrdir = bzrlib.bzrdir
    34     from bzrlib.revisionspec import RevisionSpec
    34     errors = bzrlib.errors
       
    35     revision = bzrlib.revision
       
    36     revisionspec = bzrlib.revisionspec
    35 except ImportError:
    37 except ImportError:
    36     pass
    38     pass
    37 
    39 
    38 supportedkinds = ('file', 'symlink')
    40 supportedkinds = ('file', 'symlink')
    39 
    41 
    64 
    66 
    65     def _checkrepotype(self, path):
    67     def _checkrepotype(self, path):
    66         # Lightweight checkouts detection is informational but probably
    68         # Lightweight checkouts detection is informational but probably
    67         # fragile at API level. It should not terminate the conversion.
    69         # fragile at API level. It should not terminate the conversion.
    68         try:
    70         try:
    69             from bzrlib import bzrdir
       
    70             dir = bzrdir.BzrDir.open_containing(path)[0]
    71             dir = bzrdir.BzrDir.open_containing(path)[0]
    71             try:
    72             try:
    72                 tree = dir.open_workingtree(recommend_upgrade=False)
    73                 tree = dir.open_workingtree(recommend_upgrade=False)
    73                 branch = tree.branch
    74                 branch = tree.branch
    74             except (errors.NoWorkingTree, errors.NotLocalUrl):
    75             except (errors.NoWorkingTree, errors.NotLocalUrl):
   107             heads = sorted([b.last_revision() for b in self._bzrbranches()])
   108             heads = sorted([b.last_revision() for b in self._bzrbranches()])
   108         else:
   109         else:
   109             revid = None
   110             revid = None
   110             for branch in self._bzrbranches():
   111             for branch in self._bzrbranches():
   111                 try:
   112                 try:
   112                     r = RevisionSpec.from_string(self.revs[0])
   113                     r = revisionspec.RevisionSpec.from_string(self.revs[0])
   113                     info = r.in_history(branch)
   114                     info = r.in_history(branch)
   114                 except errors.BzrError:
   115                 except errors.BzrError:
   115                     pass
   116                     pass
   116                 revid = info.rev_id
   117                 revid = info.rev_id
   117             if revid is None:
   118             if revid is None: