1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
|
var fs = require('fs'),
child_process = require('child_process'),
dateutil = require('./dateutil'),
util = require('util')
exports.parse_gitmodules = function(filepath, callback) {
fs.readFile(filepath, 'utf8', function(err, data) {
if (err) {
throw err;
callback(err, null);
} else {
var state = 'looking';
lines = data.split('\n');
var path = null;
var url = null;
var submodules = {}
for (var i=0; i < lines.length; i++) {
console.log("lines[i] = " + lines[i])
if (/submodule/.exec(lines[i])) {
path = null;
url = null;
}
var re_path = /path = (\S.*)/.exec(lines[i]);
if (re_path)
path = re_path[1];
var re_url = /url = (\S.*)/.exec(lines[i]);
if (re_url) {
url = re_url[1];
}
if (path && url) {
submodules[path] = url
path = null;
url = null;
}
}
callback(null, submodules);
}
});
}
exports.changelog = function(repo_dir, startdate, enddate, callback) {
var start_iso = dateutil.isoDate(startdate);
var end_iso = dateutil.isoDate(enddate);
console.log("git changelog " + start_iso + " to " + end_iso)
child_process.exec('cd ' + repo_dir + "; git shortlog --since=" + start_iso + " --until=" + end_iso +
" origin/master | grep -v 'Merge branch' | grep -v 'Merge commit'|sed -e 's/^ //g'|cut -b -78", function(error, stdout, stderr) {
if (stderr)
console.log('changelog stderr: ' + stderr);
callback(error, stdout);
});
}
|