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 revision #494

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions lib/config.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,12 @@ const config = {
type: 'string',
default: 'Atom Settings Backup by https://atom.io/packages/sync-settings',
},
gistRevision: {
title: 'Gist Revision',
description: 'Restore from a revision.',
type: 'string',
default: '',
},
useOtherLocation: {
title: 'Use Other Backup Location',
description: 'You will need to install another package which provides a backup location.<br />https://atom.io/packages/search?q=sync-settings+location',
Expand Down
9 changes: 8 additions & 1 deletion lib/location/gist.js
Original file line number Diff line number Diff line change
Expand Up @@ -271,7 +271,14 @@ module.exports = {
// getting gists doesn't require a token
const personalAccessToken = await getPersonalAccessToken(true)
gistId = await getGistId()
const res = await createClient(personalAccessToken).gists.get({ gist_id: gistId })
const sha = atom.config.get('sync-settings.gistRevision')
let res
if (sha) {
atom.config.set('sync-settings.gistRevision', '')
res = await createClient(personalAccessToken).gists.getRevision({ gist_id: gistId, sha })
} else {
res = await createClient(personalAccessToken).gists.get({ gist_id: gistId })
}

if (invalidRes(res, ['data', 'files'], ['data', 'history', 0, 'committed_at'])) {
return
Expand Down