/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

  • Committer: Jelmer Vernooij
  • Date: 2006-06-07 13:39:33 UTC
  • mto: This revision was merged to the branch mainline in revision 1753.
  • Revision ID: jelmer@samba.org-20060607133933-701a37b2fd2e875f
Simplify inventory population code by using is_inside_or_parent_of_any()

Show diffs side-by-side

added added

removed removed

Lines of Context:
76
76
from bzrlib.osutils import (local_time_offset,
77
77
                            rand_bytes, compact_date,
78
78
                            kind_marker, is_inside_any, quotefn,
 
79
                            is_inside_or_parent_of_any,
79
80
                            sha_file, isdir, isfile,
80
81
                            split_lines)
81
82
import bzrlib.config
592
593
            self._emit_progress_update()
593
594
            file_id = new_ie.file_id
594
595
            mutter('check %s {%s}', path, new_ie.file_id)
595
 
            if self.specific_files:
596
 
                if not is_inside_any(self.specific_files, path):
597
 
                    mutter('%s not selected for commit', path)
598
 
                    self._carry_entry(file_id)
599
 
                    continue
600
 
                else:
601
 
                    # this is selected, ensure its parents are too.
602
 
                    parent_id = new_ie.parent_id
603
 
                    while parent_id != ROOT_ID:
604
 
                        if not self.builder.new_inventory.has_id(parent_id):
605
 
                            # when selectively committing a file in a new dir,
606
 
                            # suck up the dir too.
607
 
                            ie = self._select_entry(self.work_inv[parent_id])
608
 
                            mutter('%s selected for commit because of %s',
609
 
                                   self.builder.new_inventory.id2path(parent_id), 
610
 
                                   path)
611
 
                            parent_id = ie.parent_id
612
 
                        else:
613
 
                            ie = self.builder.new_inventory[parent_id]
614
 
                            if ie.revision is not None:
615
 
                                ie.revision = None
616
 
                                mutter('%s selected for commit because of %s',
617
 
                                       self.builder.new_inventory.id2path(parent_id), 
618
 
                                       path)
619
 
                                parent_id = ie.parent_id
620
 
                            else:
621
 
                                # our parent is already selected.
622
 
                                parent_id = ROOT_ID
623
 
            mutter('%s selected for commit', path)
624
 
            self._select_entry(new_ie)
 
596
            if (not self.specific_files or 
 
597
                is_inside_or_parent_of_any(self.specific_files, path)):
 
598
                    mutter('%s selected for commit', path)
 
599
                    self._select_entry(new_ie)
 
600
            else:
 
601
                mutter('%s not selected for commit', path)
 
602
                self._carry_entry(file_id)
625
603
 
626
604
    def _emit_progress_update(self):
627
605
        """Emit an update to the progress bar."""