~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/weave.py

Introduce a api specifically for looking at lines in some versions of the inventory, for fileid_involved.

Show diffs side-by-side

added added

removed removed

Lines of Context:
492
492
 
493
493
    @deprecated_method(zero_eight)
494
494
    def _walk(self):
495
 
        """_walk has become walk, a supported api."""
496
 
        return self.walk()
497
 
 
 
495
        """_walk has become visit, a supported api."""
 
496
        return self._walk_internal()
 
497
 
 
498
    def iter_lines_added_or_present_in_versions(self, version_ids=None):
 
499
        """See VersionedFile.iter_lines_added_or_present_in_versions()."""
 
500
        if version_ids is None:
 
501
            version_ids = self.versions()
 
502
        version_ids = set(version_ids)
 
503
        for lineno, inserted, deletes, line in self._walk_internal(version_ids):
 
504
            # if inserted not in version_ids then it was inserted before the
 
505
            # versions we care about, but because weaves cannot represent ghosts
 
506
            # properly, we do not filter down to that
 
507
            # if inserted not in version_ids: continue
 
508
            if line[-1] != '\n':
 
509
                yield line + '\n'
 
510
            else:
 
511
                yield line
 
512
 
 
513
    #@deprecated_method(zero_eight)
498
514
    def walk(self, version_ids=None):
499
515
        """See VersionedFile.walk."""
 
516
        return self._walk_internal(version_ids)
 
517
 
 
518
    def _walk_internal(self, version_ids=None):
 
519
        """Helper method for weave actions."""
500
520
        
501
521
        istack = []
502
522
        dset = set()
705
725
            update_text = 'checking %s' % (short_name,)
706
726
            update_text = update_text[:25]
707
727
 
708
 
        for lineno, insert, deleteset, line in self.walk():
 
728
        for lineno, insert, deleteset, line in self._walk_internal():
709
729
            if progress_bar:
710
730
                progress_bar.update(update_text, lineno, nlines)
711
731