~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/store/text.py

  • Committer: Robert Collins
  • Date: 2005-10-16 01:51:59 UTC
  • mto: This revision was merged to the branch mainline in revision 1459.
  • Revision ID: robertc@lifelesslap.robertcollins.net-20051016015159-580cca34cb41e771
Pull up _check_id and _relpath from Text and CompressedText stores into TransportStore

Show diffs side-by-side

added added

removed removed

Lines of Context:
46
46
        super(TextStore, self).__init__(transport)
47
47
        self._prefixed = prefixed
48
48
 
49
 
    def _check_fileid(self, fileid):
50
 
        if not isinstance(fileid, basestring):
51
 
            raise TypeError('Fileids should be a string type: %s %r' % (type(fileid), fileid))
52
 
        if '\\' in fileid or '/' in fileid:
53
 
            raise ValueError("invalid store id %r" % fileid)
54
 
 
55
 
    def _relpath(self, fileid):
56
 
        self._check_fileid(fileid)
57
 
        if self._prefixed:
58
 
            return hash_prefix(fileid) + fileid
59
 
        else:
60
 
            return fileid
61
 
 
62
49
    def add(self, f, fileid):
63
50
        """Add contents of a file into the store.
64
51