/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: Jelmer Vernooij
  • Date: 2018-02-18 21:42:57 UTC
  • mto: This revision was merged to the branch mainline in revision 6859.
  • Revision ID: jelmer@jelmer.uk-20180218214257-jpevutp1wa30tz3v
Update TODO to reference Breezy, not Bazaar.

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
 
import contextlib
 
17
from __future__ import absolute_import
18
18
 
19
19
from .branch import Branch
20
20
from .trace import note
21
 
from .errors import NoSuchRevision, CommandError
 
21
from .errors import NoSuchRevision, BzrCommandError
22
22
 
23
23
 
24
24
class GhostFetcher(object):
29
29
        if other is None:
30
30
            other = this_branch.get_parent()
31
31
            if other is None:
32
 
                raise CommandError('No branch specified and no location'
 
32
                raise BzrCommandError('No branch specified and no location'
33
33
                                      ' saved.')
34
34
            else:
35
35
                note("Using saved location %s.", other)
42
42
 
43
43
    def run(self):
44
44
        lock_other = self.this_branch.base != self.other_branch.base
45
 
        with contextlib.ExitStack() as exit_stack:
46
 
            exit_stack.enter_context(self.this_branch.lock_write())
 
45
        self.this_branch.lock_write()
 
46
        try:
47
47
            if lock_other:
48
 
                exit_stack.enter_context(self.other_branch.lock_read())
49
 
            return self._run_locked()
 
48
                self.other_branch.lock_read()
 
49
            try:
 
50
                return self._run_locked()
 
51
            finally:
 
52
                if lock_other:
 
53
                    self.other_branch.unlock()
 
54
        finally:
 
55
            self.this_branch.unlock()
50
56
 
51
57
    def iter_ghosts(self):
52
58
        """Find all ancestors that aren't stored in this branch."""