GeezerVisonThe World Wide Web, restored to 800 pixels of glory. |
| Home|About|Gaming cabinet|Archives|How it works|Starter sites |
GeezerVison is showing github.com — angular.js/compare-master-to-stable.js at master · eusthace811/angular.js Expand file tree/ Copy pathcompare-master-to-stable.jsMore file actions executable file ·168 lines (151 loc) · 3.71 KB / Copy pathcompare-master-to-stable.jsFile metadata and controlsexecutable file ·168 lines (151 loc) · 3.71 KB 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 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 #!/usr/bin/env node 'use strict'; var util = require('util'); var cp = require('child_process'); var Q = require('q'); var _ = require('lodash'); var semver = require('semver'); var exec = function (cmd) { return function () { var args = Array.prototype.slice.call(arguments, 0); args.unshift(cmd); var fullCmd = util.format.apply(util, args); return Q.nfcall(cp.exec, fullCmd).then(function (out) { return out[0].split('\n'); }); }; }; var andThen = function (fn, after) { return function () { return fn.apply(this, arguments).then(after); }; }; var oneArg = function (fn) { return function (arg) { return fn(arg); }; }; var oneLine = function (lines) { return lines[0].trim(); }; var noArgs = function (fn) { return function () { return fn(); }; }; var identity = function (i) { return i; }; // like Q.all, but runs the commands in series // useful for ensuring env state (like which branch is checked out) var allInSeries = function (fn) { return function (args) { var results = []; var def; while (args.length > 0) { (function (arg) { if (def) { def = def.then(function () { return fn(arg); }); } else { def = fn(arg); } def = def.then(function (res) { results.push(res); }); }(args.pop())); } return def.then(function () { return results; }); }; }; var compareBranches = function (left, right) { console.log('# These commits are in ' + left.name + ' but not in ' + right.name + '\n'); console.log(_(left.log). difference(right.log). map(function (line) { return left.full[left.log.indexOf(line)]; // lol O(n^2) }). value(). join('\n')); }; var checkout = oneArg(exec('git checkout %s')); var getCurrentBranch = andThen(noArgs(exec('git rev-parse --abbrev-ref HEAD')), oneLine); var getTags = noArgs(exec('git tag')); var getShaOfTag = oneArg(exec('git rev-list %s | head -n 1')); var getTheLog = oneArg(exec('git log --pretty=oneline %s..HEAD | cat')); // remember this so we can restore state var currentBranch; getCurrentBranch(). then(function (branch) { currentBranch = branch; }). then(getTags). then(function (tags) { return tags. filter(semver.valid). map(semver.clean). sort(semver.rcompare); }). then(function (tags) { var major = tags[0].split('.')[0]; return tags. filter(function (ver) { return semver(ver).major == major; }); }). then(function (tags) { return _(tags). groupBy(function (tag) { return tag.split('.')[1]; }). map(function (group) { return _.first(group); }). map(function (tag) { return 'v' + tag; }). value(); }). then(function (tags) { var master = tags.pop(); var stable = tags.pop(); return [ { name: stable.replace(/\d+$/, 'x'), tag: stable }, { name: 'master', tag: master} ]; }). then(allInSeries(function (branch) { return checkout(branch.name). then(function () { return getTheLog(branch.tag); }). then(function (log) { return log. filter(identity); }). then(function (log) { branch.full = log.map(function (line) { line = line.split(' '); var sha = line.shift(); var msg = line.join(' '); return sha + ((/fix\([^\)]+\):/i.test(msg)) ? ' * ' : ' ') + msg; }); branch.log = log.map(function (line) { return line.substr(41); }); return branch; }); })). then(function (pairs) { compareBranches(pairs[0], pairs[1]); console.log('\n'); compareBranches(pairs[1], pairs[0]); return pairs; }). then(function () { return checkout(currentBranch); }). catch(function (e) { console.log(e.stack); }); |
| You are visitor 01402792 — GeezerVison does not store the pages you look up. Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required. |