Make :checkout-head-revision command work w/ multiple repos

This commit is contained in:
Max Brunsfeld
2015-02-24 15:30:04 -08:00
parent cbefdd6c5e
commit 88c2cef91f
3 changed files with 32 additions and 1 deletions

View File

@@ -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
###