~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/store.py

  • Committer: Martin Pool
  • Date: 2005-05-02 04:24:33 UTC
  • Revision ID: mbp@sourcefrog.net-20050502042433-c825a7f7235f6b15
doc: notes on merge

Show diffs side-by-side

added added

removed removed

Lines of Context:
34
34
    pass
35
35
 
36
36
 
37
 
class ImmutableStore(object):
 
37
class ImmutableStore:
38
38
    """Store that holds files indexed by unique names.
39
39
 
40
40
    Files can be added, but not modified once they are in.  Typically
74
74
        self._basedir = basedir
75
75
 
76
76
    def _path(self, id):
77
 
        assert '/' not in id
78
77
        return os.path.join(self._basedir, id)
79
78
 
80
79
    def __repr__(self):
107
106
        f.write(content)
108
107
        f.close()
109
108
 
110
 
    def copy_multi(self, other, ids):
111
 
        """Copy texts for ids from other into self.
112
 
 
113
 
        If an id is present in self, it is skipped.  A count of copied
114
 
        ids is returned, which may be less than len(ids).
115
 
        """
116
 
        count = 0
117
 
        for id in ids:
118
 
            if id in self:
119
 
                continue
120
 
            self.add(other[id], id)
121
 
            count += 1
122
 
        return count
123
109
 
124
110
    def __contains__(self, fileid):
125
111
        """"""