repos / git-pr

a self-hosted git collaboration server
git clone https://github.com/picosh/git-pr.git

commit
95ace53
parent
b135780
author
Eric Bower
date
2024-04-30 23:10:04 -0400 EDT
changes
3 files changed,  +23, -11
M db.go
M Makefile
+1, -0
1@@ -1,5 +1,6 @@
2 fmt:
3 	go fmt ./...
4+	deno fmt README.md
5 .PHONY: fmt
6 
7 build:
M README.md
+5, -9
 1@@ -76,20 +76,18 @@ git add -A && git commit -m "fix: some bugs"
 2 
 3 # Contributor runs:
 4 git format-patch --stdout | ssh git.sh pr noice
 5-# (-or-) Contributor runs 
 6-git format-patch && rsync *.patch git.sh:/noice/
 7 # > Patch Request has been created (ID: noice/1)
 8 
 9 # Contributor can copy down patch request metadata:
10-rsync git.sh:/noice/pr_1.md .
11+rsync git.sh:/noice/1.md .
12 # Contributor edits patch request metadata, then runs:
13-rsync pr_1.md git.sh:/noice/
14+rsync 1.md git.sh:/noice/
15 
16 # Owner can checkout patch:
17 ssh git.sh pr noice/1 | git am -3
18 # Owner can comment in code, then commit, then send another format-patch
19 # on top of it:
20-git format-patch --stdout | ssh git.sh pr noice/1
21+git format-patch --stdout | ssh git.sh pr noice/1 --review
22 # We do some magic in the UI to make this look like comments or someway to
23 # clearly mark as a review
24 
25@@ -101,10 +99,8 @@ ssh git.sh pr noice/1 --squash-n-merge
26 # Contributor can checkout reviews
27 ssh git.sh pr noice/1 | git am -3
28 
29-# Contributor/Owner could also submit a one-off comment:
30-rsync my_comment.md git.sh:/noice/1
31-# (-or-)
32-cat my_comment.md | git.sh comment noice/1
33+# Commenting
34+cat my_comment.md | git.sh txt noice/1
35 
36 # rinse and repeat
37 ```
M db.go
+17, -2
 1@@ -25,11 +25,26 @@ type PatchRequest struct {
 2 	UpdatedAt time.Time `db:"updated_at"`
 3 }
 4 
 5-// Comment is a database model for a reply to a PatchRequest
 6+// Patch is a database model for a single entry in a patchset
 7+// This usually corresponds to a git commit.
 8+type Patch struct {
 9+	ID             int64     `db:"id"`
10+	UserID         int64     `db:"user_id"`
11+	PatchRequestID int64     `db:"patch_request_id"`
12+	FromName       string    `db:"from_name"`
13+	FromEmail      string    `db:"from_email"`
14+	Subject        string    `db:"subject"`
15+	Text           string    `db:"text"`
16+	Date           time.Time `db:"date"`
17+	CreatedAt      time.Time `db:"created_at"`
18+}
19+
20+// Comment is a database model for a non-patch comment within a PatchRequest
21 type Comment struct {
22 	ID             int64     `db:"id"`
23 	UserID         int64     `db:"user_id"`
24-	PatchRequestID int64     `db:"comment"`
25+	PatchRequestID int64     `db:"patch_request_id"`
26+	Text           string    `db:"text"`
27 	CreatedAt      time.Time `db:"created_at"`
28 	UpdatedAt      time.Time `db:"updated_at"`
29 }