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