/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 bzrlib/commit.py

Merge from bzr.dev

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
# Copyright (C) 2005, 2006 Canonical Ltd
2
 
 
 
2
#
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
497
497
        None; inventory entries that are carried over untouched have their
498
498
        revision set to their prior value.
499
499
        """
 
500
        # ESEPARATIONOFCONCERNS: this function is diffing and using the diff
 
501
        # results to create a new inventory at the same time, which results
 
502
        # in bugs like #46635.  Any reason not to use/enhance Tree.changes_from?
 
503
        # ADHB 11-07-2006
500
504
        mutter("Selecting files for commit with filter %s", self.specific_files)
501
 
        # iter_entries does not visit the ROOT_ID node so we need to call
502
 
        # self._emit_progress_update once by hand.
 
505
        # at this point we dont copy the root entry:
 
506
        entries = self.work_inv.iter_entries()
 
507
        entries.next()
503
508
        self._emit_progress_update()
504
 
        for path, new_ie in self.work_inv.iter_entries():
 
509
        for path, new_ie in entries:
505
510
            self._emit_progress_update()
506
511
            file_id = new_ie.file_id
507
 
            mutter('check %s {%s}', path, file_id)
 
512
            # mutter('check %s {%s}', path, file_id)
508
513
            if (not self.specific_files or 
509
514
                is_inside_or_parent_of_any(self.specific_files, path)):
510
 
                    mutter('%s selected for commit', path)
 
515
                    # mutter('%s selected for commit', path)
511
516
                    ie = new_ie.copy()
512
517
                    ie.revision = None
513
518
            else:
514
 
                mutter('%s not selected for commit', path)
 
519
                # mutter('%s not selected for commit', path)
515
520
                if self.basis_inv.has_id(file_id):
516
521
                    ie = self.basis_inv[file_id].copy()
517
522
                else:
534
539
            else:
535
540
                self.reporter.snapshot_change(change, path)
536
541
 
 
542
        if not self.specific_files:
 
543
            return
 
544
 
 
545
        # ignore removals that don't match filespec
 
546
        for path, new_ie in self.basis_inv.iter_entries():
 
547
            if new_ie.file_id in self.work_inv:
 
548
                continue
 
549
            if is_inside_any(self.specific_files, path):
 
550
                continue
 
551
            ie = new_ie.copy()
 
552
            ie.revision = None
 
553
            self.builder.record_entry_contents(ie, self.parent_invs, path,
 
554
                                               self.basis_tree)
 
555
 
537
556
    def _emit_progress_update(self):
538
557
        """Emit an update to the progress bar."""
539
558
        self.pb.update("Committing", self.pb_count, self.pb_total)