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.
312
313
def snapshot(self, revision, path, previous_entries,
313
work_tree, weave_store):
314
work_tree, weave_store, transaction):
314
315
"""Make a snapshot of this entry which may or may not have changed.
316
317
This means that all its fields are populated, that it has its
326
327
self.revision = parent_ie.revision
327
328
return "unchanged"
328
329
return self.snapshot_revision(revision, previous_entries,
329
work_tree, weave_store)
330
work_tree, weave_store, transaction)
331
332
def snapshot_revision(self, revision, previous_entries, work_tree,
333
weave_store, transaction):
333
334
"""Record this revision unconditionally."""
334
335
mutter('new revision for {%s}', self.file_id)
335
336
self.revision = revision
336
337
change = self._get_snapshot_change(previous_entries)
337
self._snapshot_text(previous_entries, work_tree, weave_store)
338
self._snapshot_text(previous_entries, work_tree, weave_store,
340
def _snapshot_text(self, file_parents, work_tree, weave_store):
342
def _snapshot_text(self, file_parents, work_tree, weave_store, transaction):
341
343
"""Record the 'text' of this entry, whatever form that takes.
343
345
This default implementation simply adds an empty text.
345
347
mutter('storing file {%s} in revision {%s}',
346
348
self.file_id, self.revision)
347
self._add_text_to_weave([], file_parents, weave_store)
349
self._add_text_to_weave([], file_parents, weave_store, transaction)
349
351
def __eq__(self, other):
350
352
if not isinstance(other, InventoryEntry):
539
541
self.text_sha1 = work_tree.get_file_sha1(self.file_id)
540
542
self.executable = work_tree.is_executable(self.file_id)
542
def _snapshot_text(self, file_parents, work_tree, weave_store):
544
def _snapshot_text(self, file_parents, work_tree, weave_store, transaction):
543
545
"""See InventoryEntry._snapshot_text."""
544
546
mutter('storing file {%s} in revision {%s}',
545
547
self.file_id, self.revision)
551
553
previous_ie = file_parents.values()[0]
552
554
weave_store.add_identical_text(
553
555
self.file_id, previous_ie.revision,
554
self.revision, file_parents)
556
self.revision, file_parents, transaction)
556
558
new_lines = work_tree.get_file(self.file_id).readlines()
557
self._add_text_to_weave(new_lines, file_parents, weave_store)
559
self._add_text_to_weave(new_lines, file_parents, weave_store,
558
561
self.text_sha1 = sha_strings(new_lines)
559
562
self.text_size = sum(map(len, new_lines))