/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: Breezy landing bot
  • Author(s): Jelmer Vernooij
  • Date: 2020-02-03 23:21:15 UTC
  • mfrom: (7290.42.6 paramiko-compat)
  • Revision ID: breezy.the.bot@gmail.com-20200203232115-g7k11bhsfeiqcprv
Fix compatibility with newer versions of paramiko, which break on noise before keys in pem files.

Merged from https://code.launchpad.net/~jelmer/brz/paramiko-compat/+merge/378480

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