/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: 2019-08-24 13:40:34 UTC
  • mto: This revision was merged to the branch mainline in revision 7384.
  • Revision ID: jelmer@jelmer.uk-20190824134034-ct9u01cymnx1i240
Ignore __pycache__ directories.

Show diffs side-by-side

added added

removed removed

Lines of Context:
57
57
from .tree import entry_factory
58
58
 
59
59
 
 
60
class SettingCustomFileIdsUnsupported(UnsupportedOperation):
 
61
 
 
62
    _fmt = ("Unable to store addition of file with custom file ids: "
 
63
            "%(file_ids)r")
 
64
 
 
65
    def __init__(self, file_ids):
 
66
        BzrError.__init__(self)
 
67
        self.file_ids = file_ids
 
68
 
 
69
 
60
70
class GitCommitBuilder(CommitBuilder):
61
71
    """Commit builder for Git repositories."""
62
72
 
70
80
        self._blobs = {}
71
81
        self._inv_delta = []
72
82
        self._any_changes = False
 
83
        self._override_fileids = {}
73
84
        self._mapping = self.repository.get_mapping()
74
85
 
75
86
    def any_changes(self):
132
143
            self._blobs[encoded_new_path] = (mode, sha)
133
144
            if st is not None:
134
145
                yield change.path[1], (entry.text_sha1, st)
 
146
            if self._mapping.generate_file_id(encoded_new_path) != change.file_id:
 
147
                self._override_fileids[encoded_new_path] = change.file_id
135
148
        if not seen_root and len(self.parents) == 0:
136
149
            raise RootMissing()
137
150
        if getattr(workingtree, "basis_tree", False):
147
160
            if entry.path in self._blobs:
148
161
                continue
149
162
            self._blobs[entry.path] = (entry.mode, entry.sha)
 
163
        if not self._lossy:
 
164
            if self._override_fileids:
 
165
                raise SettingCustomFileIdsUnsupported(self._override_fileids)
150
166
        self.new_inventory = None
151
167
 
152
168
    def update_basis(self, tree):