mirror of
https://github.com/atom/atom.git
synced 2026-04-28 03:01:47 -04:00
Move checkoutHeadRevision to Workspace.
This commit is contained in:
@@ -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()
|
||||
|
||||
@@ -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
|
||||
###
|
||||
|
||||
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user