Read tree and move HEAD in checkout
This commit is contained in:
parent
817f38f49c
commit
b802e1eb9d
@ -97,6 +97,12 @@ def commit(message):
|
||||
return oid
|
||||
|
||||
|
||||
def checkout(oid):
|
||||
commit = get_commit(oid)
|
||||
read_tree(commit.tree)
|
||||
data.set_HEAD(oid)
|
||||
|
||||
|
||||
Commit = namedtuple("Commit", ["tree", "parent", "message"])
|
||||
|
||||
|
||||
|
@ -45,6 +45,10 @@ def parse_args():
|
||||
log_parser.set_defaults(func=log)
|
||||
log_parser.add_argument("oid", nargs="?")
|
||||
|
||||
checkout_parser = commands.add_parser("checkout")
|
||||
checkout_parser.set_defaults(func=checkout)
|
||||
checkout_parser.add_argument("oid")
|
||||
|
||||
return parser.parse_args()
|
||||
|
||||
|
||||
@ -85,3 +89,7 @@ def log(args):
|
||||
print("")
|
||||
|
||||
oid = commit.parent
|
||||
|
||||
|
||||
def checkout(args):
|
||||
base.checkout(args.oid)
|
||||
|
Loading…
Reference in New Issue
Block a user