tortoise-svn
tortoise-svn copied to clipboard
Uncaught TypeError: Cannot read property 'file' of undefined
[Enter steps to reproduce:]
- ...
- ...
Atom: 1.14.3 ia32 Electron: 1.3.13 OS: Microsoft Windows 10 Home Thrown From: tortoise-svn package 0.5.0
Stack Trace
Uncaught TypeError: Cannot read property 'file' of undefined
At C:\Users\Ibtissam\.atom\packages\tortoise-svn\lib\tortoise-svn.coffee:31
TypeError: Cannot read property 'file' of undefined
at resolveEditorFile (/packages/tortoise-svn/lib/tortoise-svn.coffee:31:24)
at Object.addFromEditor (/packages/tortoise-svn/lib/tortoise-svn.coffee:227:16)
at /packages/tortoise-svn/lib/tortoise-svn.coffee:159:75)
at CommandRegistry.module.exports.CommandRegistry.handleCommandEvent (/app.asar/src/command-registry.js:259:29)
at CommandRegistry.handleCommandEvent (/app.asar/src/command-registry.js:3:59)
at CommandRegistry.module.exports.CommandRegistry.dispatch (/app.asar/src/command-registry.js:160:19)
at AtomEnvironment.module.exports.AtomEnvironment.dispatchApplicationMenuCommand (/app.asar/src/atom-environment.js:1164:28)
at EventEmitter.outerCallback (/app.asar/src/application-delegate.js:320:25)
at emitThree (events.js:116:13)
at EventEmitter.emit (events.js:194:7)
Commands
-0:19.6.0 tortoise-svn:addFromEditor (atom-pane.pane.active)
Non-Core Packages
atom-react-autocomplete 0.1.10
atom-react-native-autocomplete 0.0.27
atom-react-preview 2.0.0
language-javascript-jsx 0.3.7
react 0.16.2
svn 0.0.13
tortoise-svn 0.5.0
Use when you edit the project files, in other file it will trigger error.
What about making project scoped commands, such as updating the entire project vs. a simple file? It still throws an error.
你这里应该使用tortoise-svn:addFromTreeView指令,完成SVN的操作; tortoise-svn:addFromEditor是对具体的文件进行svn操作; 今天刚开始使用atom,也遇到了这个问题,就调试研究了一下,然后我这里的问题解决了,希望对你能有帮助; 我的调试过程如下:
- 对目录进行svn操作时,调用formEditor命令会出现该情况;
- 通过ctrl+shift+i,调出console,添加断点调试,发现对目录和对单个文档的处理函数不同:
resolveTreeSelection = ->
if atom.packages.isPackageLoaded("tree-view")
treeView = atom.packages.getLoadedPackage("tree-view")
treeView = treeView.mainModule.treeView
treeView.selectedPath
resolveEditorFile = ->
editor = atom.workspace.getActivePaneItem()
file = editor?.buffer.file
file?.path
addFromTreeView: ->
currFile = resolveTreeSelection()
add(currFile) if currFile?
addFromEditor: ->
currFile = resolveEditorFile()
add(currFile) if currFile?
- 通过自定义快捷键,在目录上操作时调用不同的命令,快捷键配置如下:
'atom-workspace':
'alt-b': 'tortoise-svn:blameFromTreeView'
'alt-c': 'tortoise-svn:commitFromTreeView'
'alt-d': 'tortoise-svn:diffFromTreeView'
'alt-l': 'tortoise-svn:logFromTreeView'
'alt-r': 'tortoise-svn:revertFromTreeView'
'alt-u': 'tortoise-svn:updateFromTreeView'
现在就可以在任何地方做svn操作了;
(Google translate) : You should use the tortoise-svn:addFromTreeView instruction to complete the SVN operation. Tortoise-svn:addFromEditor is to perform svn operations on specific files; Today, I just started using atom, and I also encountered this problem. After debugging and researching it, my problem here is solved and I hope I can help you. My debugging process is as follows:
When a svn operation is performed on a directory, this condition occurs when calling the formEditor command. Through ctrl+shift+i, bring up the console, add breakpoint debugging, and find that the processing functions of the directory and the individual documents are different: resolveTreeSelection = -> If atom.packages.isPackageLoaded("tree-view") treeView = atom.packages.getLoadedPackage("tree-view") treeView = treeView.mainModule.treeView treeView.selectedPath resolveEditorFile = -> Editor = atom.workspace.getActivePaneItem() File = editor?.buffer.file File?.path
addFromTreeView: -> currFile = resolveTreeSelection() Add(currFile) if currFile? addFromEditor: -> currFile = resolveEditorFile() Add(currFile) if currFile? By customizing the shortcut key, different commands are invoked when operating on the directory. The shortcut keys are configured as follows: 'atom-workspace': 'alt-b': 'tortoise-svn:blameFromTreeView' 'alt-c': 'tortoise-svn:commitFromTreeView' 'alt-d': 'tortoise-svn:diffFromTreeView' 'alt-l': 'tortoise-svn:logFromTreeView' 'alt-r': 'tortoise-svn:revertFromTreeView' 'alt-u': 'tortoise-svn:updateFromTreeView' You can now do svn operations anywhere;