commit
bee1e42b9b
|
@ -169,27 +169,24 @@ class PushTask {
|
||||||
// Get the repository data for the project.
|
// Get the repository data for the project.
|
||||||
let repositoryUrl = DevConfig.get(branchData.project + '.repositoryUrl');
|
let repositoryUrl = DevConfig.get(branchData.project + '.repositoryUrl');
|
||||||
let diffUrlTemplate = DevConfig.get(branchData.project + '.diffUrlTemplate', '');
|
let diffUrlTemplate = DevConfig.get(branchData.project + '.diffUrlTemplate', '');
|
||||||
let remoteUrl;
|
|
||||||
|
|
||||||
if (!repositoryUrl) {
|
if (!repositoryUrl) {
|
||||||
// Calculate the repositoryUrl based on the remote URL.
|
// Calculate the repositoryUrl based on the remote URL.
|
||||||
remoteUrl = await Git.getRemoteUrl(remote);
|
repositoryUrl = await Git.getRemoteUrl(remote);
|
||||||
|
|
||||||
repositoryUrl = remoteUrl.replace(/^https?:\/\//, 'git://');
|
|
||||||
if (!repositoryUrl.match(/\.git$/)) {
|
|
||||||
repositoryUrl += '.git';
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Make sure the repository URL uses the regular format.
|
||||||
|
repositoryUrl = repositoryUrl.replace(/^(git@|git:\/\/)/, 'https://')
|
||||||
|
.replace(/\.git$/, '')
|
||||||
|
.replace('github.com:', 'github.com/');
|
||||||
|
|
||||||
if (!diffUrlTemplate) {
|
if (!diffUrlTemplate) {
|
||||||
// Calculate the diffUrlTemplate based on the remote URL.
|
diffUrlTemplate = Utils.concatenatePaths([repositoryUrl, 'compare/%headcommit%...%branch%']);
|
||||||
if (!remoteUrl) {
|
|
||||||
remoteUrl = await Git.getRemoteUrl(remoteUrl);
|
|
||||||
}
|
|
||||||
|
|
||||||
diffUrlTemplate = remoteUrl + '/compare/%headcommit%...%branch%';
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Now create the git URL for the repository.
|
||||||
|
const repositoryGitUrl = repositoryUrl.replace(/^https?:\/\//, 'git://') + '.git';
|
||||||
|
|
||||||
// Search HEAD commit to put in the diff URL.
|
// Search HEAD commit to put in the diff URL.
|
||||||
console.log ('Searching for head commit...');
|
console.log ('Searching for head commit...');
|
||||||
let headCommit = await Git.getHeadCommit(branch, branchData);
|
let headCommit = await Git.getHeadCommit(branch, branchData);
|
||||||
|
@ -209,7 +206,7 @@ class PushTask {
|
||||||
|
|
||||||
// Update tracker fields.
|
// Update tracker fields.
|
||||||
const updates = {};
|
const updates = {};
|
||||||
updates[fieldRepositoryUrl] = repositoryUrl;
|
updates[fieldRepositoryUrl] = repositoryGitUrl;
|
||||||
updates[fieldBranch] = branch;
|
updates[fieldBranch] = branch;
|
||||||
updates[fieldDiffUrl] = diffUrl;
|
updates[fieldDiffUrl] = diffUrl;
|
||||||
|
|
||||||
|
@ -251,7 +248,10 @@ class PushTask {
|
||||||
if (numConsecutive > 2) {
|
if (numConsecutive > 2) {
|
||||||
// 3 consecutive commits with different branch, probably the branch commits are over. Everything OK.
|
// 3 consecutive commits with different branch, probably the branch commits are over. Everything OK.
|
||||||
return true;
|
return true;
|
||||||
} else if (!wrongCommitCandidate) {
|
|
||||||
|
// Don't treat a merge pull request commit as a wrong commit between right commits.
|
||||||
|
// The current push could be a quick fix after a merge.
|
||||||
|
} else if (!wrongCommitCandidate && message.indexOf('Merge pull request') == -1) {
|
||||||
wrongCommitCandidate = {
|
wrongCommitCandidate = {
|
||||||
message: message,
|
message: message,
|
||||||
issue: issue,
|
issue: issue,
|
||||||
|
|
|
@ -13,7 +13,7 @@
|
||||||
// limitations under the License.
|
// limitations under the License.
|
||||||
|
|
||||||
const DevConfig = require('./dev-config');
|
const DevConfig = require('./dev-config');
|
||||||
const DEFAULT_ISSUE_REGEX = '(MOBILE)[-_]([0-9]+)';
|
const DEFAULT_ISSUE_REGEX = '^(MOBILE)[-_]([0-9]+)';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Class with some utility functions.
|
* Class with some utility functions.
|
||||||
|
|
Loading…
Reference in New Issue