-
Notifications
You must be signed in to change notification settings - Fork 9
Open
Description
I would like to reset HEAD~1 --hard , so reset to a specific revision / drop the last commit.
Right now it's not clear to me how to pass the revision to the Dolt.reset() method.
A possible solution could be adding the revision as the first parameter (not passing via kwargs) and appending it to args before --soft / --hard :
def reset(
self,
revision: str,
tables: Union[str, List[str]] = [],
hard: bool = False,
soft: bool = False,
**kwargs,
):
"""
Reset a table or set of tables that have changes in the working set to their value at the tip of the current
branch.
:param tables:
:param hard:
:param soft:
:return:
"""
if not isinstance(tables, (str, list)):
raise ValueError(
f"tables should be: Union[str, List[str]]; found {type(tables)}"
)
to_reset = to_list(tables)
args = ["reset"]
if hard and soft:
raise ValueError("Specify one of: hard=True, soft=True")
if (hard or soft) and to_reset:
raise ValueError("Specify either hard/soft flag, or tables to reset")
args.append(revision)
if hard:
args.append("--hard")
elif soft:
args.append("--soft")
elif not tables:
args.append("--soft")
else:
args += to_reset
self.execute(args, **kwargs)Metadata
Metadata
Assignees
Labels
No labels