1 var XObject = imports.XObject.XObject;
4 Event = XObject.define(
6 // do nothing?? universal ctr ?
7 XObject.extend(this,cfg);
8 if (this.commit.length) {
11 //print(JSON.stringify(this, null,4)); Seed.quit();
19 /** Revision or changeset identifier for this particular file */
22 /** commit message associated with this revision */
25 /** who committed this revision */
28 /** when this revision was committed */
31 /** files affected in this event; may be null, but otherwise
32 * will be an array of MTrackSCMFileEvent */
40 parseCommit : function()
45 this.branches = []; // FIXME
46 this.tags = []; // FIXME
51 var lines = this.commit.split("\n");
53 // print ('--->'+ lines.join("\n"));
55 var line = lines.shift();
56 if (!line.match(/^commit\s+(\S+)/)) {
57 throw "Invalid commit line";
59 this.rev = line.replace(/^commit\s+/,'');
61 while (lines.length) {
64 break; // empty line = STOP?
66 if (line.match(/^(\S+):\s+(.*)\s*/)) {
68 line.replace(/^(\S+):\s+(.*)\s*/, function(m,ma,mb) {
79 //var ts = strtotime(v);
81 var Date = imports.Date.Date;
82 //var pd = imports.Date.Date.pqqqarseDate;
84 this.changed = Date.parseDate(v, "Y-m-d h:i:s O");
85 this.cday = this.changed.format("Y-m-d");
86 this.ctime = this.changed.format("H:i:s");
98 while ( lines.length ) {
100 if (!line.match(/^ /)) {
101 lines.unshift( line );
104 line = line.substring( 4);
105 this.changelog += line + "\n";
108 if (lines[0] == '') {
114 // this should only be the last set of lines..
115 lines.forEach(function(line) {
120 if (line.match(/^:/)) {
121 // it's our stat line..:
122 // :100755 100755 fde93abd1a71accd3aa7e97b29c1eecfb43095d7
123 // 3d71edf6512035846d8164c3b28818de0062335a M web/MTrackWeb/DataObjects/Changes.php
124 var lr = line.split(/\t/);
125 var info = lr[0].substring(1).split(/\s+/);
129 var f = {}; //new MTrackSCMFileEvent; //generic..
131 f.oldperm = info.shift();
132 f.newperm = info.shift();
133 f.oldver = info.shift();
134 f.newver = info.shift();;
135 f.status = info.shift();
136 f.name = lr[1]; // not the right way to do this!!! - does not handle names correclty.
137 ent.files[f.name] = f;
142 var info = line.substring(1).split(/\t/); // 3 only..
144 var added = info.shift();
145 var removed = info.shift();
147 var name = info.join("\t");
149 ent.files[name] = XObject.extend(
150 typeof(ent.files[name]) == 'undefined' ? {} : ent.files[name],
158 if (!this.branches.length) {
159 this.branches.push( 'master' );