Example #1
0
#!/usr/bin/env python3

from rev import Repo

repo = Repo()

## first we'll do this a very low level way...

# 1. create a directory tree

t = {
    "test.txt": "version 1",
    "new.txt": "new file",
}

# 2. shrink and store it

t1 = repo.shrink(t)

# 3. create a commit object out of it

c1 = repo.create_commit(t1, "my first commit")

# 4. and move the HEAD

repo.refs[repo.HEAD] = c1

assert t == repo.expand(repo.get_object(c1).obj_sha)

## now let's make a change to a file...
Example #2
0
 def test_dictionary_equality(self):
     from rev import Repo
     repo = Repo()
     self.assertEqual(repo.shrink({"a": 1, "b": 2}), repo.shrink({"b": 2, "a": 1}))
Example #3
0
 def test_string(self):
     from rev import Repo
     repo = Repo()
     s = repo.shrink("foo")
     self.assertEqual(repo.expand(s), "foo")
Example #4
0
 def test_tuple(self):
     from rev import Repo
     repo = Repo()
     t = repo.shrink(("foo", 5.2))
     self.assertEqual(repo.expand(t), ("foo", 5.2))
Example #5
0
 def test_list(self):
     from rev import Repo
     repo = Repo()
     l = repo.shrink(["foo", 5.2, {"foo": 5.2}])
     self.assertEqual(repo.expand(l), ["foo", 5.2, {"foo": 5.2}])
Example #6
0
 def test_dictionary(self):
     from rev import Repo
     repo = Repo()
     d = repo.shrink({"foo": 5.2})
     self.assertEqual(repo.expand(d), {"foo": 5.2})
Example #7
0
 def test_number(self):
     from rev import Repo
     repo = Repo()
     n = repo.shrink(5.2)
     self.assertEqual(repo.expand(n), 5.2)
Example #8
0
File: test.py Project: antiface/Rev
#!/usr/bin/env python3

from rev import Repo

repo = Repo()

## first we'll do this a very low level way...

# 1. create a directory tree

t = {
    "test.txt": "version 1",
    "new.txt": "new file",
}

# 2. shrink and store it

t1 = repo.shrink(t)

# 3. create a commit object out of it

c1 = repo.create_commit(t1, "my first commit")

# 4. and move the HEAD

repo.refs[repo.HEAD] = c1

assert t == repo.expand(repo.get_object(c1).obj_sha)


## now let's make a change to a file...