gitoria
All repositories: gitoria
1.9 KB
// lib/pullsync-helpers.hl — what lib/pullsync.hl looks up: the body of a commit message, the ticket names a text mentions,// one first line of git's answer. Statics only; git is not called here except through the `lines` handed in.import { NL } from './util.hl'// the commit message's lines → the text after the subject, without the blank line that separates them ('' if none)static bodyOfLines = (lines) => {let i = 1while (i < lines.length && lines[i].trim() == '') { i = i + 1 }out = []while (i < lines.length) {out.push(lines[i])i = i + 1}return out.join(NL).trimEnd()}static nameCode = (c) => {return (c >= 48 && c <= 57) || (c >= 65 && c <= 90) || (c >= 97 && c <= 122) || c == 45 || c == 46 || c == 95}static digitCode = (c) => { return c >= 48 && c <= 57 }// the tickets a text names, as `project#n` (contract §4): an explicit `project#12` is always listed; a bare `#12` only// when the repo is connected to a project (`project` is '' otherwise). No doubles, at most 50.static ticketNames = (text, project) => {out = []if (text == null || hlTypeName(text) != 'String') { return out }let i = 0while (i < text.length && out.length < 50) {if (text[i] == '#') {let j = i + 1while (j < text.length && j - i - 1 < 9 && digitCode(text.charCodeAt(j))) { j = j + 1 }let k = iwhile (k > 0 && nameCode(text.charCodeAt(k - 1))) { k = k - 1 }digits = text.slice(i + 1, j)// a full stop that ends a sentence ("Fixes proj#7.") does not belong to the number; one inside a name ("x.org") continues itafter = j >= text.length || !nameCode(text.charCodeAt(j)) || (text.charCodeAt(j) == 46 && (j + 1 >= text.length || !nameCode(text.charCodeAt(j + 1))))if (j > i + 1 && after && digits.slice(0, 1) != '0') {name = k < i ? text.slice(k, i) : projectif (name != null && name != '' && !out.includes(name + '#' + digits)) { out.push(name + '#' + digits) }}i = j > i + 1 ? j : i + 1} else {i = i + 1}}return out}
Branches
Latest commits
- fd4fc028Exercise member status reads with a populated check statemre
- 536ca6f9Allow repository members to read pull workflow APIs with user tokensmre
- 705dd834W49 missionmre
- b554cd5flogmre
- f4c9440ddeploy.sh: tar --hard-dereference for the live data backupmre
- 1a687b15Merge branch 'w48-member-merge'mre
- 166c775fW48 report, logmre
- 1b4623f0Members merge pull requests: API route, button on /pulls and /pulls/N, one shared merge pathmre
- 1075c38cW48 mission, logmre
- 17bdd0d6V37/V39 missions, logmre
- 146de5f8Re-vendor gitoria to Hybriel set-day39 (51e921d7)mre
- e874e44dtests/status-keyed: app token lives 60 s so it outlives the gate's two restartsmre
- 270b8d61deploy.sh: DEPLOY_STOP_START=1 stops, waits for the old pid, then starts (mpackdb freeze, replaces the standby swap)mre
- 3f9235b8project.hl: drop the dummy /pulls/:n component route (hybriel#294 is fixed in day37)mre
- c90daf19Re-vendor gitoria to Hybriel set-day37 (f6b3d45b)mre
- 03b5bb08W39 report to reports/, drop scratch repro, mission + logmre
- 154d333fMerge w39-create-api: POST /api/repos with a user token (#39)mre
- 149dd512Rewrite W39 reportmre
- e5385075Expect 401 for POST /api/repos without a tokenmre
- 1a76055cDocument repository creation APImre