/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/commit.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:
46
46
 
47
47
 
48
48
from .mapping import (
49
 
    encode_git_path,
50
49
    object_mode,
51
50
    fix_person_identifier,
52
51
    )
65
64
        self.store = self.repository._git.object_store
66
65
        self._blobs = {}
67
66
        self._inv_delta = []
68
 
        self._deleted_paths = set()
69
67
        self._any_changes = False
70
68
        self._mapping = self.repository.get_mapping()
71
69
 
81
79
                     entry_factory[change.kind[1]](
82
80
                         change.file_id, change.name[1], change.parent_id[1])))
83
81
                if change.kind[0] in ("file", "symlink"):
84
 
                    self._blobs[encode_git_path(change.path[0])] = None
 
82
                    self._blobs[change.path[0].encode("utf-8")] = None
85
83
                    self._any_changes = True
86
84
                if change.path[1] == "":
87
85
                    seen_root = True
89
87
            self._any_changes = True
90
88
            if change.path[1] is None:
91
89
                self._inv_delta.append((change.path[0], change.path[1], change.file_id, None))
92
 
                self._deleted_paths.add(encode_git_path(change.path[0]))
 
90
                self._blobs[change.path[0].encode("utf-8")] = None
93
91
                continue
94
92
            try:
95
93
                entry_kls = entry_factory[change.kind[1]]
111
109
            elif change.kind[1] == "symlink":
112
110
                symlink_target = workingtree.get_symlink_target(change.path[1])
113
111
                blob = Blob()
114
 
                blob.data = encode_git_path(symlink_target)
 
112
                blob.data = symlink_target.encode("utf-8")
115
113
                self.store.add_object(blob)
116
114
                sha = blob.id
117
115
                entry.symlink_target = symlink_target
125
123
                raise AssertionError("Unknown kind %r" % change.kind[1])
126
124
            mode = object_mode(change.kind[1], change.executable[1])
127
125
            self._inv_delta.append((change.path[0], change.path[1], change.file_id, entry))
128
 
            if change.path[0] is not None:
129
 
                self._deleted_paths.add(encode_git_path(change.path[0]))
130
 
            self._blobs[encode_git_path(change.path[1])] = (mode, sha)
 
126
            encoded_new_path = change.path[1].encode("utf-8")
 
127
            self._blobs[encoded_new_path] = (mode, sha)
131
128
            if st is not None:
132
129
                yield change.path[1], (entry.text_sha1, st)
133
130
        if not seen_root and len(self.parents) == 0:
144
141
        for entry in basis_tree._iter_tree_contents(include_trees=False):
145
142
            if entry.path in self._blobs:
146
143
                continue
147
 
            if entry.path in self._deleted_paths:
148
 
                continue
149
144
            self._blobs[entry.path] = (entry.mode, entry.sha)
150
145
        self.new_inventory = None
151
146
 
155
150
 
156
151
    def finish_inventory(self):
157
152
        # eliminate blobs that were removed
158
 
        self._blobs = {k: v for (k, v) in self._blobs.items()}
 
153
        self._blobs = {k: v for (k, v) in self._blobs.items() if v is not None}
159
154
 
160
155
    def _iterblobs(self):
161
156
        return ((path, sha, mode) for (path, (mode, sha))