1
1
# Copyright (C) 2005, 2006 Canonical Ltd
3
3
# This program is free software; you can redistribute it and/or modify
4
4
# it under the terms of the GNU General Public License as published by
5
5
# the Free Software Foundation; either version 2 of the License, or
499
499
None; inventory entries that are carried over untouched have their
500
500
revision set to their prior value.
502
# ESEPARATIONOFCONCERNS: this function is diffing and using the diff
503
# results to create a new inventory at the same time, which results
504
# in bugs like #46635. Any reason not to use/enhance Tree.changes_from?
502
506
mutter("Selecting files for commit with filter %s", self.specific_files)
503
# iter_entries does not visit the root node so we need to call
504
# self._emit_progress_update once by hand.
505
new_ie = self.work_inv.root.copy()
507
entries = self.work_inv.iter_entries()
508
# root requires special handling
509
path, new_ie = entries.next()
510
new_ie = new_ie.copy()
506
511
new_ie.revision = None
507
512
self.builder.record_entry_contents(new_ie, self.parent_invs, '',
509
514
self._emit_progress_update()
510
for path, new_ie in self.work_inv.iter_entries():
515
for path, new_ie in entries:
511
516
self._emit_progress_update()
512
517
file_id = new_ie.file_id
513
mutter('check %s {%s}', path, file_id)
518
# mutter('check %s {%s}', path, file_id)
514
519
if (not self.specific_files or
515
520
is_inside_or_parent_of_any(self.specific_files, path)):
516
mutter('%s selected for commit', path)
521
# mutter('%s selected for commit', path)
517
522
ie = new_ie.copy()
518
523
ie.revision = None
520
mutter('%s not selected for commit', path)
525
# mutter('%s not selected for commit', path)
521
526
if self.basis_inv.has_id(file_id):
522
527
ie = self.basis_inv[file_id].copy()
545
550
self.reporter.snapshot_change(change, path)
552
if not self.specific_files:
555
# ignore removals that don't match filespec
556
for path, new_ie in self.basis_inv.iter_entries():
557
if new_ie.file_id in self.work_inv:
559
if is_inside_any(self.specific_files, path):
563
self.builder.record_entry_contents(ie, self.parent_invs, path,
547
566
def _emit_progress_update(self):
548
567
"""Emit an update to the progress bar."""
549
568
self.pb.update("Committing", self.pb_count, self.pb_total)