/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/workingtree.py

Revert --debris/--detritus changes

Show diffs side-by-side

added added

removed removed

Lines of Context:
111
111
_gen_file_id_re = re.compile(r'[^\w.]|(^\.*)')
112
112
_gen_id_suffix = None
113
113
_gen_id_serial = 0
114
 
_detritus_pattern = re.compile(r'(?:(.|\n)*(?:(?:\.THIS$)|(?:\.BASE$)|'
115
 
                               r'(?:\.OTHER$)|(?:~$))|test....\.tmp)')
116
114
 
117
115
 
118
116
def _next_id_suffix():
703
701
        else:
704
702
            return '?'
705
703
 
706
 
    def list_files(self, classifiers=()):
 
704
    def list_files(self):
707
705
        """Recursively list all files as (path, class, kind, id, entry).
708
706
 
709
707
        Lists, but does not descend into unversioned directories.
712
710
        tree.
713
711
 
714
712
        Skips the control directory.
715
 
 
716
 
        Additional classifiers may be specified.  If provided, they are
717
 
        are callables that take a single filename arguments, and return a
718
 
        letter if the filename matches that class.  If the filename does not
719
 
        match, they should return None.  See WorkingTree.debris_classifier for
720
 
        an example.
721
 
        
722
 
        Classifiers are tried in order and the first match is used.  They can
723
 
        supersede an Ignored or Unknown classification, but not Versioned.
724
 
 
725
 
        :param classifiers: If specified, additional classifiers to use.
726
713
        """
727
714
        inv = self._inventory
728
715
        # Convert these into local objects to save lookup times
768
755
                f_ie = inv.get_child(from_dir_id, f)
769
756
                if f_ie:
770
757
                    c = 'V'
 
758
                elif self.is_ignored(fp[1:]):
 
759
                    c = 'I'
771
760
                else:
772
 
                    c = None
773
 
                    for classifier in classifiers:
774
 
                        c = classifier(fp[1:])
775
 
                        if c is not None:
776
 
                            break
777
 
                if c is None:
778
 
                    if self.is_ignored(fp[1:]):
779
 
                        c = 'I'
780
 
                    else:
781
 
                        c = '?'
 
761
                    c = '?'
782
762
 
783
763
                fk = file_kind(fap)
784
764
 
1152
1132
                return rules[0]
1153
1133
        return None
1154
1134
 
1155
 
    @staticmethod
1156
 
    def is_debris_name(filename):
1157
 
        """Return True if the supplied filename may be junk from earlier ops.
1158
 
        
1159
 
        This does not attempt to determine whether the file is versioned, which
1160
 
        should be done before running this test, because versioned files
1161
 
        are not detritus, regardless of their name.
1162
 
        """
1163
 
        return _detritus_pattern.match(filename) is not None
1164
 
 
1165
 
    @staticmethod
1166
 
    def debris_classifier(filename):
1167
 
        if WorkingTree.is_debris_name(filename):
1168
 
            return 'D'
1169
 
        else:
1170
 
            return None
1171
 
 
1172
1135
    def kind(self, file_id):
1173
1136
        return file_kind(self.id2abspath(file_id))
1174
1137