Skip to content

Commit fb94c4a

Browse files
committed
Merge pull request #42 from gitpie/v0.6.0
V0.6.0
2 parents 4dd33f9 + 3b59907 commit fb94c4a

File tree

17 files changed

+587
-263
lines changed

17 files changed

+587
-263
lines changed

app/core/code-processor.js

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,20 @@ var getLineType = function (firstChar) {
5151
].join(''));
5252

5353
for (var i = 0; i < block.lines.length; i++) {
54-
var lineCode = block.lines[i].code.replace(/</g, '&lt;').replace(/>/g, '&gt;');
54+
var lineCode = block.lines[i].code.replace(/&/g, '&amp;').replace(/</g, '&lt;').replace(/>/g, '&gt;'),
55+
indicator;
56+
57+
switch (block.lines[i].type) {
58+
case 'PLUS':
59+
indicator = '+';
60+
break;
61+
case 'MINOR':
62+
indicator = '-';
63+
break;
64+
default:
65+
indicator = '';
66+
break;
67+
}
5568

5669
if (block.lines[i].type != 'UNCHANGED') {
5770
lineCode = lineCode.substr(1);
@@ -66,7 +79,7 @@ var getLineType = function (firstChar) {
6679
( block.lines[i].type != 'MINOR' ? rightNumberColumn : '' ),
6780
'</td>',
6881
'<td class="indicator">',
69-
( block.lines[i].type == 'MINOR' ? '-' : '+' ),
82+
indicator,
7083
'</td>',
7184
'<td>',
7285
'<code class="prettyprint ', ( lang ? lang : '' ),'">',

app/core/git.js

Lines changed: 55 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -122,12 +122,29 @@ Git.prototype.getCurrentBranch = function (path, callback) {
122122
* @param {function} callback - Callback to be execute in error or success case
123123
*/
124124
Git.prototype.getCommitHistory = function (opts, callback) {
125-
var emoji = require('./emoji');
125+
let emoji = require('./emoji'),
126+
skip = (opts.skip ? `--skip ${opts.skip}` : ''),
127+
filter = '',
128+
command;
129+
130+
if (opts.filter && opts.filter.text) {
131+
132+
switch (opts.filter.type) {
133+
case 'MESSAGE':
134+
filter = `--grep="${opts.filter.text}"`;
135+
break;
136+
case 'AUTHOR':
137+
filter = `--author="${opts.filter.text}"`;
138+
break;
139+
case 'FILE':
140+
filter = `-- ${opts.filter.text}`;
141+
break;
142+
}
143+
}
144+
145+
command = `git --no-pager log -n 25 --pretty=format:%an-gtseparator-%cr-gtseparator-%h-gtseparator-%s-gtseparator-%b-gtseparator-%ae-gtseparator-%p-pieLineBreak- ${skip} ${filter}`;
126146

127-
performCommand(
128-
"git --no-pager log -n 50 --pretty=format:%an-gtseparator-%cr-gtseparator-%h-gtseparator-%s-gtseparator-%b-gtseparator-%ae-pieLineBreak-" + (opts.skip ? ' --skip '.concat(opts.skip) : '' ),
129-
opts.path,
130-
function (error, stdout, stderr) {
147+
performCommand(command, opts.path, function (error, stdout, stderr) {
131148
var lines = stdout.split('-pieLineBreak-'),
132149
historyList = [],
133150
err = null;
@@ -147,7 +164,8 @@ Git.prototype.getCommitHistory = function (opts, callback) {
147164
hash: historyItem[2],
148165
message: emoji.parse(historyItem[3]),
149166
body: historyItem[4],
150-
email: historyItem[5]
167+
email: historyItem[5],
168+
parentHash: historyItem[6]
151169
});
152170
}
153171
}
@@ -776,6 +794,37 @@ Git.prototype.deleteBranch = function (path, opts) {
776794
performCommand(`git branch -D ${opts.branchName}`, path, opts.callback);
777795
};
778796

797+
Git.prototype.getCommitDiff = function (path, opts) {
798+
opts = opts || {};
799+
let command = `git log --pretty=%an-gtseparator-%h-gtseparator-%s-gtseparator-%aD ${opts.branchBase.trim()}..${opts.branchCompare.trim()}`;
800+
801+
performCommand(command, path, function (error, stdout) {
802+
let commits;
803+
804+
if (!error) {
805+
commits = [];
806+
807+
let lines = stdout.split('\n');
808+
809+
for (let i = 0; i < lines.length; i++) {
810+
811+
if (lines[i]) {
812+
let commitInfo = lines[i].split('-gtseparator-');
813+
814+
commits.push({
815+
author: commitInfo[0],
816+
hash: commitInfo[1],
817+
message: commitInfo[2],
818+
date: new Date(commitInfo[3])
819+
});
820+
}
821+
}
822+
}
823+
824+
invokeCallback(opts.callback, [ error, commits ]);
825+
});
826+
};
827+
779828
Git.prototype.geDiffMerge = function (path, opts) {
780829
opts = opts || {};
781830

app/core/packager/config.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
},
1111
"win" : {
1212
"title" : "GitPie",
13-
"version" : "0.5.1",
13+
"version" : "0.6.0",
1414
"publisher": "GitPie",
1515
"icon" : "resources/images/icon.ico",
1616
"verbosity": 1,

app/frontend/global/notification.js

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -57,17 +57,17 @@ class GPNotification {
5757
}
5858

5959
this.notificationElement.innerHTML += `<section class="content">${bodyText || titleText}</section>`;
60-
60+
6161
if (this.closable) {
6262
let closeBtn = document.createElement('button');
63-
63+
6464
closeBtn.className = 'close-button';
6565
closeBtn.title = MSGS.Close;
6666
closeBtn.innerHTML = '<span class="octicon octicon-x"></span>';
6767
closeBtn.onclick = function () {
6868
this.close();
6969
}.bind(this);
70-
70+
7171
this.notificationElement.appendChild(closeBtn);
7272
}
7373

@@ -82,6 +82,8 @@ class GPNotification {
8282
this.close();
8383
}.bind(this), 3000);
8484
}
85+
86+
return this;
8587
}
8688
}
8789

app/frontend/modules/attributes.js

Lines changed: 9 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22
angular.module('attributes', [])
33

44
.directive('ngRightClick', function($parse) {
5-
65
return function(scope, element, attrs) {
76
var fn = $parse(attrs.ngRightClick);
87

@@ -17,7 +16,6 @@
1716
})
1817

1918
.directive('ngScroll', function ($parse) {
20-
2119
return function (scope, element, attrs) {
2220
var fn = $parse(attrs.ngScroll);
2321

@@ -31,22 +29,17 @@
3129
};
3230
})
3331

34-
.directive('ngInputChange', function ($parse) {
35-
36-
return {
37-
restrict: 'A',
38-
require: '?ngModel',
39-
40-
link: function(scope, element, attrs, ngModel) {
32+
.directive('ngEnter', function() {
33+
return function(scope, element, attrs) {
4134

42-
element.on('change', function (e) {
35+
element.bind("keydown keypress", function(event) {
4336

44-
if (ngModel) {
45-
ngModel.$setViewValue(e.srcElement.value);
46-
}
47-
});
48-
}
37+
if (event.which === 13) {
38+
scope.$apply(function() {
39+
scope.$eval(attrs.ngEnter);
40+
});
41+
}
42+
});
4943
};
5044
});
51-
5245
})();

0 commit comments

Comments
 (0)