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

  • Committer: Jelmer Vernooij
  • Date: 2018-05-15 19:05:51 UTC
  • mfrom: (6968 work)
  • mto: (6973.5.1 python3-c)
  • mto: This revision was merged to the branch mainline in revision 6984.
  • Revision ID: jelmer@jelmer.uk-20180515190551-epr5abd0mtxmrehr
merge trunk

Show diffs side-by-side

added added

removed removed

Lines of Context:
30
30
    tree_lookup_path,
31
31
    )
32
32
from dulwich.walk import Walker
33
 
from itertools import (
34
 
    imap,
35
 
    )
36
33
import posixpath
37
34
import stat
38
35
 
92
89
    )
93
90
 
94
91
 
95
 
def import_git_blob(texts, mapping, path, name, (base_hexsha, hexsha),
 
92
def import_git_blob(texts, mapping, path, name, hexshas,
96
93
        base_bzr_tree, parent_id, revision_id,
97
 
        parent_bzr_trees, lookup_object, (base_mode, mode), store_updater,
 
94
        parent_bzr_trees, lookup_object, modes, store_updater,
98
95
        lookup_file_id):
99
96
    """Import a git blob object into a bzr repository.
100
97
 
103
100
    :param blob: A git blob
104
101
    :return: Inventory delta for this file
105
102
    """
 
103
    (base_mode, mode) = modes
 
104
    (base_hexsha, hexsha) = hexshas
106
105
    if mapping.is_special_file(path):
107
106
        return []
108
107
    if base_hexsha == hexsha and base_mode == mode:
133
132
            ie.revision = None
134
133
            ie.symlink_target = blob.data.decode("utf-8")
135
134
        else:
136
 
            ie.text_size = sum(imap(len, blob.chunked))
 
135
            ie.text_size = sum(map(len, blob.chunked))
137
136
            ie.text_sha1 = osutils.sha_strings(blob.chunked)
138
137
    # Check what revision we should store
139
138
    parent_keys = []
186
185
    internal = False
187
186
 
188
187
 
189
 
def import_git_submodule(texts, mapping, path, name, (base_hexsha, hexsha),
 
188
def import_git_submodule(texts, mapping, path, name, hexshas,
190
189
    base_bzr_tree, parent_id, revision_id, parent_bzr_trees, lookup_object,
191
 
    (base_mode, mode), store_updater, lookup_file_id):
 
190
    modes, store_updater, lookup_file_id):
192
191
    """Import a git submodule."""
 
192
    (base_hexsha, hexsha) = hexshas
 
193
    (base_mode, mode) = modes
193
194
    if base_hexsha == hexsha and base_mode == mode:
194
195
        return [], {}
195
196
    file_id = lookup_file_id(path)
239
240
    return ret
240
241
 
241
242
 
242
 
def import_git_tree(texts, mapping, path, name, (base_hexsha, hexsha),
 
243
def import_git_tree(texts, mapping, path, name, hexshas,
243
244
        base_bzr_tree, parent_id, revision_id, parent_bzr_trees,
244
 
        lookup_object, (base_mode, mode), store_updater,
 
245
        lookup_object, modes, store_updater,
245
246
        lookup_file_id, allow_submodules=False):
246
247
    """Import a git tree object into a bzr repository.
247
248
 
252
253
    :param base_bzr_tree: Base inventory against which to return inventory delta
253
254
    :return: Inventory delta for this subtree
254
255
    """
 
256
    (base_hexsha, hexsha) = hexshas
 
257
    (base_mode, mode) = modes
255
258
    if type(path) is not str:
256
259
        raise TypeError(path)
257
260
    if type(name) is not str:
317
320
        child_modes.update(grandchildmodes)
318
321
        invdelta.extend(subinvdelta)
319
322
        if child_mode not in (stat.S_IFDIR, DEFAULT_FILE_MODE,
320
 
                        stat.S_IFLNK, DEFAULT_FILE_MODE|0111,
 
323
                        stat.S_IFLNK, DEFAULT_FILE_MODE|0o111,
321
324
                        S_IFGITLINK):
322
325
            child_modes[child_path] = child_mode
323
326
    # Remove any children that have disappeared