##// END OF EJS Templates
vcs: Minimal change to expose the shadow repository...
vcs: Minimal change to expose the shadow repository Based on my original research, this was the "minimal" starting point. It shows that three concepts are needed for the "repo_name": * From the security standpoint we think of the shadow repository having the same ACL as the target repository of the pull request. This is because the pull request itself is considered to be a part of the target repository. Out of this thought, the variable "acl_repo_name" is used whenever we want to check permissions or when we need the database configuration of the repository. An alternative name would have been "db_repo_name", but the usage for ACL checking is the most important one. * From the web interaction perspective, we need the URL which was originally used to get to the repository. This is because based on this base URL commands can be identified. Especially for Git this is important, so that the commands are correctly recognized. Since the URL is in the focus, this is called "url_repo_name". * Finally we have to deal with the repository on the file system. This is what the VCS layer deal with normally, so this name is called "vcs_repo_name". The original repository interaction is a special case where all three names are the same. When interacting with a pull request, these three names are typically all different. This change is minimal in a sense that it just makes the interaction with a shadow repository barely work, without checking any special constraints yet. This was the starting point for further work on this topic.

File last commit:

r1:854a839a default
r887:175782be default
Show More
toml.js
88 lines | 2.8 KiB | application/javascript | JavascriptLexer
// CodeMirror, copyright (c) by Marijn Haverbeke and others
// Distributed under an MIT license: http://codemirror.net/LICENSE
(function(mod) {
if (typeof exports == "object" && typeof module == "object") // CommonJS
mod(require("../../lib/codemirror"));
else if (typeof define == "function" && define.amd) // AMD
define(["../../lib/codemirror"], mod);
else // Plain browser env
mod(CodeMirror);
})(function(CodeMirror) {
"use strict";
CodeMirror.defineMode("toml", function () {
return {
startState: function () {
return {
inString: false,
stringType: "",
lhs: true,
inArray: 0
};
},
token: function (stream, state) {
//check for state changes
if (!state.inString && ((stream.peek() == '"') || (stream.peek() == "'"))) {
state.stringType = stream.peek();
stream.next(); // Skip quote
state.inString = true; // Update state
}
if (stream.sol() && state.inArray === 0) {
state.lhs = true;
}
//return state
if (state.inString) {
while (state.inString && !stream.eol()) {
if (stream.peek() === state.stringType) {
stream.next(); // Skip quote
state.inString = false; // Clear flag
} else if (stream.peek() === '\\') {
stream.next();
stream.next();
} else {
stream.match(/^.[^\\\"\']*/);
}
}
return state.lhs ? "property string" : "string"; // Token style
} else if (state.inArray && stream.peek() === ']') {
stream.next();
state.inArray--;
return 'bracket';
} else if (state.lhs && stream.peek() === '[' && stream.skipTo(']')) {
stream.next();//skip closing ]
// array of objects has an extra open & close []
if (stream.peek() === ']') stream.next();
return "atom";
} else if (stream.peek() === "#") {
stream.skipToEnd();
return "comment";
} else if (stream.eatSpace()) {
return null;
} else if (state.lhs && stream.eatWhile(function (c) { return c != '=' && c != ' '; })) {
return "property";
} else if (state.lhs && stream.peek() === "=") {
stream.next();
state.lhs = false;
return null;
} else if (!state.lhs && stream.match(/^\d\d\d\d[\d\-\:\.T]*Z/)) {
return 'atom'; //date
} else if (!state.lhs && (stream.match('true') || stream.match('false'))) {
return 'atom';
} else if (!state.lhs && stream.peek() === '[') {
state.inArray++;
stream.next();
return 'bracket';
} else if (!state.lhs && stream.match(/^\-?\d+(?:\.\d+)?/)) {
return 'number';
} else if (!stream.eatSpace()) {
stream.next();
}
return null;
}
};
});
CodeMirror.defineMIME('text/x-toml', 'toml');
});