~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/weave.py

  • Committer: wang
  • Date: 2006-10-29 13:41:32 UTC
  • mto: (2104.4.1 wang_65714)
  • mto: This revision was merged to the branch mainline in revision 2109.
  • Revision ID: wang@ubuntu-20061029134132-3d7f4216f20c4aef
Replace python's difflib by patiencediff because the worst case 
performance is cubic for difflib and people commiting large data 
files are often hurt by this. The worst case performance of patience is 
quadratic. Fix bug 65714.

Show diffs side-by-side

added added

removed removed

Lines of Context:
75
75
import time
76
76
import warnings
77
77
 
 
78
from bzrlib import (
 
79
    progress,
 
80
    )
78
81
from bzrlib.trace import mutter
79
82
from bzrlib.errors import (WeaveError, WeaveFormatError, WeaveParentMismatch,
80
83
        RevisionAlreadyPresent,
265
268
 
266
269
    def has_version(self, version_id):
267
270
        """See VersionedFile.has_version."""
268
 
        return self._name_map.has_key(version_id)
 
271
        return (version_id in self._name_map)
269
272
 
270
273
    __contains__ = has_version
271
274
 
664
667
        """_walk has become visit, a supported api."""
665
668
        return self._walk_internal()
666
669
 
667
 
    def iter_lines_added_or_present_in_versions(self, version_ids=None):
 
670
    def iter_lines_added_or_present_in_versions(self, version_ids=None,
 
671
                                                pb=None):
668
672
        """See VersionedFile.iter_lines_added_or_present_in_versions()."""
669
673
        if version_ids is None:
670
674
            version_ids = self.versions()
1132
1136
        sio = StringIO()
1133
1137
        write_weave_v5(self, sio)
1134
1138
        sio.seek(0)
1135
 
        transport.put(name + WeaveFile.WEAVE_SUFFIX, sio, self._filemode)
 
1139
        transport.put_file(name + WeaveFile.WEAVE_SUFFIX, sio, self._filemode)
1136
1140
 
1137
1141
    def create_empty(self, name, transport, filemode=None):
1138
1142
        return WeaveFile(name, transport, filemode, create=True)
1143
1147
        sio = StringIO()
1144
1148
        write_weave_v5(self, sio)
1145
1149
        sio.seek(0)
1146
 
        self._transport.put(self._weave_name + WeaveFile.WEAVE_SUFFIX,
1147
 
                            sio,
1148
 
                            self._filemode)
 
1150
        self._transport.put_file(self._weave_name + WeaveFile.WEAVE_SUFFIX,
 
1151
                                 sio,
 
1152
                                 self._filemode)
1149
1153
 
1150
1154
    @staticmethod
1151
1155
    def get_suffixes():