示例#1
0
    def test_commit2(self):
        b = cas.Blob('test content')
        b2 = cas.Blob('deja vu')
        b3 = cas.Blob('jamais vu')
        yield self.cas.put(b)
        yield self.cas.put(b2)
        yield self.cas.put(b3)
        t1 = cas.Tree(cas.Element('test', sha1(b)),
                      cas.Element('hello', sha1(b2)))
        t1id = yield self.cas.put(t1)
        t2 = cas.Tree(cas.Element('thing', sha1(b3)),
                      cas.Element('tree', sha1(t1)))
        t2id = yield self.cas.put(t2)
        c = cas.Commit(t2id, log='first commit')
        cid = yield self.cas.put(c)
        c_out = yield self.cas.get(cid)
        b3new = cas.Blob('I remember, now!')
        b3newid = yield self.cas.put(b3new)

        t2new = cas.Tree(cas.Element('thing', sha1(b3new)),
                         cas.Element('tree', sha1(t1)))
        t2newid = yield self.cas.put(t2new)
        cnew = cas.Commit(t2newid,
                          parents=[cid],
                          log='know what i knew but forgot')
        cnewid = yield self.cas.put(cnew)
        cnew_out = yield self.cas.get(cnewid)
        self.failUnlessEqual(cnew.value, cnew_out.value)
示例#2
0
 def test_tree(self):
     b = cas.Blob('test content')
     yield self.cas.put(b)
     t1 = cas.Tree(cas.Element('test', sha1(b)))
     t1id = yield self.cas.put(t1)
     t1_out = yield self.cas.get(t1id)
     self.failUnlessEqual(t1_out.value, t1.value)
示例#3
0
 def test_tree2(self):
     b = cas.Blob('test content')
     b2 = cas.Blob('deja vu')
     b3 = cas.Blob('jamais vu')
     bid = yield self.cas.put(b)
     b2id = yield self.cas.put(b2)
     b3id = yield self.cas.put(b3)
     t1 = cas.Tree(cas.Element('test', sha1(b)),
                   cas.Element('hello', sha1(b2)))
     t1id = yield self.cas.put(t1)
     t2 = cas.Tree(cas.Element('thing', sha1(b3)),
                   cas.Element('tree', sha1(t1)))
     t2id = yield self.cas.put(t2)
     t1_out = yield self.cas.get(t1id)
     self.failUnlessEqual(t1_out.value, t1.value)
     t2_out = yield self.cas.get(t2id)
     self.failUnlessEqual(t2_out.value, t2.value)
示例#4
0
 def setUp(self):
     self.tree = cas.Tree(
         ('thing',
          '\x08\xcfa\x01Ao\x0c\xe0\xdd\xa3\xc8\x0eb\x7f38T\xc4\x08\\',
          '100644'),
         ('scaleing.py',
          '\xcd\x921\xfa\x06\xab\xb6\x9a8\r?D\x90\xa9\xe2a\xe0;\xebZ',
          '100644'))
     self.encoded = """tree 72\x00100644 thing\x00\x08\xcfa\x01Ao\x0c\xe0\xdd\xa3\xc8\x0eb\x7f38T\xc4\x08\\100644 scaleing.py\x00\xcd\x921\xfa\x06\xab\xb6\x9a8\r?D\x90\xa9\xe2a\xe0;\xebZ"""
示例#5
0
    def test_commit(self):
        b = cas.Blob('test content')
        b2 = cas.Blob('deja vu')
        b3 = cas.Blob('jamais vu')
        yield self.cas.put(b)
        yield self.cas.put(b2)
        yield self.cas.put(b3)

        t1 = cas.Tree(cas.Element('test', sha1(b)),
                      cas.Element('hello', sha1(b2)))
        t1id = yield self.cas.put(t1)
        t2 = cas.Tree(cas.Element('thing', sha1(b3)),
                      cas.Element('tree', sha1(t1)))
        t2id = yield self.cas.put(t2)
        c = cas.Commit(t2id, log='first commit')
        cid = yield self.cas.put(c)
        c_out = yield self.cas.get(cid)
        self.failUnlessEqual(c.value, c_out.value)