[PATCH hg-website] Mercurial version x.y.z, z=0 is always incorrect; disregard
David Champion
dgc at uchicago.edu
Wed Mar 2 18:05:49 UTC 2011
* On 02 Mar 2011, David Champion wrote:
> +
> + // Strip '.0' version suffix. It is always incorrect for Mercurial releases.
> + if (this.version.indexOf('.0', this.version.length - 2) != -1)
> + this.version = this.version.substr(0, this.version.length - 2);
That is so incorrect I can't even apologize. Here's a better patch.
# HG changeset patch
# User David Champion <dgc at uchicago.edu>
# Date 1299088054 21600
# Node ID 7f0294254d678e26f0dda1fb11f164261f0dc338
# Parent 946b08cf525c337940aafe81e6297aa1186bbd90
Mercurial version x.y.z, z=0 is always incorrect; disregard.
An erroneous latest.dat should be fixed, but this patch will prevent
such errors from having a negative effect on the website. (They
cause prior versions not to be displayed even when they should be, if
Downloader.maxversions is nonzero.)
diff --git a/static/js/download.js b/static/js/download.js
--- a/static/js/download.js
+++ b/static/js/download.js
@@ -3,6 +3,14 @@
this.regex = source[1];
this.url = source[2];
this.desc = source[3];
+
+ // Strip '.0' version suffix, unless it is for a minor version.
+ // It is always incorrect for Mercurial releases.
+ var points = this.version.split('.');
+ if (points.length > 2 && points[points.length-1] == "0") {
+ points.pop();
+ this.version = points.join(".");
+ }
}
Download.prototype = {
More information about the Mercurial-packaging
mailing list