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
- 5803cf4f|||PR vendor: Hybriel set-day59 and GC budget 32 MiBmre
- 9eff6627Merge branch 'f2-api-bugs' into mainGitoria
- 26117255|||PR apps API: review comments on files with spaces in their namemre
- b8796cecMerge branch 'f1-broken-json' into mainGitoria
- 2f2959c5|||PR apps API: broken JSON body gives 400 invalid_json, not 500mre
- f7c6ca07Merge branch 'ident-chooser-selector' into mainGitoria
- 691abb8e|||PR tests: find ident identity choice without the removed .choose classmre
- 16a3530fMerge branch 'heap-revert' into mainGitoria
- 220a80e0|||PR Remove temporary /__heap route and heap helper; logmre
- 13f0c342Merge branch 'hl25-records' into mainGitoria
- a002ecb7|||PR records: HL25 report, heap helper, logmre
- 2492a55cTemporary keyed /__heap route for the live memory snapshotmre
- fefaedd2log: tracker PR-only, HL25 startedmre
- 21aa57calog: parkmre
- e9f950a8reports: G25c soakmre
- a7783686log: deploy 9f41ffcmre
- 9f41ffc1log: W30b mergedmre
- bef635c1Merge branch 'w30b'mre
- 15b996a5Org list: keyed rows by @id, newest first, concat instead of hand loopmre
- c4f6d9e3reports: G25c growth huntmre