/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/git/fetch.py

  • Committer: Jelmer Vernooij
  • Date: 2020-02-21 03:58:42 UTC
  • mfrom: (7490.3.4 work)
  • mto: This revision was merged to the branch mainline in revision 7495.
  • Revision ID: jelmer@jelmer.uk-20200221035842-j97r6b74q8cgxb21
merge lp:brz/3.1.

Show diffs side-by-side

added added

removed removed

Lines of Context:
62
62
 
63
63
from .mapping import (
64
64
    DEFAULT_FILE_MODE,
65
 
    decode_git_path,
66
65
    mode_is_executable,
67
66
    mode_kind,
68
67
    warn_unusual_mode,
86
85
    """
87
86
    if not isinstance(path, bytes):
88
87
        raise TypeError(path)
89
 
    decoded_path = decode_git_path(path)
 
88
    decoded_path = path.decode('utf-8')
90
89
    (base_mode, mode) = modes
91
90
    (base_hexsha, hexsha) = hexshas
92
91
    if mapping.is_special_file(path):
99
98
        cls = InventoryLink
100
99
    else:
101
100
        cls = InventoryFile
102
 
    ie = cls(file_id, decode_git_path(name), parent_id)
 
101
    ie = cls(file_id, name.decode("utf-8"), parent_id)
103
102
    if ie.kind == "file":
104
103
        ie.executable = mode_is_executable(mode)
105
104
    if base_hexsha == hexsha and mode_kind(base_mode) == mode_kind(mode):
117
116
        blob = lookup_object(hexsha)
118
117
        if ie.kind == "symlink":
119
118
            ie.revision = None
120
 
            ie.symlink_target = decode_git_path(blob.data)
 
119
            ie.symlink_target = blob.data.decode("utf-8")
121
120
        else:
122
121
            ie.text_size = sum(map(len, blob.chunked))
123
122
            ie.text_sha1 = osutils.sha_strings(blob.chunked)
184
183
    (base_mode, mode) = modes
185
184
    if base_hexsha == hexsha and base_mode == mode:
186
185
        return [], {}
187
 
    path = decode_git_path(path)
 
186
    path = path.decode('utf-8')
188
187
    file_id = lookup_file_id(path)
189
188
    invdelta = []
190
 
    ie = TreeReference(file_id, decode_git_path(name), parent_id)
 
189
    ie = TreeReference(file_id, name.decode("utf-8"), parent_id)
191
190
    ie.revision = revision_id
192
191
    if base_hexsha is not None:
193
192
        old_path = path  # Renames are not supported yet
222
221
    for name, mode, hexsha in base_tree.iteritems():
223
222
        if name in existing_children:
224
223
            continue
225
 
        c_path = posixpath.join(path, decode_git_path(name))
 
224
        c_path = posixpath.join(path, name.decode("utf-8"))
226
225
        file_id = base_bzr_tree.path2id(c_path)
227
226
        if file_id is None:
228
227
            raise TypeError(file_id)
259
258
        return [], {}
260
259
    invdelta = []
261
260
    file_id = lookup_file_id(osutils.safe_unicode(path))
262
 
    ie = InventoryDirectory(file_id, decode_git_path(name), parent_id)
 
261
    # We just have to hope this is indeed utf-8:
 
262
    ie = InventoryDirectory(file_id, name.decode("utf-8"), parent_id)
263
263
    tree = lookup_object(hexsha)
264
264
    if base_hexsha is None:
265
265
        base_tree = None
266
266
        old_path = None  # Newly appeared here
267
267
    else:
268
268
        base_tree = lookup_object(base_hexsha)
269
 
        old_path = decode_git_path(path)  # Renames aren't supported yet
270
 
    new_path = decode_git_path(path)
 
269
        old_path = path.decode("utf-8")  # Renames aren't supported yet
 
270
    new_path = path.decode("utf-8")
271
271
    if base_tree is None or type(base_tree) is not Tree:
272
272
        ie.revision = revision_id
273
273
        invdelta.append((old_path, new_path, ie.file_id, ie))