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