Skip to content

Commit 806ba2e

Browse files
committed
working on svn content provider
1 parent ec2d8e9 commit 806ba2e

File tree

3 files changed

+34
-9
lines changed

3 files changed

+34
-9
lines changed

extension.js

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
var vscode = require('vscode');
22
const SvnSpawn = require('svn-spawn');
33
const path = require('path');
4+
const svnSCM = require('./src/svnSCM.js');
45

56
const createStatusBar = () => {
67
const statusBarItem = vscode.window.createStatusBarItem(vscode.StatusBarAlignment.Left);
@@ -72,6 +73,7 @@ const updateResourceGroup = (data, type) => {
7273
function activate(context) {
7374
console.log('svn-scm is now active!');
7475

76+
const disposable = [];
7577
const rootPath = vscode.workspace.rootPath;
7678
const outputChannel = createChannel();
7779
vscode.commands.registerCommand('vscode-svn.showOutputChannel', () => outputChannel.show());
@@ -80,19 +82,11 @@ function activate(context) {
8082
const client = createClient(rootPath);
8183
const watcher = vscode.workspace.createFileSystemWatcher(`${rootPath}/**/*`);
8284

83-
const sourceControl = vscode.scm.createSourceControl('svn', 'svn');
85+
const sourceControl = svnSCM.init();
8486

8587
const modified = sourceControl.createResourceGroup('modified', 'Modified');
8688
const removed = sourceControl.createResourceGroup('removed', 'Removed');
8789
const notTracked = sourceControl.createResourceGroup('unversioned', 'Not Tracked');
88-
89-
sourceControl.provideOriginalResource = (uri) => {
90-
if (uri.scheme !== 'file') {
91-
return;
92-
}
93-
94-
return vscode.Uri.with({ scheme: 'svn', query: uri.path, path: uri.path});
95-
};
9690

9791
modified.hideWhenEmpty = true;
9892
removed.hideWhenEmpty = true;

src/svnContentProvider.js

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
var vscode = require('vscode');
2+
3+
module.exports = {
4+
init: function() {
5+
vscode.workspace.registerTextDocumentContentProvider('svn', this);
6+
},
7+
8+
provideTextDocumentContent: function(uri) {
9+
10+
}
11+
};

src/svnSCM.js

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
var vscode = require('vscode');
2+
3+
module.exports = {
4+
sourceControl: null,
5+
6+
init: function() {
7+
this.sourceControl = vscode.scm.createSourceControl('svn', 'svn');
8+
this.sourceControl.quickDiffProvider = this;
9+
10+
return this.sourceControl;
11+
},
12+
13+
provideOriginalResource: function(uri) {
14+
if (uri.scheme !== 'file') {
15+
return;
16+
}
17+
18+
return vscode.Uri.with({ scheme: 'svn', query: uri.path, path: uri.path});
19+
}
20+
};

0 commit comments

Comments
 (0)