Skip to content

Commit

Permalink
Merge pull request #42 from gitpie/v0.6.0
Browse files Browse the repository at this point in the history
V0.6.0
  • Loading branch information
mapaiva committed May 14, 2016
2 parents 4dd33f9 + 3b59907 commit fb94c4a
Show file tree
Hide file tree
Showing 17 changed files with 587 additions and 263 deletions.
17 changes: 15 additions & 2 deletions app/core/code-processor.js
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,20 @@ var getLineType = function (firstChar) {
].join(''));

for (var i = 0; i < block.lines.length; i++) {
var lineCode = block.lines[i].code.replace(/</g, '&lt;').replace(/>/g, '&gt;');
var lineCode = block.lines[i].code.replace(/&/g, '&amp;').replace(/</g, '&lt;').replace(/>/g, '&gt;'),
indicator;

switch (block.lines[i].type) {
case 'PLUS':
indicator = '+';
break;
case 'MINOR':
indicator = '-';
break;
default:
indicator = '';
break;
}

if (block.lines[i].type != 'UNCHANGED') {
lineCode = lineCode.substr(1);
Expand All @@ -66,7 +79,7 @@ var getLineType = function (firstChar) {
( block.lines[i].type != 'MINOR' ? rightNumberColumn : '' ),
'</td>',
'<td class="indicator">',
( block.lines[i].type == 'MINOR' ? '-' : '+' ),
indicator,
'</td>',
'<td>',
'<code class="prettyprint ', ( lang ? lang : '' ),'">',
Expand Down
61 changes: 55 additions & 6 deletions app/core/git.js
Original file line number Diff line number Diff line change
Expand Up @@ -122,12 +122,29 @@ Git.prototype.getCurrentBranch = function (path, callback) {
* @param {function} callback - Callback to be execute in error or success case
*/
Git.prototype.getCommitHistory = function (opts, callback) {
var emoji = require('./emoji');
let emoji = require('./emoji'),
skip = (opts.skip ? `--skip ${opts.skip}` : ''),
filter = '',
command;

if (opts.filter && opts.filter.text) {

switch (opts.filter.type) {
case 'MESSAGE':
filter = `--grep="${opts.filter.text}"`;
break;
case 'AUTHOR':
filter = `--author="${opts.filter.text}"`;
break;
case 'FILE':
filter = `-- ${opts.filter.text}`;
break;
}
}

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}`;

performCommand(
"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) : '' ),
opts.path,
function (error, stdout, stderr) {
performCommand(command, opts.path, function (error, stdout, stderr) {
var lines = stdout.split('-pieLineBreak-'),
historyList = [],
err = null;
Expand All @@ -147,7 +164,8 @@ Git.prototype.getCommitHistory = function (opts, callback) {
hash: historyItem[2],
message: emoji.parse(historyItem[3]),
body: historyItem[4],
email: historyItem[5]
email: historyItem[5],
parentHash: historyItem[6]
});
}
}
Expand Down Expand Up @@ -776,6 +794,37 @@ Git.prototype.deleteBranch = function (path, opts) {
performCommand(`git branch -D ${opts.branchName}`, path, opts.callback);
};

Git.prototype.getCommitDiff = function (path, opts) {
opts = opts || {};
let command = `git log --pretty=%an-gtseparator-%h-gtseparator-%s-gtseparator-%aD ${opts.branchBase.trim()}..${opts.branchCompare.trim()}`;

performCommand(command, path, function (error, stdout) {
let commits;

if (!error) {
commits = [];

let lines = stdout.split('\n');

for (let i = 0; i < lines.length; i++) {

if (lines[i]) {
let commitInfo = lines[i].split('-gtseparator-');

commits.push({
author: commitInfo[0],
hash: commitInfo[1],
message: commitInfo[2],
date: new Date(commitInfo[3])
});
}
}
}

invokeCallback(opts.callback, [ error, commits ]);
});
};

Git.prototype.geDiffMerge = function (path, opts) {
opts = opts || {};

Expand Down
2 changes: 1 addition & 1 deletion app/core/packager/config.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
},
"win" : {
"title" : "GitPie",
"version" : "0.5.1",
"version" : "0.6.0",
"publisher": "GitPie",
"icon" : "resources/images/icon.ico",
"verbosity": 1,
Expand Down
8 changes: 5 additions & 3 deletions app/frontend/global/notification.js
Original file line number Diff line number Diff line change
Expand Up @@ -57,17 +57,17 @@ class GPNotification {
}

this.notificationElement.innerHTML += `<section class="content">${bodyText || titleText}</section>`;

if (this.closable) {
let closeBtn = document.createElement('button');

closeBtn.className = 'close-button';
closeBtn.title = MSGS.Close;
closeBtn.innerHTML = '<span class="octicon octicon-x"></span>';
closeBtn.onclick = function () {
this.close();
}.bind(this);

this.notificationElement.appendChild(closeBtn);
}

Expand All @@ -82,6 +82,8 @@ class GPNotification {
this.close();
}.bind(this), 3000);
}

return this;
}
}

Expand Down
25 changes: 9 additions & 16 deletions app/frontend/modules/attributes.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
angular.module('attributes', [])

.directive('ngRightClick', function($parse) {

return function(scope, element, attrs) {
var fn = $parse(attrs.ngRightClick);

Expand All @@ -17,7 +16,6 @@
})

.directive('ngScroll', function ($parse) {

return function (scope, element, attrs) {
var fn = $parse(attrs.ngScroll);

Expand All @@ -31,22 +29,17 @@
};
})

.directive('ngInputChange', function ($parse) {

return {
restrict: 'A',
require: '?ngModel',

link: function(scope, element, attrs, ngModel) {
.directive('ngEnter', function() {
return function(scope, element, attrs) {

element.on('change', function (e) {
element.bind("keydown keypress", function(event) {

if (ngModel) {
ngModel.$setViewValue(e.srcElement.value);
}
});
}
if (event.which === 13) {
scope.$apply(function() {
scope.$eval(attrs.ngEnter);
});
}
});
};
});

})();
Loading

0 comments on commit fb94c4a

Please sign in to comment.