- commit
- 618a67c
- parent
- 29141e6
- author
- Eric Bower
- date
- 2024-06-24 10:37:03 -0400 EDT
refactor: remove comments I'd rather comments be part of a patch
+0,
-3
1@@ -95,9 +95,6 @@ git format-patch HEAD~1 --stdout | ssh pr.pico.sh pr review 1
2 # Contributor can checkout reviews
3 ssh pr.pico.sh pr print 1 | git am -3 -i
4
5-# Commenting
6-cat my_comment.md | pr.pico.sh comment 1
7-
8 # Owner can reject a pr:
9 ssh pr.pico.sh pr close 1
10
M
cli.go
+2,
-13
1@@ -78,13 +78,10 @@ func parseRange(rnge string, sliceLen int) (*Ranger, error) {
2 }
3
4 func filterPatches(ranger *Ranger, patches []*Patch) []*Patch {
5- opatches := []*Patch{}
6 if ranger.Left == ranger.Right {
7- opatches = []*Patch{patches[ranger.Left]}
8- } else {
9- opatches = patches[ranger.Left:ranger.Right]
10+ return []*Patch{patches[ranger.Left]}
11 }
12- return opatches
13+ return patches[ranger.Left:ranger.Right]
14 }
15
16 func NewCli(sesh ssh.Session, be *Backend, pr GitPatchRequest) *cli.App {
17@@ -653,14 +650,6 @@ Here's how it works:
18 return nil
19 },
20 },
21- {
22- Name: "comment",
23- Usage: "Comment on a PR",
24- Action: func(cCtx *cli.Context) error {
25- wish.Println(sesh, "Commenting is not currently implemented :(")
26- return nil
27- },
28- },
29 },
30 },
31 },
M
db.go
+0,
-29
1@@ -39,23 +39,12 @@ type Patch struct {
2 CreatedAt time.Time `db:"created_at"`
3 }
4
5-// Comment is a database model for a non-patch comment within a PatchRequest.
6-type Comment struct {
7- ID int64 `db:"id"`
8- Pubkey string `db:"pubkey"`
9- PatchRequestID int64 `db:"patch_request_id"`
10- Text string `db:"text"`
11- CreatedAt time.Time `db:"created_at"`
12- UpdatedAt time.Time `db:"updated_at"`
13-}
14-
15 // EventLog is a event log for RSS or other notification systems.
16 type EventLog struct {
17 ID int64 `db:"id"`
18 Pubkey string `db:"pubkey"`
19 RepoID string `db:"repo_id"`
20 PatchRequestID int64 `db:"patch_request_id"`
21- CommentID int64 `db:"comment_id"`
22 Event string `db:"event"`
23 Data string `db:"data"`
24 CreatedAt time.Time `db:"created_at"`
25@@ -100,35 +89,17 @@ CREATE TABLE IF NOT EXISTS patches (
26 ON UPDATE CASCADE
27 );
28
29-CREATE TABLE IF NOT EXISTS comments (
30- id INTEGER PRIMARY KEY AUTOINCREMENT,
31- pubkey TEXT NOT NULL,
32- patch_request_id INTEGER NOT NULL,
33- text TEXT NOT NULL,
34- created_at DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP,
35- updated_at DATETIME NOT NULL,
36- CONSTRAINT pr_id_fk
37- FOREIGN KEY(patch_request_id) REFERENCES patch_requests(id)
38- ON DELETE CASCADE
39- ON UPDATE CASCADE
40-);
41-
42 CREATE TABLE IF NOT EXISTS event_logs (
43 id INTEGER PRIMARY KEY AUTOINCREMENT,
44 pubkey TEXT NOT NULL,
45 repo_id TEXT,
46 patch_request_id INTEGER,
47- comment_id INTEGER,
48 event TEXT NOT NULL,
49 data TEXT,
50 created_at DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP,
51 CONSTRAINT event_logs_pr_id_fk
52 FOREIGN KEY(patch_request_id) REFERENCES patch_requests(id)
53 ON DELETE CASCADE
54- ON UPDATE CASCADE,
55- CONSTRAINT event_logs_comment_id_fk
56- FOREIGN KEY(comment_id) REFERENCES comments(id)
57- ON DELETE CASCADE
58 ON UPDATE CASCADE
59 );
60 `
M
pr.go
+1,
-2
1@@ -147,11 +147,10 @@ func (cmd PrCmd) CreateEventLog(eventLog EventLog) error {
2 }
3
4 _, err := cmd.Backend.DB.Exec(
5- "INSERT INTO event_logs (pubkey, repo_id, patch_request_id, comment_id, event, data) VALUES (?, ?, ?, ?, ?, ?)",
6+ "INSERT INTO event_logs (pubkey, repo_id, patch_request_id, event, data) VALUES (?, ?, ?, ?, ?, ?)",
7 eventLog.Pubkey,
8 eventLog.RepoID,
9 eventLog.PatchRequestID,
10- eventLog.CommentID,
11 eventLog.Event,
12 eventLog.Data,
13 )