Relativize buffer paths for replication

TextBuffers now maintain a reference to their containing project to
make it easier to test replication of buffers between environments
without worrying about the value of the `project` global.

We're also starting the process of moving the `git` global into Project
as the `Project.repository` property.
This commit is contained in:
Kevin Sawicki & Nathan Sobo
2013-07-22 14:13:55 -07:00
parent d051cbe0f6
commit fa59aafffb
16 changed files with 94 additions and 52 deletions

View File

@@ -132,14 +132,10 @@ window.deserializeEditorWindow = ->
$(rootViewParentSelector).append(rootView)
window.git = Git.open(project.getPath())
project.on 'path-changed', ->
projectPath = project.getPath()
atom.getLoadSettings().initialPath = projectPath
window.git?.destroy()
window.git = Git.open(projectPath)
window.deserializeConfigWindow = ->
ConfigView = require 'config-view'
window.configView = deserialize(atom.getWindowState('configView')) ? new ConfigView()
@@ -232,13 +228,13 @@ window.registerDeferredDeserializer = (name, fn) ->
window.unregisterDeserializer = (klass) ->
delete deserializers[klass.name]
window.deserialize = (state) ->
window.deserialize = (state, params) ->
if deserializer = getDeserializer(state)
stateVersion = state.get?('version') ? state.version
return if deserializer.version? and deserializer.version isnt stateVersion
if (state instanceof telepath.Document) and not deserializer.acceptsDocuments
state = state.toObject()
deserializer.deserialize(state)
deserializer.deserialize(state, params)
window.getDeserializer = (state) ->
return unless state?