Пример #1
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"}
Пример #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