/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-07-05 12:50:01 UTC
  • mfrom: (7490.40.46 work)
  • mto: (7490.40.48 work)
  • mto: This revision was merged to the branch mainline in revision 7519.
  • Revision ID: jelmer@jelmer.uk-20200705125001-7s3vo0p55szbbws7
Merge lp:brz/3.1.

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
 
18
 
17
19
from .lazy_import import lazy_import
18
20
lazy_import(globals(), """
19
 
import contextlib
20
21
import itertools
21
22
from breezy import (
 
23
    cleanup,
22
24
    config as _mod_config,
23
25
    debug,
24
26
    memorytree,
45
47
from .hooks import Hooks
46
48
from .inter import InterObject
47
49
from .lock import LogicalLockResult
 
50
from .sixish import (
 
51
    text_type,
 
52
    viewitems,
 
53
    )
48
54
from .trace import mutter, mutter_callsite, note, is_quiet, warning
49
55
 
50
56
 
365
371
                raise errors.GhostRevisionsHaveNoRevno(revno[0], e.revision_id)
366
372
        revision_id_to_revno = self.get_revision_id_to_revno_map()
367
373
        revision_ids = [revision_id for revision_id, this_revno
368
 
                        in revision_id_to_revno.items()
 
374
                        in viewitems(revision_id_to_revno)
369
375
                        if revno == this_revno]
370
376
        if len(revision_ids) == 1:
371
377
            return revision_ids[0]
773
779
        # FIXUP this and get_parent in a future branch format bump:
774
780
        # read and rewrite the file. RBC 20060125
775
781
        if url is not None:
776
 
            if isinstance(url, str):
 
782
            if isinstance(url, text_type):
777
783
                try:
778
784
                    url.encode('ascii')
779
785
                except UnicodeEncodeError:
2217
2223
            is being called because it's the master of the primary branch,
2218
2224
            so it should not run its hooks.
2219
2225
        """
2220
 
        with contextlib.ExitStack() as exit_stack:
 
2226
        with cleanup.ExitStack() as exit_stack:
2221
2227
            exit_stack.enter_context(self.target.lock_write())
2222
2228
            bound_location = self.target.get_bound_location()
2223
2229
            if local and not bound_location:
2402
2408
        old_base = self.source.base
2403
2409
        new_base = self.target.base
2404
2410
        target_reference_dict = self.target._get_all_reference_info()
2405
 
        for tree_path, (branch_location, file_id) in reference_dict.items():
 
2411
        for tree_path, (branch_location, file_id) in viewitems(reference_dict):
2406
2412
            try:
2407
2413
                branch_location = urlutils.rebase_url(branch_location,
2408
2414
                                                      old_base, new_base)