~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/weave.py

  • Committer: Alexander Belchenko
  • Date: 2007-01-30 12:45:50 UTC
  • mto: This revision was merged to the branch mainline in revision 2259.
  • Revision ID: bialix@ukr.net-20070130124550-gggzj7fx8forp9gy
bzr-win32-bdist-postinstall.py: good win98 support

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,
244
247
 
245
248
    def _lookup(self, name):
246
249
        """Convert symbolic version name to index."""
 
250
        self.check_not_reserved_id(name)
247
251
        try:
248
252
            return self._name_map[name]
249
253
        except KeyError:
265
269
 
266
270
    def has_version(self, version_id):
267
271
        """See VersionedFile.has_version."""
268
 
        return self._name_map.has_key(version_id)
 
272
        return (version_id in self._name_map)
269
273
 
270
274
    __contains__ = has_version
271
275
 
664
668
        """_walk has become visit, a supported api."""
665
669
        return self._walk_internal()
666
670
 
667
 
    def iter_lines_added_or_present_in_versions(self, version_ids=None):
 
671
    def iter_lines_added_or_present_in_versions(self, version_ids=None,
 
672
                                                pb=None):
668
673
        """See VersionedFile.iter_lines_added_or_present_in_versions()."""
669
674
        if version_ids is None:
670
675
            version_ids = self.versions()
1116
1121
 
1117
1122
    def _add_lines(self, version_id, parents, lines, parent_texts):
1118
1123
        """Add a version and save the weave."""
 
1124
        self.check_not_reserved_id(version_id)
1119
1125
        result = super(WeaveFile, self)._add_lines(version_id, parents, lines,
1120
1126
                                                   parent_texts)
1121
1127
        self._save()
1132
1138
        sio = StringIO()
1133
1139
        write_weave_v5(self, sio)
1134
1140
        sio.seek(0)
1135
 
        transport.put(name + WeaveFile.WEAVE_SUFFIX, sio, self._filemode)
 
1141
        transport.put_file(name + WeaveFile.WEAVE_SUFFIX, sio, self._filemode)
1136
1142
 
1137
1143
    def create_empty(self, name, transport, filemode=None):
1138
1144
        return WeaveFile(name, transport, filemode, create=True)
1143
1149
        sio = StringIO()
1144
1150
        write_weave_v5(self, sio)
1145
1151
        sio.seek(0)
1146
 
        self._transport.put(self._weave_name + WeaveFile.WEAVE_SUFFIX,
1147
 
                            sio,
1148
 
                            self._filemode)
 
1152
        self._transport.put_file(self._weave_name + WeaveFile.WEAVE_SUFFIX,
 
1153
                                 sio,
 
1154
                                 self._filemode)
1149
1155
 
1150
1156
    @staticmethod
1151
1157
    def get_suffixes():