hgweb: fix unstoppable loading of graph when no more results
When a user reaches the end of repo history with graph view, it (unsuccessfully)
tried to load more entries. This patch disables further loading attempts.
--- a/mercurial/templates/static/mercurial.js Wed Jul 24 03:20:26 2013 +0400
+++ b/mercurial/templates/static/mercurial.js Sat Oct 12 11:29:28 2013 +0400
@@ -393,8 +393,6 @@
appendFormatHTML(container, messageFormat, message);
},
function onsuccess(htmlText) {
- nextPageVar = nextPageVarGet(htmlText, nextPageVar);
-
if (mode == 'graph') {
var addHeight = htmlText.match(/^<canvas id="graph".*height="(\d+)"><\/canvas>$/m)[1];
addHeight = parseInt(addHeight);
@@ -402,6 +400,9 @@
var dataStr = htmlText.match(/^\s*var data = (.*);$/m)[1];
var data = JSON.parse(dataStr)
+ if (data.length < nextPageVar) {
+ nextPageVar = undefined;
+ }
graph.reset();
graph.render(data);
} else {
@@ -416,6 +417,8 @@
}
process_dates('.' + curClass);
}
+
+ nextPageVar = nextPageVarGet(htmlText, nextPageVar);
},
function onerror(errorText) {
var message = {