/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/branch.py

  • Committer: Jelmer Vernooij
  • Date: 2020-02-07 02:14:30 UTC
  • mto: This revision was merged to the branch mainline in revision 7492.
  • Revision ID: jelmer@jelmer.uk-20200207021430-m49iq3x4x8xlib6x
Drop python2 support.

Show diffs side-by-side

added added

removed removed

Lines of Context:
18
18
 
19
19
from .lazy_import import lazy_import
20
20
lazy_import(globals(), """
 
21
import contextlib
21
22
import itertools
22
23
from breezy import (
23
 
    cleanup,
24
24
    config as _mod_config,
25
25
    debug,
26
26
    memorytree,
47
47
from .hooks import Hooks
48
48
from .inter import InterObject
49
49
from .lock import LogicalLockResult
50
 
from .sixish import (
51
 
    text_type,
52
 
    viewitems,
53
 
    )
54
50
from .trace import mutter, mutter_callsite, note, is_quiet, warning
55
51
 
56
52
 
371
367
                raise errors.GhostRevisionsHaveNoRevno(revno[0], e.revision_id)
372
368
        revision_id_to_revno = self.get_revision_id_to_revno_map()
373
369
        revision_ids = [revision_id for revision_id, this_revno
374
 
                        in viewitems(revision_id_to_revno)
 
370
                        in revision_id_to_revno.items()
375
371
                        if revno == this_revno]
376
372
        if len(revision_ids) == 1:
377
373
            return revision_ids[0]
779
775
        # FIXUP this and get_parent in a future branch format bump:
780
776
        # read and rewrite the file. RBC 20060125
781
777
        if url is not None:
782
 
            if isinstance(url, text_type):
 
778
            if isinstance(url, str):
783
779
                try:
784
780
                    url.encode('ascii')
785
781
                except UnicodeEncodeError:
2213
2209
            is being called because it's the master of the primary branch,
2214
2210
            so it should not run its hooks.
2215
2211
        """
2216
 
        with cleanup.ExitStack() as exit_stack:
 
2212
        with contextlib.ExitStack() as exit_stack:
2217
2213
            exit_stack.enter_context(self.target.lock_write())
2218
2214
            bound_location = self.target.get_bound_location()
2219
2215
            if local and not bound_location:
2392
2388
        old_base = self.source.base
2393
2389
        new_base = self.target.base
2394
2390
        target_reference_dict = self.target._get_all_reference_info()
2395
 
        for tree_path, (branch_location, file_id) in viewitems(reference_dict):
 
2391
        for tree_path, (branch_location, file_id) in reference_dict.items():
2396
2392
            try:
2397
2393
                branch_location = urlutils.rebase_url(branch_location,
2398
2394
                                                      old_base, new_base)