/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/plugins/fastimport/helpers.py

  • Committer: Jelmer Vernooij
  • Date: 2017-06-10 00:52:08 UTC
  • mfrom: (6675 work)
  • mto: (6670.4.8 move-bzr)
  • mto: This revision was merged to the branch mainline in revision 6681.
  • Revision ID: jelmer@jelmer.uk-20170610005208-dthx80fkolfpsenj
Merge trunk.

Show diffs side-by-side

added added

removed removed

Lines of Context:
19
19
 
20
20
import stat
21
21
 
 
22
from ... import (
 
23
    controldir,
 
24
    )
 
25
 
22
26
 
23
27
def escape_commit_message(message):
24
28
    """Replace xml-incompatible control characters."""
52
56
    from ... import bzrdir
53
57
    repo_format = repo._format
54
58
    candidates  = []
55
 
    non_aliases = set(bzrdir.format_registry.keys())
56
 
    non_aliases.difference_update(bzrdir.format_registry.aliases())
 
59
    non_aliases = set(controldir.format_registry.keys())
 
60
    non_aliases.difference_update(controldir.format_registry.aliases())
57
61
    for key in non_aliases:
58
 
        format = bzrdir.format_registry.make_bzrdir(key)
 
62
        format = controldir.format_registry.make_bzrdir(key)
59
63
        # LocalGitBzrDirFormat has no repository_format
60
64
        if hasattr(format, "repository_format"):
61
65
            if format.repository_format == repo_format:
81
85
    :return: BzrDir for the destination
82
86
    """
83
87
    import os
84
 
    from ... import bzrdir, errors, trace, transport
 
88
    from ... import controldir, errors, trace, transport
85
89
    try:
86
 
        control, relpath = bzrdir.BzrDir.open_containing(location)
 
90
        control, relpath = controldir.ControlDir.open_containing(location)
87
91
        # XXX: Check the relpath is None here?
88
92
        return control
89
93
    except errors.NotBranchError:
105
109
    # Create a repository for the nominated format.
106
110
    trace.note("Creating destination repository ...")
107
111
    if format is None:
108
 
        format = bzrdir.format_registry.make_bzrdir('default')
 
112
        format = controldir.format_registry.make_bzrdir('default')
109
113
    to_transport = transport.get_transport(location)
110
114
    to_transport.ensure_base()
111
115
    control = format.initialize_on_transport(to_transport)
181
185
    """Invert a dictionary with keys matching a set of values, turned into lists."""
182
186
    # Based on recipe from ASPN
183
187
    result = {}
184
 
    for k, c in d.iteritems():
 
188
    for k, c in d.items():
185
189
        for v in c:
186
190
            keys = result.setdefault(v, [])
187
191
            keys.append(k)
192
196
    """Invert a dictionary with keys matching each value turned into a list."""
193
197
    # Based on recipe from ASPN
194
198
    result = {}
195
 
    for k, v in d.iteritems():
 
199
    for k, v in d.items():
196
200
        keys = result.setdefault(v, [])
197
201
        keys.append(k)
198
202
    return result