git-pr

created pr with 61.1 on 2025-04-07T23:02:03Z · by 964fa508
added 61.2 on 2025-04-08T15:41:51Z · by c8ef7d19
-: ------- > 1: 941acdf lgtm
1: e32ba93 = 2: 941acdf fix patchset count for specific user
cmds
checkout latest patchset:
ssh pr.pico.sh print 61 | git am -3
checkout any patchset in a patch request:
ssh pr.pico.sh print 61.[rev] | git am -3
add changes to patch request:
git format-patch main --stdout | ssh pr.pico.sh pr add 61

Patchset 61.1 on 2025-04-07T23:02:03Z · commit e32ba93

fix patchset count for specific user
jolheiser 2025-04-07T23:01:41Z
Signed-off-by: jolheiser <git@jolheiser.com>
Semantic diff summary
1 added, 2 modified, 0 signature changed, 0 removed across 2 analyzed files
+11 -0 pr.go #
......@@ -38,6 +38,7 @@ type GitPatchRequest interface {
3838 GetPatchRequestByID(prID int64) (*PatchRequest, error)
3939 GetPatchRequests() ([]*PatchRequest, error)
4040 GetPatchRequestsByRepoID(repoID int64) ([]*PatchRequest, error)
41+ GetPatchRequestsByPubkey(pubkey string) ([]*PatchRequest, error)
4142 GetPatchsetsByPrID(prID int64) ([]*Patchset, error)
4243 GetPatchsetByID(patchsetID int64) (*Patchset, error)
4344 GetLatestPatchsetByPrID(prID int64) (*Patchset, error)
......@@ -271,6 +272,16 @@ func (cmd PrCmd) GetPatchRequestsByRepoID(repoID int64) ([]*PatchRequest, error)
271272 return prs, err
272273 }
273274
275+func (cmd PrCmd) GetPatchRequestsByPubkey(pubkey string) ([]*PatchRequest, error) {
276+ prs := []*PatchRequest{}
277+ err := cmd.Backend.DB.Select(
278+ &prs,
279+ "SELECT pr.* FROM patch_requests pr, app_users au WHERE pr.user_id=au.id AND au.pubkey=? ORDER BY id DESC",
280+ pubkey,
281+ )
282+ return prs, err
283+}
284+
274285 func (cmd PrCmd) GetPatchRequestByID(prID int64) (*PatchRequest, error) {
275286 pr := PatchRequest{}
276287 err := cmd.Backend.DB.Get(
+1 -1 web.go #
......@@ -390,7 +390,7 @@ func userDetailHandler(w http.ResponseWriter, r *http.Request) {
390390 }
391391 isAdmin := web.Backend.IsAdmin(pk)
392392
393- prs, err := web.Pr.GetPatchRequests()
393+ prs, err := web.Pr.GetPatchRequestsByPubkey(user.Pubkey)
394394 if err != nil {
395395 web.Logger.Error("cannot get prs", "err", err)
396396 w.WriteHeader(http.StatusInternalServerError)
Back to top