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
+19 -17
Interdiff #2 #3
appview/db/db.go

This file has not been changed.

appview/db/pulls.go

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

+19 -17
appview/models/pull.go
··· 125 125 // content 126 126 RoundNumber int 127 127 Patch string 128 + Combined string 128 129 Comments []PullComment 129 130 SourceRev string // include the rev that was used to create this submission: only for branch/fork PRs 130 131 ··· 134 135 // content 135 136 RoundNumber int 136 137 Patch string 137 - Combined string 138 138 Comments []PullComment 139 139 SourceRev string // include the rev that was used to create this submission: only for branch/fork PRs 140 140 ··· 151 151 Created time.Time 152 152 } 153 153 154 + func (p *Pull) LastRoundNumber() int { 155 + return len(p.Submissions) - 1 156 + } 157 + 158 + func (p *Pull) LatestSubmission() *PullSubmission { 159 + return p.Submissions[p.LastRoundNumber()] 160 + } 161 + 154 162 func (p *Pull) LatestPatch() string { 155 - latestSubmission := p.Submissions[p.LastRoundNumber()] 156 - return latestSubmission.Patch 163 + return p.LatestSubmission().Patch 157 164 } 158 165 159 166 func (p *Pull) LatestSha() string { 160 - latestSubmission := p.Submissions[p.LastRoundNumber()] 161 - return latestSubmission.SourceRev 167 + return p.LatestSubmission().SourceRev 162 168 } 163 169 164 170 func (p *Pull) PullAt() syntax.ATURI { 165 171 return syntax.ATURI(fmt.Sprintf("at://%s/%s/%s", p.OwnerDid, tangled.RepoPullNSID, p.Rkey)) 166 172 } 167 173 168 - func (p *Pull) LastRoundNumber() int { 169 - return len(p.Submissions) - 1 170 - } 171 - 172 174 func (p *Pull) IsPatchBased() bool { 173 175 return p.PullSource == nil 174 176 } ··· 255 257 return participants 256 258 } 257 259 260 + func (s PullSubmission) CombinedPatch() string { 261 + if s.Combined == "" { 262 + return s.Patch 263 + } 264 + 265 + return s.Combined 266 + } 267 + 258 268 type Stack []*Pull 259 269 260 270 // position of this pull in the stack ··· 262 272 263 273 264 274 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 275 } 274 276 275 277 type Stack []*Pull
appview/pulls/pulls.go

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

appview/repo/repo.go

This file has not been changed.

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
oppi.li submitted #3
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
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