/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: Breezy landing bot
  • Author(s): Jelmer Vernooij
  • Date: 2020-06-24 02:46:36 UTC
  • mfrom: (7517.1.1 trunk-3.5)
  • Revision ID: breezy.the.bot@gmail.com-20200624024636-nea4994cfz3aymn8
Update installation instructions, explaining need for Python 3.5+ and optional dependencies.

Merged from https://code.launchpad.net/~jelmer/brz/trunk-3.5/+merge/386230

Show diffs side-by-side

added added

removed removed

Lines of Context:
17
17
 
18
18
"""Support for committing in native Git working trees."""
19
19
 
20
 
from __future__ import absolute_import
21
 
 
22
20
from dulwich.index import (
23
21
    commit_tree,
24
22
    )
39
37
from ..repository import (
40
38
    CommitBuilder,
41
39
    )
42
 
from ..sixish import (
43
 
    viewitems,
44
 
    )
45
40
 
46
41
from dulwich.objects import (
47
42
    Blob,
69
64
        self.store = self.repository._git.object_store
70
65
        self._blobs = {}
71
66
        self._inv_delta = []
 
67
        self._deleted_paths = set()
72
68
        self._any_changes = False
73
69
        self._mapping = self.repository.get_mapping()
74
70
 
92
88
            self._any_changes = True
93
89
            if change.path[1] is None:
94
90
                self._inv_delta.append((change.path[0], change.path[1], change.file_id, None))
95
 
                self._blobs[change.path[0].encode("utf-8")] = None
 
91
                self._deleted_paths.add(change.path[0].encode("utf-8"))
96
92
                continue
97
93
            try:
98
94
                entry_kls = entry_factory[change.kind[1]]
128
124
                raise AssertionError("Unknown kind %r" % change.kind[1])
129
125
            mode = object_mode(change.kind[1], change.executable[1])
130
126
            self._inv_delta.append((change.path[0], change.path[1], change.file_id, entry))
131
 
            encoded_new_path = change.path[1].encode("utf-8")
132
 
            self._blobs[encoded_new_path] = (mode, sha)
 
127
            if change.path[0] is not None:
 
128
                self._deleted_paths.add(change.path[0].encode("utf-8"))
 
129
            self._blobs[change.path[1].encode("utf-8")] = (mode, sha)
133
130
            if st is not None:
134
131
                yield change.path[1], (entry.text_sha1, st)
135
132
        if not seen_root and len(self.parents) == 0:
146
143
        for entry in basis_tree._iter_tree_contents(include_trees=False):
147
144
            if entry.path in self._blobs:
148
145
                continue
 
146
            if entry.path in self._deleted_paths:
 
147
                continue
149
148
            self._blobs[entry.path] = (entry.mode, entry.sha)
150
149
        self.new_inventory = None
151
150
 
155
154
 
156
155
    def finish_inventory(self):
157
156
        # eliminate blobs that were removed
158
 
        self._blobs = {k: v for (k, v) in viewitems(
159
 
            self._blobs) if v is not None}
 
157
        self._blobs = {k: v for (k, v) in self._blobs.items()}
160
158
 
161
159
    def _iterblobs(self):
162
160
        return ((path, sha, mode) for (path, (mode, sha))
163
 
                in viewitems(self._blobs))
 
161
                in self._blobs.items())
164
162
 
165
163
    def commit(self, message):
166
164
        self._validate_unicode_text(message, 'commit message')