git-pr
created pr with
61.1
added 61.2
-: ------- > 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 -3checkout any patchset in a patch request:
ssh pr.pico.sh print 61.[rev] | git am -3add changes to patch request:
git format-patch main --stdout | ssh pr.pico.sh pr add 61
Patchset
61.1
fix patchset count for specific user
jolheiser
2025-04-07T23:01:41ZSigned-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 { | |
| 38 | 38 | GetPatchRequestByID(prID int64) (*PatchRequest, error) | |
| 39 | 39 | GetPatchRequests() ([]*PatchRequest, error) | |
| 40 | 40 | GetPatchRequestsByRepoID(repoID int64) ([]*PatchRequest, error) | |
| 41 | + | GetPatchRequestsByPubkey(pubkey string) ([]*PatchRequest, error) | |
| 41 | 42 | GetPatchsetsByPrID(prID int64) ([]*Patchset, error) | |
| 42 | 43 | GetPatchsetByID(patchsetID int64) (*Patchset, error) | |
| 43 | 44 | GetLatestPatchsetByPrID(prID int64) (*Patchset, error) |
| ... | ... | @@ -271,6 +272,16 @@ func (cmd PrCmd) GetPatchRequestsByRepoID(repoID int64) ([]*PatchRequest, error) | |
| 271 | 272 | return prs, err | |
| 272 | 273 | } | |
| 273 | 274 | ||
| 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 | + | ||
| 274 | 285 | func (cmd PrCmd) GetPatchRequestByID(prID int64) (*PatchRequest, error) { | |
| 275 | 286 | pr := PatchRequest{} | |
| 276 | 287 | err := cmd.Backend.DB.Get( |
+1
-1
web.go
#
| ... | ... | @@ -390,7 +390,7 @@ func userDetailHandler(w http.ResponseWriter, r *http.Request) { | |
| 390 | 390 | } | |
| 391 | 391 | isAdmin := web.Backend.IsAdmin(pk) | |
| 392 | 392 | ||
| 393 | - | prs, err := web.Pr.GetPatchRequests() | |
| 393 | + | prs, err := web.Pr.GetPatchRequestsByPubkey(user.Pubkey) | |
| 394 | 394 | if err != nil { | |
| 395 | 395 | web.Logger.Error("cannot get prs", "err", err) | |
| 396 | 396 | w.WriteHeader(http.StatusInternalServerError) |