Skip to content

Commit bee1e42

Browse files
authored
Merge pull request #2522 from dpalou/MOBILE-3501
Mobile 3501
2 parents 37b0447 + 9de15f2 commit bee1e42

File tree

2 files changed

+16
-16
lines changed

2 files changed

+16
-16
lines changed

gulp/task-push.js

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -169,27 +169,24 @@ class PushTask {
169169
// Get the repository data for the project.
170170
let repositoryUrl = DevConfig.get(branchData.project + '.repositoryUrl');
171171
let diffUrlTemplate = DevConfig.get(branchData.project + '.diffUrlTemplate', '');
172-
let remoteUrl;
173172

174173
if (!repositoryUrl) {
175174
// Calculate the repositoryUrl based on the remote URL.
176-
remoteUrl = await Git.getRemoteUrl(remote);
177-
178-
repositoryUrl = remoteUrl.replace(/^https?:\/\//, 'git://');
179-
if (!repositoryUrl.match(/\.git$/)) {
180-
repositoryUrl += '.git';
181-
}
175+
repositoryUrl = await Git.getRemoteUrl(remote);
182176
}
183177

184-
if (!diffUrlTemplate) {
185-
// Calculate the diffUrlTemplate based on the remote URL.
186-
if (!remoteUrl) {
187-
remoteUrl = await Git.getRemoteUrl(remoteUrl);
188-
}
178+
// Make sure the repository URL uses the regular format.
179+
repositoryUrl = repositoryUrl.replace(/^(git@|git:\/\/)/, 'https://')
180+
.replace(/\.git$/, '')
181+
.replace('github.com:', 'github.com/');
189182

190-
diffUrlTemplate = remoteUrl + '/compare/%headcommit%...%branch%';
183+
if (!diffUrlTemplate) {
184+
diffUrlTemplate = Utils.concatenatePaths([repositoryUrl, 'compare/%headcommit%...%branch%']);
191185
}
192186

187+
// Now create the git URL for the repository.
188+
const repositoryGitUrl = repositoryUrl.replace(/^https?:\/\//, 'git://') + '.git';
189+
193190
// Search HEAD commit to put in the diff URL.
194191
console.log ('Searching for head commit...');
195192
let headCommit = await Git.getHeadCommit(branch, branchData);
@@ -209,7 +206,7 @@ class PushTask {
209206

210207
// Update tracker fields.
211208
const updates = {};
212-
updates[fieldRepositoryUrl] = repositoryUrl;
209+
updates[fieldRepositoryUrl] = repositoryGitUrl;
213210
updates[fieldBranch] = branch;
214211
updates[fieldDiffUrl] = diffUrl;
215212

@@ -251,7 +248,10 @@ class PushTask {
251248
if (numConsecutive > 2) {
252249
// 3 consecutive commits with different branch, probably the branch commits are over. Everything OK.
253250
return true;
254-
} else if (!wrongCommitCandidate) {
251+
252+
// Don't treat a merge pull request commit as a wrong commit between right commits.
253+
// The current push could be a quick fix after a merge.
254+
} else if (!wrongCommitCandidate && message.indexOf('Merge pull request') == -1) {
255255
wrongCommitCandidate = {
256256
message: message,
257257
issue: issue,

gulp/utils.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
// limitations under the License.
1414

1515
const DevConfig = require('./dev-config');
16-
const DEFAULT_ISSUE_REGEX = '(MOBILE)[-_]([0-9]+)';
16+
const DEFAULT_ISSUE_REGEX = '^(MOBILE)[-_]([0-9]+)';
1717

1818
/**
1919
* Class with some utility functions.

0 commit comments

Comments
 (0)