/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
499
499
        None; inventory entries that are carried over untouched have their
500
500
        revision set to their prior value.
501
501
        """
 
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?
 
505
        # ADHB 11-07-2006
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, '', 
508
513
                                           self.work_tree)
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
519
524
            else:
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()
523
528
                else:
544
549
            else:
545
550
                self.reporter.snapshot_change(change, path)
546
551
 
 
552
        if not self.specific_files:
 
553
            return
 
554
 
 
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:
 
558
                continue
 
559
            if is_inside_any(self.specific_files, path):
 
560
                continue
 
561
            ie = new_ie.copy()
 
562
            ie.revision = None
 
563
            self.builder.record_entry_contents(ie, self.parent_invs, path,
 
564
                                               self.basis_tree)
 
565
 
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)