GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — commit-stream/commit-stream.js at master · Global19/commit-stream

Expand file tree

/

commit-stream.js

Copy path
More file actions
More file actions

Latest commit

 

History

History
History
95 lines (83 loc) · 2.78 KB
/

commit-stream.js

Copy path

File metadata and controls

95 lines (83 loc) · 2.78 KB
Raw
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
const through2 = require('through2')
, stripAnsi = require('strip-ansi')
module.exports = commitStream
function commitStream (ghUser, ghProject) {
var commit
return through2.obj(onLine, onEnd)
function addLine (line) {
line = stripAnsi(line)
if (!line)
return
var old, m
if (/^commit \w+$/.test(line)) {
old = commit
commit = {
sha: line.split(' ')[1]
}
} else if (m = line.match(/^CommitDate:\s+(.*)$/)) {
if (!commit)
throw new Error('wut?')
commit.commitDate = m[1].trim()
} else if (m = line.match(/^\s*(?:Author|Co[- ]?authored[- ]?by):?\s*([^<]+) <([^>]+)>\s*$/i)) {
if (!commit)
throw new Error('wut?')
if (!commit.authors)
commit.authors = []
commit.authors.push({ name: m[1], email: m[2] })
} else if (m = line.match(/^AuthorDate:\s+(.*)$/)) {
if (!commit)
throw new Error('wut?')
commit.authorDate = m[1].trim()
} else if (m = line.match(/^Date:\s+(.*)$/)) {
if (!commit)
throw new Error('wut?')
commit.authorDate = m[1].trim()
} else if (m = line.match(/^\s+Reviewed[- ]?By:?\s*([^<]+) <([^>]+)>\s*$/i)) {
if (!commit.reviewers)
commit.reviewers = []
commit.reviewers.push({ name: m[1], email: m[2] })
} else if (m = line.match(/^\s+PR(?:[- ]?URL)?:?\s*(.+)\s*$/)) {
commit.prUrl = m[1]
if (ghUser && ghProject && (m = commit.prUrl.match(/^\s*#?(\d+)\s*$/))) {
commit.prUrl = 'https://github.com/' + ghUser + '/' + ghProject + '/pull/' + m[1]
}
if (m = commit.prUrl.match(/^(https?:\/\/.+\/([^\/]+)\/([^\/]+))\/\w+\/(\d+)(\/)?$/i)) {
commit.ghIssue = +m[4]
commit.ghUser = m[2]
commit.ghProject = m[3]
}
} else if (/^ /.test(line) && (line = line.trim()).length) {
if (!commit.summary) {
commit.summary = line
} else {
if (!commit.description)
commit.description = []
commit.description.push(line)
}
} else if (/^ [^ ]/.test(line) && (line = line.trim()).length) {
if (m = line.match(/^(\d+) files? changed(?:, (\d+) insertions?\(\+\))?(?:, (\d+) deletions?\(-\))?/)) {
commit.changes = {
files : Number(m[1])
, insertions : Number(m[2] || 0)
, deletions : Number(m[3] || 0)
}
}
}
return old
}
function onLine (line, _, callback) {
var commit = addLine(line)
if (commit && commit.authors && commit.authors.length > 0)
commit.author = commit.authors[0]
if (commit)
this.push(commit)
callback()
}
function onEnd (callback) {
if (commit && commit.authors && commit.authors.length > 0)
commit.author = commit.authors[0]
if (commit)
this.push(commit)
callback()
}
}
You are visitor 01402775 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.