Last active
July 21, 2016 04:16
-
-
Save patrikvarga/01bd903b423f2f5a2b1b6e2aabac0d17 to your computer and use it in GitHub Desktop.
BitBucket PR merge message fix
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// ==UserScript== | |
// @name BitBucket PR merge message fix | |
// @namespace http://tampermonkey.net/ | |
// @version 0.1 | |
// @description Fix merge messages in BitBucket when merging pull requests to conform Git standard | |
// @author patrik | |
// @match https://bitbucket.org/*/*/pull-requests/*/* | |
// @grant none | |
// ==/UserScript== | |
(function() { | |
'use strict'; | |
console.log("BitBucket PR merge message fix loaded."); | |
$("body").on("DOMSubtreeModified", function() { | |
$("#id_commit_message:contains('Merged in ')").each(function() { | |
var targetBranchName = $("span.branch-name").eq(1).text(); | |
var fixedCommitMessage = this.textContent | |
.replace("Merged in ", "Merge branch '") | |
.replace(" (pull request ", "' into " + targetBranchName + " (pull request "); | |
this.textContent = fixedCommitMessage; | |
console.log("Commit message replaced to: " + fixedCommitMessage); | |
}); | |
}); | |
})(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment