~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/store/versioned/__init__.py

  • Committer: Andrew Bennetts
  • Date: 2007-10-12 05:26:46 UTC
  • mfrom: (2904 +trunk)
  • mto: This revision was merged to the branch mainline in revision 2906.
  • Revision ID: andrew.bennetts@canonical.com-20071012052646-wl95idld3ijjy714
Merge from bzr.dev.

Show diffs side-by-side

added added

removed removed

Lines of Context:
72
72
 
73
73
    def filename(self, file_id):
74
74
        """Return the path relative to the transport root."""
75
 
        file_id = osutils.safe_file_id(file_id)
76
75
        return self._relpath(file_id)
77
76
 
78
77
    def __iter__(self):
90
89
                    break # only one suffix can match
91
90
 
92
91
    def has_id(self, file_id):
93
 
        file_id = osutils.safe_file_id(file_id)
94
92
        suffixes = self._versionedfile_class.get_suffixes()
95
93
        filename = self.filename(file_id)
96
94
        for suffix in suffixes:
100
98
 
101
99
    def get_empty(self, file_id, transaction):
102
100
        """Get an empty weave, which implies deleting the existing one first."""
103
 
        file_id = osutils.safe_file_id(file_id)
104
101
        if self.has_id(file_id):
105
102
            self.delete(file_id, transaction)
106
103
        return self.get_weave_or_empty(file_id, transaction)
107
104
 
108
105
    def delete(self, file_id, transaction):
109
106
        """Remove file_id from the store."""
110
 
        file_id = osutils.safe_file_id(file_id)
111
107
        suffixes = self._versionedfile_class.get_suffixes()
112
108
        filename = self.filename(file_id)
113
109
        for suffix in suffixes:
134
130
        file_id. This is used to reduce duplicate filename calculations when
135
131
        using 'get_weave_or_empty'. FOR INTERNAL USE ONLY.
136
132
        """
137
 
        file_id = osutils.safe_file_id(file_id)
138
133
        weave = transaction.map.find_weave(file_id)
139
134
        if weave is not None:
140
135
            #mutter("cache hit in %s for %s", self, file_id)
192
187
        # of calculating the filename before doing a cache lookup is more than
193
188
        # compensated for by not calculating the filename when making new
194
189
        # versioned files.
195
 
        file_id = osutils.safe_file_id(file_id)
196
190
        _filename = self.filename(file_id)
197
191
        try:
198
192
            return self.get_weave(file_id, transaction, _filename=_filename)
262
256
            to_transaction = PassThroughTransaction()
263
257
        pb = bzrlib.ui.ui_factory.nested_progress_bar()
264
258
        try:
265
 
            file_ids = [osutils.safe_file_id(f) for f in file_ids]
266
259
            for count, f in enumerate(file_ids):
267
260
                mutter("copy weave {%s} into %s", f, self)
268
261
                pb.update('copy', count, len(file_ids))