/brz/remove-bazaar

To get this branch, use:
bzr branch http://gegoxaren.bato24.eu/bzr/brz/remove-bazaar

« back to all changes in this revision

Viewing changes to breezy/fetch_ghosts.py

  • Committer: Breezy landing bot
  • Author(s): Jelmer Vernooij
  • Date: 2020-07-28 02:47:10 UTC
  • mfrom: (7519.1.1 merge-3.1)
  • Revision ID: breezy.the.bot@gmail.com-20200728024710-a2ylds219f1lsl62
Merge lp:brz/3.1.

Merged from https://code.launchpad.net/~jelmer/brz/merge-3.1/+merge/388173

Show diffs side-by-side

added added

removed removed

Lines of Context:
14
14
# along with this program; if not, write to the Free Software
15
15
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
16
16
 
17
 
from __future__ import absolute_import
 
17
import contextlib
18
18
 
19
 
from . import cleanup
20
19
from .branch import Branch
21
20
from .trace import note
22
 
from .errors import NoSuchRevision, BzrCommandError
 
21
from .errors import NoSuchRevision, CommandError
23
22
 
24
23
 
25
24
class GhostFetcher(object):
30
29
        if other is None:
31
30
            other = this_branch.get_parent()
32
31
            if other is None:
33
 
                raise BzrCommandError('No branch specified and no location'
 
32
                raise CommandError('No branch specified and no location'
34
33
                                      ' saved.')
35
34
            else:
36
35
                note("Using saved location %s.", other)
43
42
 
44
43
    def run(self):
45
44
        lock_other = self.this_branch.base != self.other_branch.base
46
 
        with cleanup.ExitStack() as exit_stack:
 
45
        with contextlib.ExitStack() as exit_stack:
47
46
            exit_stack.enter_context(self.this_branch.lock_write())
48
47
            if lock_other:
49
48
                exit_stack.enter_context(self.other_branch.lock_read())