Skip to content

Commit 966a19a

Browse files
committed
feat: range diff
1 parent 4f3e0b2 commit 966a19a

20 files changed

+1047
-72
lines changed

Makefile

+4
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,10 @@ lint:
1212
golangci-lint run -E goimports -E godot --timeout 10m
1313
.PHONY: lint
1414

15+
test:
16+
go test ./...
17+
.PHONY: test
18+
1519
build:
1620
go build -o ./build/ssh ./cmd/ssh
1721
go build -o ./build/web ./cmd/web

cli.go

+2-2
Original file line numberDiff line numberDiff line change
@@ -485,13 +485,13 @@ Here's how it works:
485485
prev = patchsets[len(patchsets)-2]
486486
}
487487

488-
patches, err := pr.DiffPatchsets(prev, latest)
488+
rangeDiff, err := pr.DiffPatchsets(prev, latest)
489489
if err != nil {
490490
be.Logger.Error("could not diff patchset", "err", err)
491491
return err
492492
}
493493

494-
printPatches(sesh, patches)
494+
wish.Println(sesh, rangeDiff)
495495
return nil
496496
},
497497
},

db.go

+6
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ import (
66
"log/slog"
77
"time"
88

9+
"github.com/bluekeyes/go-gitdiff/gitdiff"
910
"github.com/jmoiron/sqlx"
1011
_ "modernc.org/sqlite"
1112
)
@@ -67,6 +68,11 @@ type Patch struct {
6768
BaseCommitSha sql.NullString `db:"base_commit_sha"`
6869
RawText string `db:"raw_text"`
6970
CreatedAt time.Time `db:"created_at"`
71+
Files []*gitdiff.File
72+
}
73+
74+
func (p *Patch) CalcDiff() string {
75+
return p.RawText
7076
}
7177

7278
// EventLog is a event log for RSS or other notification systems.

fixtures/a_b.patch

+31
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
From 33c682ac27479f501924cf159d0a75ad91deb589 Mon Sep 17 00:00:00 2001
2+
From: Eric Bower <[email protected]>
3+
Date: Tue, 23 Jul 2024 10:07:57 -0400
4+
Subject: [PATCH] chore: add torch and create random tensor
5+
6+
---
7+
requirements.txt | 1 +
8+
train.py | 3 +++
9+
2 files changed, 4 insertions(+)
10+
create mode 100644 requirements.txt
11+
12+
diff --git a/requirements.txt b/requirements.txt
13+
new file mode 100644
14+
index 0000000..4968a39
15+
--- /dev/null
16+
+++ b/requirements.txt
17+
@@ -0,0 +1 @@
18+
+torch==2.3.1
19+
diff --git a/train.py b/train.py
20+
index 5c027f4..d21dac3 100644
21+
--- a/train.py
22+
+++ b/train.py
23+
@@ -1,2 +1,5 @@
24+
+import torch
25+
+
26+
if __name__ == "__main__":
27+
print("train!")
28+
+ torch.rand(3,6)
29+
--
30+
2.45.2
31+

fixtures/a_b_reorder.patch

+55
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
From 33c682ac27479f501924cf159d0a75ad91deb589 Mon Sep 17 00:00:00 2001
2+
From: Eric Bower <[email protected]>
3+
Date: Tue, 23 Jul 2024 10:07:57 -0400
4+
Subject: [PATCH 1/2] chore: add torch and create random tensor
5+
6+
---
7+
requirements.txt | 1 +
8+
train.py | 3 +++
9+
2 files changed, 4 insertions(+)
10+
create mode 100644 requirements.txt
11+
12+
diff --git a/requirements.txt b/requirements.txt
13+
new file mode 100644
14+
index 0000000..4968a39
15+
--- /dev/null
16+
+++ b/requirements.txt
17+
@@ -0,0 +1 @@
18+
+torch==2.3.1
19+
diff --git a/train.py b/train.py
20+
index 5c027f4..d21dac3 100644
21+
--- a/train.py
22+
+++ b/train.py
23+
@@ -1,2 +1,5 @@
24+
+import torch
25+
+
26+
if __name__ == "__main__":
27+
print("train!")
28+
+ torch.rand(3,6)
29+
--
30+
2.45.2
31+
32+
33+
From 22dde1259c34a166d5a9335ebe5236e79541cc63 Mon Sep 17 00:00:00 2001
34+
From: Eric Bower <[email protected]>
35+
Date: Tue, 23 Jul 2024 10:14:37 -0400
36+
Subject: [PATCH 2/2] docs: readme
37+
38+
---
39+
README.md | 4 +++-
40+
1 file changed, 3 insertions(+), 1 deletion(-)
41+
42+
diff --git a/README.md b/README.md
43+
index 8f3a780..3043953 100644
44+
--- a/README.md
45+
+++ b/README.md
46+
@@ -1,3 +1,5 @@
47+
# Let's build an RNN
48+
49+
-This repo demonstrates building an RNN using `pytorch`
50+
+This repo demonstrates building an RNN using `pytorch`.
51+
+
52+
+Here is some more readme information.
53+
--
54+
2.45.2
55+

