Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Restore settings by gist revision instead of most recent gist #294

Open
reallyely opened this issue Sep 23, 2016 · 2 comments
Open

Restore settings by gist revision instead of most recent gist #294

reallyely opened this issue Sep 23, 2016 · 2 comments

Comments

@reallyely
Copy link

While it's possible to restore from a gist, it appears that we can only restore from our latest backup. In some cases, however, we might want to restore from a specific revision instead. This proposed enhancement would provide an interface by which to select or opt into a specific gist revision.

Background / Why this might be useful

I encountered a situation where got myself into a bad config. Upon attempting to revert to my last good gist (as saved with sync-settings), I accidentally hit "Backup" instead, thereby committing my bad config. 100% my fault, but I couldn't find a way to use sync-settings directly and restore my desired gist. Providing an interface to opt into a specific revision could help clumsy and overly hasty developers (like me) recover from their own mistakes.

My fix was to use Postman to directly get a list of my gist revision from the GitHub API (because I also couldn't find an interface by which to do this on github) in order to get the SHA of my last known good config by date. Then, I 'hacked' the restore() function in sync-settings to use @createClient().gists.getRevision() instead of gists.get() and passed in the revision SHA to the request object.

2 approaches to applying the enhancement

I'd fork and add this myself, but given that I couldn't find a direct way of browsing the history of gist revisions, there may be some choices in how this would be provided.

As a result, should sync-settings also provide a means of getting and listing these revisions from within Atom? Should a field simply be provided under sync-settings > settings that allows the user to paste in the SHA (if known) to always restore from if present? Something else? Or is there an interface for all of this I somehow missed?

@krzysztof-sikorski
Copy link
Contributor

I see two user friendly options:

  1. Add a confirmation dialog to the "restore" command, asking for commit hash and allowing "use latest" as a shortcut.

  2. Rename "restore" to "restore from latest backup" and add a separate "restore from older backup" command.

@krzysztof-sikorski
Copy link
Contributor

(And as a side effect, both approaches would avoid the problem of enumerating gist revisions 😄 )

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants