~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/tests/matchers.py

  • Committer: Jelmer Vernooij
  • Date: 2011-08-31 23:17:41 UTC
  • mto: This revision was merged to the branch mainline in revision 6119.
  • Revision ID: jelmer@samba.org-20110831231741-328lh2ipzqq4v3m3
review feedback from mgz

Show diffs side-by-side

added added

removed removed

Lines of Context:
142
142
 
143
143
    @staticmethod
144
144
    def _strip_unreferenced_directories(entries):
 
145
        """Strip all directories that don't (in)directly contain any files.
 
146
 
 
147
        :param entries: List of path strings or (path, ie) tuples to process
 
148
        """
145
149
        directories = []
146
150
        for entry in entries:
147
151
            if isinstance(entry, basestring):
148
152
                path = entry
149
153
            else:
150
154
                path = entry[0]
151
 
            if path == u"" or path[-1] == "/":
 
155
            if not path or path[-1] == "/":
152
156
                # directory
153
157
                directories.append((path, entry))
154
158
            else:
170
174
            entries = list(self._strip_unreferenced_directories(self.entries))
171
175
        else:
172
176
            entries = self.entries
173
 
        return Equals(actual).match(entries)
 
177
        return Equals(entries).match(actual)