fixtures/a_c.patch

+33
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
From 166848469e0b954c2e14233233f3824a46dcddb8 Mon Sep 17 00:00:00 2001
2+
From: Eric Bower <[email protected]>
3+
Date: Tue, 23 Jul 2024 10:06:00 -0400
4+
Subject: [PATCH] chore: add torch and create random tensor
5+
6+
---
7+
requirements.txt | 1 +
8+
train.py | 3 +++
9+
2 files changed, 4 insertions(+)
10+
create mode 100644 requirements.txt
11+
12+
diff --git a/requirements.txt b/requirements.txt
13+
new file mode 100644
14+
index 0000000..4968a39
15+
--- /dev/null
16+
+++ b/requirements.txt
17+
@@ -0,0 +1 @@
18+
+torch==2.3.1
19+
diff --git a/train.py b/train.py
20+
index 5c027f4..d21dac3 100644
21+
--- a/train.py
22+
+++ b/train.py
23+
@@ -1,2 +1,5 @@
24+
+import torch
25+
+
26+
if __name__ == "__main__":
27+
print("train!")
28+
+ torch.rand(3,6)
29+
30+
base-commit: 59456574a0bfee9f71c91c13046173c820152346
31+
--
32+
2.45.2
33+

fixtures/a_c_added_commit.patch

+80
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,80 @@
1+
From 33c682ac27479f501924cf159d0a75ad91deb589 Mon Sep 17 00:00:00 2001
2+
From: Eric Bower <[email protected]>
3+
Date: Tue, 23 Jul 2024 10:07:57 -0400
4+
Subject: [PATCH 1/3] chore: add torch and create random tensor
5+
6+
---
7+
requirements.txt | 1 +
8+
train.py | 3 +++
9+
2 files changed, 4 insertions(+)
10+
create mode 100644 requirements.txt
11+
12+
diff --git a/requirements.txt b/requirements.txt
13+
new file mode 100644
14+
index 0000000..4968a39
15+
--- /dev/null
16+
+++ b/requirements.txt
17+
@@ -0,0 +1 @@
18+
+torch==2.3.1
19+
diff --git a/train.py b/train.py
20+
index 5c027f4..d21dac3 100644
21+
--- a/train.py
22+
+++ b/train.py
23+
@@ -1,2 +1,5 @@
24+
+import torch
25+
+
26+
if __name__ == "__main__":
27+
print("train!")
28+
+ torch.rand(3,6)
29+
--
30+
2.45.2
31+
32+
33+
From 22dde1259c34a166d5a9335ebe5236e79541cc63 Mon Sep 17 00:00:00 2001
34+
From: Eric Bower <[email protected]>
35+
Date: Tue, 23 Jul 2024 10:14:37 -0400
36+
Subject: [PATCH 2/3] docs: readme
37+
38+
---
39+
README.md | 4 +++-
40+
1 file changed, 3 insertions(+), 1 deletion(-)
41+
42+
diff --git a/README.md b/README.md
43+
index 8f3a780..3043953 100644
44+
--- a/README.md
45+
+++ b/README.md
46+
@@ -1,3 +1,5 @@
47+
# Let's build an RNN
48+
49+
-This repo demonstrates building an RNN using `pytorch`
50+
+This repo demonstrates building an RNN using `pytorch`.
51+
+
52+
+Here is some more readme information.
53+
--
54+
2.45.2
55+
56+
57+
From b248060488df529b850060b3c86417bb87d490cc Mon Sep 17 00:00:00 2001
58+
From: Eric Bower <[email protected]>
59+
Date: Tue, 23 Jul 2024 10:20:44 -0400
60+
Subject: [PATCH 3/3] chore: make tensor 6x6
61+
62+
---
63+
train.py | 4 +++-
64+
1 file changed, 3 insertions(+), 1 deletion(-)
65+
66+
diff --git a/train.py b/train.py
67+
index d21dac3..8cd47e0 100644
68+
--- a/train.py
69+
+++ b/train.py
70+
@@ -2,4 +2,6 @@ import torch
71+
72+
if __name__ == "__main__":
73+
print("train!")
74+
- torch.rand(3,6)
75+
+ # let's create a 6x6 tensor!
76+
+ tensor = torch.rand(6,6)
77+
+ print(tensor)
78+
--
79+
2.45.2
80+

fixtures/a_c_changed_commit.patch

