Monorepo for Tangled tangled.org

appview,knotserver: produce combined patch in comparisons #609

merged opened by oppi.li targeting master from push-tvqsxkkxqolv

this is calculated by the knotserver in sh.tangled.repo.compare and cached by the appview in pull submissions, this cannot be calculated on the appview side with just the format-patch because this calculation requires a git-index.

Signed-off-by: oppiliappan me@oppi.li

Labels
bugfix
assignee

None yet.

Participants 1
AT URI
at://did:plc:qfpnj4og54vl56wngdriaxug/sh.tangled.repo.pull/3lzswvlrm7m22
+24 -24
Interdiff #0 #1
+9 -9
appview/db/db.go
··· 954 954 return err 955 955 }) 956 956 957 - // knots may report the combined patch for a comparison, we can store that on the appview side 958 - // (but not on the pds record), because calculating the combined patch requires a git index 959 - runMigration(conn, "add-combined-column-submissions", func(tx *sql.Tx) error { 960 - _, err := tx.Exec(` 961 - alter table pull_submissions add column combined text; 962 - `) 963 - return err 964 - }) 965 - 966 957 return &DB{db}, nil 967 958 } 968 959 ··· 1102 1093 1103 1094 }) 1104 1095 conn.ExecContext(ctx, "pragma foreign_keys = on;") 1096 + 1097 + // knots may report the combined patch for a comparison, we can store that on the appview side 1098 + // (but not on the pds record), because calculating the combined patch requires a git index 1099 + runMigration(conn, "add-combined-column-submissions", func(tx *sql.Tx) error { 1100 + _, err := tx.Exec(` 1101 + alter table pull_submissions add column combined text; 1102 + `) 1103 + return err 1104 + }) 1105 1105 1106 1106 return &DB{db}, nil 1107 1107 }
appview/db/pulls.go

This patch was likely rebased, as context lines do not match.

+8 -8
appview/models/pull.go
··· 222 222 return patches 223 223 } 224 224 225 - func (s PullSubmission) CombinedPatch() string { 226 - if s.Combined == "" { 227 - return s.Patch 228 - } 229 - 230 - return s.Combined 231 - } 232 - 233 225 type Stack []*Pull 234 226 235 227 // position of this pull in the stack ··· 270 262 271 263 272 264 return participants 265 + } 266 + 267 + func (s PullSubmission) CombinedPatch() string { 268 + if s.Combined == "" { 269 + return s.Patch 270 + } 271 + 272 + return s.Combined 273 273 } 274 274 275 275 type Stack []*Pull
appview/pulls/pulls.go

This patch was likely rebased, as context lines do not match.

+7 -7
appview/repo/repo.go
··· 2503 2503 return 2504 2504 } 2505 2505 2506 - var diff types.NiceDiff 2507 - if formatPatch.CombinedPatchRaw != "" { 2508 - diff = patchutil.AsNiceDiff(formatPatch.CombinedPatchRaw, base) 2509 - } else { 2510 - diff = patchutil.AsNiceDiff(formatPatch.FormatPatchRaw, base) 2511 - } 2506 + diff := patchutil.AsNiceDiff(formatPatch.Patch, base) 2512 2507 2513 2508 repoinfo := f.RepoInfo(user) 2514 2509 ··· 2532 2527 return 2533 2528 } 2534 2529 2535 - diff := patchutil.AsNiceDiff(formatPatch.Patch, base) 2530 + var diff types.NiceDiff 2531 + if formatPatch.CombinedPatchRaw != "" { 2532 + diff = patchutil.AsNiceDiff(formatPatch.CombinedPatchRaw, base) 2533 + } else { 2534 + diff = patchutil.AsNiceDiff(formatPatch.FormatPatchRaw, base) 2535 + } 2536 2536 2537 2537 repoinfo := f.RepoInfo(user) 2538 2538
knotserver/xrpc/repo_compare.go

This file has not been changed.

types/repo.go

This file has not been changed.

History

4 rounds 0 comments
sign up or login to add to the discussion
1 commit
expand
appview,knotserver: produce combined patch in comparisons
3/3 success
expand
expand 0 comments
pull request successfully merged
1 commit
expand
appview,knotserver: produce combined patch in comparisons
3/3 success
expand
expand 0 comments
oppi.li submitted #1
1 commit
expand
appview,knotserver: produce combined patch in comparisons
3/3 success
expand
expand 0 comments
oppi.li submitted #0
1 commit
expand
appview,knotserver: produce combined patch in comparisons
expand 0 comments