114
114
'text_id', 'parent_id', 'children', 'executable',
117
def _add_text_to_weave(self, new_lines, parents, weave_store):
118
weave_store.add_text(self.file_id, self.revision, new_lines, parents)
117
def _add_text_to_weave(self, new_lines, parents, weave_store, transaction):
118
weave_store.add_text(self.file_id, self.revision, new_lines, parents,
120
121
def detect_changes(self, old_entry):
121
122
"""Return a (text_modified, meta_modified) from this to old_entry.
165
166
ie = inv[self.file_id]
166
167
assert ie.file_id == self.file_id
167
168
if ie.revision in heads:
169
# fixup logic, there was a bug in revision updates.
170
# with x bit support.
172
if heads[ie.revision].executable != ie.executable:
173
heads[ie.revision].executable = False
174
ie.executable = False
175
except AttributeError:
168
177
assert heads[ie.revision] == ie
170
179
# may want to add it.
312
321
def snapshot(self, revision, path, previous_entries,
313
work_tree, weave_store):
322
work_tree, weave_store, transaction):
314
323
"""Make a snapshot of this entry which may or may not have changed.
316
325
This means that all its fields are populated, that it has its
326
335
self.revision = parent_ie.revision
327
336
return "unchanged"
328
337
return self.snapshot_revision(revision, previous_entries,
329
work_tree, weave_store)
338
work_tree, weave_store, transaction)
331
340
def snapshot_revision(self, revision, previous_entries, work_tree,
341
weave_store, transaction):
333
342
"""Record this revision unconditionally."""
334
343
mutter('new revision for {%s}', self.file_id)
335
344
self.revision = revision
336
345
change = self._get_snapshot_change(previous_entries)
337
self._snapshot_text(previous_entries, work_tree, weave_store)
346
self._snapshot_text(previous_entries, work_tree, weave_store,
340
def _snapshot_text(self, file_parents, work_tree, weave_store):
350
def _snapshot_text(self, file_parents, work_tree, weave_store, transaction):
341
351
"""Record the 'text' of this entry, whatever form that takes.
343
353
This default implementation simply adds an empty text.
345
355
mutter('storing file {%s} in revision {%s}',
346
356
self.file_id, self.revision)
347
self._add_text_to_weave([], file_parents, weave_store)
357
self._add_text_to_weave([], file_parents, weave_store, transaction)
349
359
def __eq__(self, other):
350
360
if not isinstance(other, InventoryEntry):
539
549
self.text_sha1 = work_tree.get_file_sha1(self.file_id)
540
550
self.executable = work_tree.is_executable(self.file_id)
542
def _snapshot_text(self, file_parents, work_tree, weave_store):
552
def _snapshot_text(self, file_parents, work_tree, weave_store, transaction):
543
553
"""See InventoryEntry._snapshot_text."""
544
554
mutter('storing file {%s} in revision {%s}',
545
555
self.file_id, self.revision)
551
561
previous_ie = file_parents.values()[0]
552
562
weave_store.add_identical_text(
553
563
self.file_id, previous_ie.revision,
554
self.revision, file_parents)
564
self.revision, file_parents, transaction)
556
566
new_lines = work_tree.get_file(self.file_id).readlines()
557
self._add_text_to_weave(new_lines, file_parents, weave_store)
567
self._add_text_to_weave(new_lines, file_parents, weave_store,
558
569
self.text_sha1 = sha_strings(new_lines)
559
570
self.text_size = sum(map(len, new_lines))