Move checkoutHeadRevision to Workspace.

This commit is contained in:
joshaber
2016-04-25 17:02:36 -04:00
parent 856697e55f
commit 5cf532ebe8
3 changed files with 20 additions and 20 deletions

View File

@@ -204,7 +204,7 @@ module.exports = ({commandRegistry, commandInstaller, config, notificationManage
'editor:newline-below': -> @insertNewlineBelow()
'editor:newline-above': -> @insertNewlineAbove()
'editor:toggle-line-comments': -> @toggleLineCommentsInSelection()
'editor:checkout-head-revision': -> @checkoutHeadRevision()
'editor:checkout-head-revision': -> atom.workspace.checkoutHeadRevision(this)
'editor:move-line-up': -> @moveLineUp()
'editor:move-line-down': -> @moveLineDown()
'editor:move-selection-left': -> @moveSelectionLeft()

View File

@@ -712,25 +712,6 @@ class TextEditor extends Model
# via {Pane::saveItemAs}.
getSaveDialogOptions: -> {}
checkoutHeadRevision: ->
if @getPath()
checkoutHead = =>
@project.repositoryForDirectory(new Directory(@getDirectoryPath()))
.then (repository) =>
repository?.async.checkoutHeadForEditor(this)
if @config.get('editor.confirmCheckoutHeadRevision')
@applicationDelegate.confirm
message: 'Confirm Checkout HEAD Revision'
detailedMessage: "Are you sure you want to discard all changes to \"#{@getFileName()}\" since the last Git commit?"
buttons:
OK: checkoutHead
Cancel: null
else
checkoutHead()
else
Promise.resolve(false)
###
Section: Reading Text
###

View File

@@ -1085,3 +1085,22 @@ class Workspace extends Model
inProcessFinished = true
checkFinished()
checkoutHeadRevision: (editor) ->
if editor.getPath()
checkoutHead = =>
@project.repositoryForDirectory(new Directory(editor.getDirectoryPath()))
.then (repository) =>
repository?.async.checkoutHeadForEditor(editor)
if @config.get('editor.confirmCheckoutHeadRevision')
@applicationDelegate.confirm
message: 'Confirm Checkout HEAD Revision'
detailedMessage: "Are you sure you want to discard all changes to \"#{editor.getFileName()}\" since the last Git commit?"
buttons:
OK: checkoutHead
Cancel: null
else
checkoutHead()
else
Promise.resolve(false)