G-Node / gin-cli

Command line client for GIN
https://gin.g-node.org
Other
12 stars 6 forks source link

New command: gin version #191

Closed achilleas-k closed 6 years ago

achilleas-k commented 6 years ago

New command: gin version

This PR adds the ability to checkout old versions of files from the git history. In its plain form, it presents the user with a git log that includes, for each commit, an index (HEAD=1), the short form of that revision's hash, the commit message, and a list of which files changed (additions, deletions, modifications). The user is then prompted to select a specific commit. Either an index or a short hash is valid. Anything else, aborts the operation.

Other forms of the command:

The above forms can be combined, though some combinations might not make sense. For example, if the user runs gin version --max-count 3 --id 0690d9a, the --max-count argument is ignored, since the prompt is skipped.

When files are reverted to older versions, a new commit (and upload) is performed to save the version change. This allows users to switch between versions while also keeping an immediate history of these version changes. The push (upload) should be quick, even if checking out old large files, since the content (presumable) already exists on the remote. This might change in the future with the addition of commits without push.

Other changes

Not implemented

The original plan for gin version included the option to specify a target location to copy a checked out version of a single file. The use case would be for the user to checkout an old version of a file without overwriting the current one. This has turned out to be tricky for annexed files, so I'm postponing it for now. Also, it will be easier to review this PR without the additional functionality, which will come in another, simpler PR.