332
def path_content_summary(self, path, file_id=None):
333
if path not in self._modified_paths:
334
# Return the content summary from the basis inventory
335
# kind, size, executable, sha
337
file_id = self._inventory.path2id(path)
338
if file_id not in self._base_inventory:
339
# Should only happen for the root
340
ie = self._inventory[file_id]
342
ie = self._base_inventory[file_id]
343
if ie.kind == 'file':
344
return (ie.kind, ie.text_size, ie.executable, ie.text_sha1)
346
return (ie.kind, None, None, None)
348
action, kind = self._modified_paths[path]
349
assert action != 'remove'
351
txt = self._texts[path]
352
executable = self._executable[path]
353
return (kind, len(txt), executable or False, None)
355
assert kind == 'directory'
356
return (kind, None, None, None)
332
358
def remove_file(self, path):
333
359
"""Remove a given file from the inventory."""
334
360
file_id = self._inventory.path2id(path)
403
429
timestamp=timestamp, timezone=timezone,
404
430
committer=committer, revprops=revprops,
405
431
revision_id=revision_id)
432
# XXX: Bazaar 0.92 broke api compatibility, the only way to detect it
433
# (other than inspecting version_info) is to count the number of
435
num_args = builder.record_entry_contents.func_code.co_argcount
437
use_path_content_summary = True
439
use_path_content_summary = False
407
441
for path, ie in self._inventory.iter_entries_by_dir():
408
442
new_ie = ie.copy()
418
452
if ie.parent_id is not None and ie.revision is None:
419
453
import pdb; pdb.set_trace()
421
builder.record_entry_contents(new_ie, parent_invs, path, self)
455
if use_path_content_summary:
456
builder.record_entry_contents(new_ie, parent_invs, path,
457
self, self.path_content_summary(path, new_ie.file_id))
459
builder.record_entry_contents(new_ie, parent_invs, path,
423
462
builder.finish_inventory()
424
463
message = self._escape_commit_message(message)