示例#1
0
文件: cvs.py 项目: ustuehler/git-cvs
    def blob(self, change, changeset):
        """Return the raw binary content of a file at the specified
        revision.
        """
        filename = change.filename + ',v'
        rcsfile = os.path.join(self.prefix, filename)
        if not os.path.isfile(rcsfile):
            rcsfile = os.path.join(self.prefix,
                os.path.dirname(filename), 'Attic',
                os.path.basename(filename))
        if not os.path.isfile(rcsfile):
            raise RuntimeError, _('no RCS file found for %s') % filename

        # cvs has the odd behavior that it favors revision 1.1 over
        # 1.1.1.1 if it searches for a revision by date and the date
        # is after that of the initial revision even by one second.
        #if change.revision == '1.1.1.1' and \
        #        change.timestamp < changeset.timestamp:
        #    revision = '1.1'
        #else:
        #    revision = change.revision
        revision = change.revision

        rcsfile = RCSFile(rcsfile)
        blob = rcsfile.blob(revision)
        return self.expand_keywords(blob, change, rcsfile, revision)
示例#2
0
 def checkout(self, filename, revision):
     # FIXME: RCS should do keyword substitution, not CVS!
     cvs = CVS(join(dirname(__file__), 'data', 'greek'), None)
     cvs.localid = 'OpenBSD'
     f = RCSFile(join(dirname(__file__), 'data', filename))
     c = f.change(revision)
     blob = f.blob(revision)
     return cvs.expand_keywords(blob, c, f, revision)