aboutsummaryrefslogtreecommitdiffstats
path: root/tools/git.js
diff options
context:
space:
mode:
authorCliff Brake <cbrake@bec-systems.com>2011-05-31 07:56:53 -0400
committerCliff Brake <cbrake@bec-systems.com>2011-05-31 07:56:53 -0400
commit1526cc2d85d317b1ca6662467eb1f31ef44f26a9 (patch)
tree22643c23b97cde62688a6cbbb0d02750115a54d8 /tools/git.js
parent79bb2226c87b4d99cec31ac9eb1c75bca3a42e4a (diff)
downloadopenembedded-admin-1526cc2d85d317b1ca6662467eb1f31ef44f26a9.tar.gz
update scripts for weekly changelog
Diffstat (limited to 'tools/git.js')
-rw-r--r--tools/git.js49
1 files changed, 49 insertions, 0 deletions
diff --git a/tools/git.js b/tools/git.js
new file mode 100644
index 0000000..523c7e0
--- /dev/null
+++ b/tools/git.js
@@ -0,0 +1,49 @@
+var fs = require('fs'),
+ child_process = require('child_process'),
+ dateutil = require('./dateutil');
+
+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++) {
+ if (/submodule/(lines[i])) {
+ path = null;
+ url = null;
+ }
+ var re_path = /path = (\S.*)/(lines[i]);
+ if (re_path)
+ path = re_path[1];
+ var re_url = /url = (\S.*)/(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.isoformat(startdate);
+ var end_iso = dateutil.isoformat(enddate);
+ 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);
+ });
+}
+