Fixes (read: hacks) blame with visible whitespace

Adds diff menu commands always
Attempts to move the diff file to the correct line number
Fixes code action provider -- works again
Deletes deprecated code
This commit is contained in:
Eric Amodio
2016-09-05 16:40:38 -04:00
parent d04696ac1d
commit b7920f3c3d
12 changed files with 179 additions and 236 deletions

View File

@@ -5,6 +5,7 @@ import * as tmp from 'tmp';
import {spawnPromise} from 'spawn-rx';
function gitCommand(cwd: string, ...args) {
console.log('git', ...args);
return spawnPromise('git', args, { cwd: cwd });
}
@@ -22,11 +23,9 @@ export default class Git {
fileName = Git.normalizePath(fileName, repoPath);
if (sha) {
console.log('git', 'blame', '-fn', '--root', `${sha}^`, '--', fileName);
return gitCommand(repoPath, 'blame', '-fn', '--root', `${sha}^`, '--', fileName);
}
console.log('git', 'blame', '-fn', '--root', '--', fileName);
return gitCommand(repoPath, 'blame', '-fn', '--root', '--', fileName);
// .then(s => { console.log(s); return s; })
// .catch(ex => console.error(ex));
@@ -36,11 +35,9 @@ export default class Git {
fileName = Git.normalizePath(fileName, repoPath);
if (sha) {
console.log('git', 'blame', '--porcelain', '--root', `${sha}^`, '--', fileName);
return gitCommand(repoPath, 'blame', '--porcelain', '--root', `${sha}^`, '--', fileName);
}
console.log('git', 'blame', '--porcelain', '--root', '--', fileName);
return gitCommand(repoPath, 'blame', '--porcelain', '--root', '--', fileName);
// .then(s => { console.log(s); return s; })
// .catch(ex => console.error(ex));
@@ -56,9 +53,7 @@ export default class Git {
return;
}
console.log("File: ", destination);
console.log("Filedescriptor: ", fd);
//console.log(`getVersionedFile(${fileName}, ${sha}); destination=${destination}`);
fs.appendFile(destination, data, err => {
if (err) {
reject(err);
@@ -75,28 +70,25 @@ export default class Git {
fileName = Git.normalizePath(fileName, repoPath);
sha = sha.replace('^', '');
console.log('git', 'show', `${sha}:${fileName}`);
return gitCommand(repoPath, 'show', `${sha}:${fileName}`);
// .then(s => { console.log(s); return s; })
// .catch(ex => console.error(ex));
}
static getCommitMessage(sha: string, repoPath: string) {
sha = sha.replace('^', '');
// static getCommitMessage(sha: string, repoPath: string) {
// sha = sha.replace('^', '');
console.log('git', 'show', '-s', '--format=%B', sha);
return gitCommand(repoPath, 'show', '-s', '--format=%B', sha);
// .then(s => { console.log(s); return s; })
// .catch(ex => console.error(ex));
}
// return gitCommand(repoPath, 'show', '-s', '--format=%B', sha);
// // .then(s => { console.log(s); return s; })
// // .catch(ex => console.error(ex));
// }
static getCommitMessages(fileName: string, repoPath: string) {
fileName = Git.normalizePath(fileName, repoPath);
// static getCommitMessages(fileName: string, repoPath: string) {
// fileName = Git.normalizePath(fileName, repoPath);
// git log --format="%h (%aN %x09 %ai) %s" --
console.log('git', 'log', '--oneline', '--', fileName);
return gitCommand(repoPath, 'log', '--oneline', '--', fileName);
// .then(s => { console.log(s); return s; })
// .catch(ex => console.error(ex));
}
// // git log --format="%h (%aN %x09 %ai) %s" --
// return gitCommand(repoPath, 'log', '--oneline', '--', fileName);
// // .then(s => { console.log(s); return s; })
// // .catch(ex => console.error(ex));
// }
}