1
0
mirror of https://github.com/gryf/pentadactyl-pm.git synced 2025-12-23 23:42:27 +01:00

Bake hg version into install.rdf on XPI build. Warn users who are running in a testing branch.

--HG--
branch : groups
This commit is contained in:
Kris Maglione
2011-02-07 19:54:42 -05:00
parent ee03cbd2ce
commit e9a18c1a5a
5 changed files with 48 additions and 14 deletions

View File

@@ -32,7 +32,7 @@ CHROME = $(MANGLE)/
JAR = $(CHROME)$(NAME).jar
XPI_BASES = $(JAR_BASES) $(TOP)/..
XPI_FILES = bootstrap.js install.rdf TODO AUTHORS Donors NEWS LICENSE.txt
XPI_FILES = bootstrap.js TODO AUTHORS Donors NEWS LICENSE.txt
XPI_DIRS = components $(MANGLE) defaults
XPI_TEXTS = js jsm $(JAR_TEXTS)
XPI_BINS = $(JAR_BINS)
@@ -49,6 +49,9 @@ BUILD_DIR = build.$(VERSION).$(OS)
AWK ?= awk
B64ENCODE ?= base64
CURL ?= curl
SED := $(shell if [ "xoo" = x$$(echo foo | sed -E 's/f(o)/\1/' 2>/dev/null) ]; \
then echo sed -E; else echo sed -r; \
fi)
.SILENT:
@@ -177,7 +180,15 @@ xpi: $(CHROME)
$(AWK) -v 'name=$(NAME)' -v 'suffix=$(MANGLE)' \
-f $(BASE)/process_manifest.awk \
$(TOP)/chrome.manifest >"$(XPI_PATH)/chrome.manifest"
"$(TOP)/chrome.manifest" >"$(XPI_PATH)/chrome.manifest"
version="$(VERSION)"; \
hg root >/dev/null 2>&1 && \
case "$$version" in \
*pre) version="$$version-hg$$(hg log -r . --template '{rev}')-$$(hg branch)";; \
esac; \
$(SED) -e 's/(em:version(>|="))([^"<]+)/\1'"$$version/" \
<"$(TOP)/install.rdf" >"$(XPI_PATH)/install.rdf"
$(MAKE_JAR) "$(XPI)" "$(XPI_BASES)" "$(XPI_DIRS)" "$(XPI_TEXTS)" "$(XPI_BINS)" "$(XPI_FILES)"
rm -r -- $(CHROME)

View File

@@ -259,8 +259,6 @@ var Buffer = Module("buffer", {
* @property {Object} The document loading progress listener.
*/
progressListener: {
dactylLoadCount: 0,
// XXX: function may later be needed to detect a canceled synchronous openURL()
onStateChange: util.wrapCallback(function onStateChange(webProgress, request, flags, status) {
onStateChange.superapply(this, arguments);
@@ -273,10 +271,6 @@ var Buffer = Module("buffer", {
statusline.progress = 0;
buffer._triggerLoadAutocmd("PageLoadPre", webProgress.DOMWindow.document);
if (document.commandDispatcher.focusedWindow == webProgress.DOMWindow && this.dactylLoadCount++)
util.timeout(function () { modes.reset(false); },
modes.main == modes.HINTS ? 500 : 0);
}
else if (flags & Ci.nsIWebProgressListener.STATE_STOP) {
// Workaround for bugs 591425 and 606877, dactyl bug #81

View File

@@ -80,8 +80,8 @@ var MOW = Module("mow", {
widgets: Class.memoize(function () commandline.widgets),
body: Class.memoize(function () this.widget.contentDocument.documentElement),
document: Class.memoize(function () this.widget.contentDocument),
window: Class.memoize(function () this.widget.contentWindow),
get document() this.widget.contentDocument,
get window() this.widget.contentWindow,
/**
* Display a multi-line message.
@@ -90,6 +90,8 @@ var MOW = Module("mow", {
* @param {string} highlightGroup
*/
echo: function echo(data, highlightGroup, silent) {
this.document;
util.dump(String(this.widget), String(this.window), String(this.document));
let body = this.document.body;
this.widgets.message = null;

View File

@@ -115,6 +115,23 @@ var ConfigBase = Class("ConfigBase", {
.nth(function (l) set.has(langs, l), 0);
},
haveHg: Class.memoize(function () {
if (/pre$/.test(this.addon.version)) {
let uri = this.addon.getResourceURI("../.hg");
if (uri instanceof Ci.nsIFileURL &&
uri.QueryInterface(Ci.nsIFileURL).file.exists() &&
io.pathSearch("hg"))
return ["hg", "-R", uri.file.parent.path];
}
return null;
}),
branch: Class.memoize(function () {
if (this.haveHg)
return io.system(this.haveHg.concat(["branch"])).output;
return (/pre-hg\d+-(.*)$/.exec(this.version) || [])[1];
}),
/** @property {string} The Dactyl version string. */
version: Class.memoize(function () {
if (/pre$/.test(this.addon.version)) {
@@ -124,11 +141,11 @@ var ConfigBase = Class("ConfigBase", {
io.pathSearch("hg")) {
return io.system(["hg", "-R", uri.file.parent.path,
"log", "-r.",
"--template=hg{rev} ({date|isodate})"]).output;
"--template=hg{rev}-" + this.branch + " ({date|isodate})"]).output;
}
}
let version = this.addon.version;
if ("@DATE" !== "@" + "DATE@")
if ("@DATE@" !== "@" + "DATE@")
version += " (created: @DATE@)";
return version;
}),
@@ -723,6 +740,15 @@ config.INIT = update(Object.create(config.INIT), config.INIT, {
{"}"}</>);
img = null;
};
},
load: function load(dactyl, modules, window) {
load.superapply(this, arguments);
if (this.branch && this.branch !== "default" &&
modules.yes_i_know_i_should_not_report_errors_in_these_branches_thanks.indexOf(this.branch) === -1)
dactyl.warn("You are running " + config.appName + " from a testing branch: " + this.branch + ". " +
"Please do not report errors which do not also occur in the default branch.");
}
});

View File

@@ -102,6 +102,7 @@ var Overlay = Module("Overlay", {
const jsmodules = { NAME: "jsmodules" };
const modules = update(create(jsmodules), {
yes_i_know_i_should_not_report_errors_in_these_branches_thanks: [],
jsmodules: jsmodules,