mirror of
https://github.com/atom/atom.git
synced 2026-02-12 15:45:23 -05:00
Make :checkout-head-revision command work w/ multiple repos
This commit is contained in:
@@ -12,6 +12,7 @@ DisplayBuffer = require './display-buffer'
|
||||
Cursor = require './cursor'
|
||||
Selection = require './selection'
|
||||
TextMateScopeSelector = require('first-mate').ScopeSelector
|
||||
{Directory} = require "pathwatcher"
|
||||
|
||||
# Public: This class represents all essential editing state for a single
|
||||
# {TextBuffer}, including cursor and selection positions, folds, and soft wraps.
|
||||
@@ -647,6 +648,14 @@ class TextEditor extends Model
|
||||
else
|
||||
@isModified() and not @buffer.hasMultipleEditors()
|
||||
|
||||
checkoutHeadRevision: ->
|
||||
if filePath = this.getPath()
|
||||
atom.project.repositoryForDirectory(new Directory(path.dirname(filePath)))
|
||||
.then (repository) =>
|
||||
repository?.checkoutHeadForEditor(this)
|
||||
else
|
||||
Promise.resolve(false)
|
||||
|
||||
###
|
||||
Section: Reading Text
|
||||
###
|
||||
|
||||
Reference in New Issue
Block a user