~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/weave.py

  • Committer: John Arbash Meinel
  • Date: 2006-10-11 00:23:23 UTC
  • mfrom: (2070 +trunk)
  • mto: This revision was merged to the branch mainline in revision 2071.
  • Revision ID: john@arbash-meinel.com-20061011002323-82ba88c293d7caff
[merge] bzr.dev 2070

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
#! /usr/bin/python
2
2
 
3
3
# Copyright (C) 2005 Canonical Ltd
4
 
 
 
4
#
5
5
# This program is free software; you can redistribute it and/or modify
6
6
# it under the terms of the GNU General Public License as published by
7
7
# the Free Software Foundation; either version 2 of the License, or
8
8
# (at your option) any later version.
9
 
 
 
9
#
10
10
# This program is distributed in the hope that it will be useful,
11
11
# but WITHOUT ANY WARRANTY; without even the implied warranty of
12
12
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13
13
# GNU General Public License for more details.
14
 
 
 
14
#
15
15
# You should have received a copy of the GNU General Public License
16
16
# along with this program; if not, write to the Free Software
17
17
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
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():