+60
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
From 33c682ac27479f501924cf159d0a75ad91deb589 Mon Sep 17 00:00:00 2001
2+
From: Eric Bower <[email protected]>
3+
Date: Tue, 23 Jul 2024 10:07:57 -0400
4+
Subject: [PATCH 1/2] chore: add torch and create random tensor
5+
6+
---
7+
requirements.txt | 1 +
8+
train.py | 3 +++
9+
2 files changed, 4 insertions(+)
10+
create mode 100644 requirements.txt
11+
12+
diff --git a/requirements.txt b/requirements.txt
13+
new file mode 100644
14+
index 0000000..4968a39
15+
--- /dev/null
16+
+++ b/requirements.txt
17+
@@ -0,0 +1 @@
18+
+torch==2.3.1
19+
diff --git a/train.py b/train.py
20+
index 5c027f4..d21dac3 100644
21+
--- a/train.py
22+
+++ b/train.py
23+
@@ -1,2 +1,5 @@
24+
+import torch
25+
+
26+
if __name__ == "__main__":
27+
print("train!")
28+
+ torch.rand(3,6)
29+
--
30+
2.45.2
31+
32+
33+
From dce20e70280d92aeb88c3d603ad67043ead772fb Mon Sep 17 00:00:00 2001
34+
From: Eric Bower <[email protected]>
35+
Date: Tue, 23 Jul 2024 10:14:37 -0400
36+
Subject: [PATCH 2/2] docs: readme
37+
38+
---
39+
README.md | 9 ++++++++-
40+
1 file changed, 8 insertions(+), 1 deletion(-)
41+
42+
diff --git a/README.md b/README.md
43+
index 8f3a780..ba0293b 100644
44+
--- a/README.md
45+
+++ b/README.md
46+
@@ -1,3 +1,10 @@
47+
# Let's build an RNN
48+
49+
-This repo demonstrates building an RNN using `pytorch`
50+
+This repo demonstrates building an RNN using `pytorch`.
51+
+
52+
+Here is some more readme information.
53+
+
54+
+Here is how to run this project locally:
55+
+
56+
+- install python and pip
57+
+- `pip install -r requirements.txt`
58+
--
59+
2.45.2
60+

fixtures/a_c_reorder.patch

+55
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
From 7dbb94ca1bc8cadf1ce17dacb89172217d88de07 Mon Sep 17 00:00:00 2001
2+
From: Eric Bower <[email protected]>
3+
Date: Tue, 23 Jul 2024 10:15:23 -0400
4+
Subject: [PATCH 1/2] docs: readme
5+
6+
---
7+
README.md | 4 +++-
8+
1 file changed, 3 insertions(+), 1 deletion(-)
9+
10+
diff --git a/README.md b/README.md
11+
index 8f3a780..3043953 100644
12+
--- a/README.md
13+
+++ b/README.md
14+
@@ -1,3 +1,5 @@
15+
# Let's build an RNN
16+
17+
-This repo demonstrates building an RNN using `pytorch`
18+
+This repo demonstrates building an RNN using `pytorch`.
19+
+
20+
+Here is some more readme information.
21+
--
22+
2.45.2
23+
24+
25+
From ad175875e2bf320859554bae73743675cc5ce444 Mon Sep 17 00:00:00 2001
26+
From: Eric Bower <[email protected]>
27+
Date: Tue, 23 Jul 2024 10:06:00 -0400
28+
Subject: [PATCH 2/2] chore: add torch and create random tensor
29+
30+
---
31+
requirements.txt | 1 +
32+
train.py | 3 +++
33+
2 files changed, 4 insertions(+)
34+
create mode 100644 requirements.txt
35+
36+
diff --git a/requirements.txt b/requirements.txt
37+
new file mode 100644
38+
index 0000000..4968a39
39+
--- /dev/null
40+
+++ b/requirements.txt
41+
@@ -0,0 +1 @@
42+
+torch==2.3.1
43+
diff --git a/train.py b/train.py
44+
index 5c027f4..d21dac3 100644
45+
--- a/train.py
46+
+++ b/train.py
47+
@@ -1,2 +1,5 @@
48+
+import torch
49+
+
50+
if __name__ == "__main__":
51+
print("train!")
52+
+ torch.rand(3,6)
53+
--
54+
2.45.2
55+

fixtures/a_c_rm_commit.patch

+23
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
From 7dbb94ca1bc8cadf1ce17dacb89172217d88de07 Mon Sep 17 00:00:00 2001
2+
From: Eric Bower <[email protected]>
3+
Date: Tue, 23 Jul 2024 10:15:23 -0400
4+
Subject: [PATCH] docs: readme
5+
6+
---
7+
README.md | 4 +++-
8+
1 file changed, 3 insertions(+), 1 deletion(-)
9+
10+
diff --git a/README.md b/README.md
11+
index 8f3a780..3043953 100644
12+
--- a/README.md
13+
+++ b/README.md
14+
@@ -1,3 +1,5 @@
15+
# Let's build an RNN
16+
17+
-This repo demonstrates building an RNN using `pytorch`
18+
+This repo demonstrates building an RNN using `pytorch`.
19+
+
20+
+Here is some more readme information.
21+
--
22+
2.45.2
23+

0 commit comments

Comments
 (0)