This repository has been archived by the owner on Sep 20, 2019. It is now read-only.
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Bug 1146853 - submit_release: Populate the latest changeset automatic…
…ally (#132) * Fetch the latest changeset from hg.mozilla.org * Elmo: Show download message as placeholder * Remove Relbranch field from Firefox form * Fix discrepency between versionElement.select() and versionElement.change(). This fixes a bug where l10n changesets weren't automatically fetched
- Loading branch information
1 parent
ebe86bc
commit c6122a6
Showing
8 changed files
with
123 additions
and
51 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
function getJsonPushesUrl(branchName) { | ||
return CONFIG.baseUrls.hgMozilla + branchName + '/json-pushes'; | ||
} | ||
|
||
function pluckLatestRevision(jsonPushes) { | ||
var pushIds = Object.keys(jsonPushes); | ||
pushIds = pushIds.map(function(pushId) { return parseInt(pushId); }); | ||
latestPushId = pushIds.reduce(function(latest, challenger) { return challenger > latest ? challenger : latest; }); | ||
latestRevisions = jsonPushes[latestPushId].changesets; | ||
return latestRevisions[latestRevisions.length - 1]; | ||
} | ||
|
||
function populateRevisionWithLatest(productName, branchName) { | ||
var revisionElement = $('#' + productName + '-mozillaRevision'); | ||
var oldPlaceholder = revisionElement.attr('placeholder'); | ||
|
||
revisionElement.attr('placeholder', 'Fetching latest revision'); | ||
revisionElement.prop('disabled', true); | ||
|
||
$.ajax({ | ||
url: getJsonPushesUrl(branchName), | ||
}).done(function(results) { | ||
var latestRevision = pluckLatestRevision(results); | ||
revisionElement.val(latestRevision); | ||
}).fail(function() { | ||
revisionElement.val(''); | ||
console.error('Could not fetch latest revision for branch "' + branchName + '"'); | ||
}).always(function() { | ||
revisionElement.prop('disabled', false); | ||
revisionElement.attr('placeholder', oldPlaceholder); | ||
revisionElement.blur(); // this deactivates relbranch field, if needed | ||
}); | ||
} |
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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