## let's create a subdirectory now t["subdir"] = {"foo.txt": "file in subdir"} ## this time we'll use the higher-level commit method c3 = repo.commit(t, "added subdir") ## retrieve subdir/foo.txt from HEAD assert repo.retrieve_commit()["subdir"]["foo.txt"] == "file in subdir" # now let's create a branch repo.create_branch("branch-test") repo.checkout_branch("branch-test") t = repo.retrieve_commit() t["subdir"]["foo.txt"] = "changed!" c4 = repo.commit(t, "changed file in subdirectory") ## this should print "changed!" assert repo.retrieve_commit()["subdir"]["foo.txt"] == "changed!" ## now checkout master again repo.checkout_branch("master")
## this time we'll use the higher-level commit method c3 = repo.commit(t, "added subdir") ## retrieve subdir/foo.txt from HEAD assert repo.retrieve_commit()["subdir"]["foo.txt"] == "file in subdir" # now let's create a branch repo.create_branch("branch-test") repo.checkout_branch("branch-test") t = repo.retrieve_commit() t["subdir"]["foo.txt"] = "changed!" c4 = repo.commit(t, "changed file in subdirectory") ## this should print "changed!" assert repo.retrieve_commit()["subdir"]["foo.txt"] == "changed!" ## now checkout master again