Пример #1
0
 def test_string(self):
     from rev import Repo
     repo = Repo()
     s = repo.shrink("foo")
     self.assertEqual(repo.expand(s), "foo")
Пример #2
0
    "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...

t["test.txt"] = "version 2"

t2 = repo.shrink(t)

parent = repo.refs[repo.HEAD]
c2 = repo.create_commit(t2, "second commit", parents=[parent])
repo.refs[repo.HEAD] = c2

## let's create a subdirectory now

t["subdir"] = {"foo.txt": "file in subdir"}
Пример #3
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))
Пример #4
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}])
Пример #5
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})
Пример #6
0
 def test_number(self):
     from rev import Repo
     repo = Repo()
     n = repo.shrink(5.2)
     self.assertEqual(repo.expand(n), 5.2)
Пример #7
0
    "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...

t["test.txt"] = "version 2"

t2 = repo.shrink(t)

parent = repo.refs[repo.HEAD]
c2 = repo.create_commit(t2, "second commit", parents=[parent])
repo.refs[repo.HEAD] = c2


## let's create a subdirectory now