vole
Site
Clone
Read only, no credentials:
https://rodent.software/vole.git
Write over SSH with a registered key:
git clone ssh://git@rodent.software/vole.git
Self-hosted forge that lives in your Git repo.
Manage release files from the CLI and browser
c51874492382d08085b6388cea898d0d60ab9375 · Keenan Nemetz · 17d ago · parent 214e7ea6
Manage release files from the CLI and browser Move the attach form to its own page, add move/remove operations to the CLI and browser, and simplify the release detail page to notes, files, and source links.
server/web/releases.go −36
| @@ -42,10 +42,6 @@ func (w *Web) releaseArtifacts(r *http.Request, m *repo.Meta, tag string) []meta | |||
| 42 | 42 | // than making every request late. | |
| 43 | 43 | const archiveConc = 4 | |
| 44 | 44 | ||
| 45 | // maxReleaseCommits bounds the "since the previous release" list. A release a | ||
| 46 | // thousand commits wide is a report, not a page. | ||
| 47 | const maxReleaseCommits = 100 | ||
| 48 | |||
| 49 | 45 | type releasesView struct { | |
| 50 | 46 | Page | |
| 51 | 47 | Name string | |
| @@ -145,28 +141,10 @@ func (w *Web) ReleaseView(rw http.ResponseWriter, r *http.Request) { | |||
| 145 | 141 | w.notFound(rw, r) | |
| 146 | 142 | return | |
| 147 | 143 | } | |
| 148 | // The previous release is the nearest one behind this commit, not the next | ||
| 149 | // row in a list whose order depends on tie-breaking timestamps. | ||
| 150 | prevName := g.PreviousTag(t.Commit) | ||
| 151 | from := "" | ||
| 152 | if prevName != "" { | ||
| 153 | if prev, err := g.Tag(prevName); err == nil { | ||
| 154 | from = prev.Commit | ||
| 155 | } else { | ||
| 156 | prevName = "" | ||
| 157 | } | ||
| 158 | } | ||
| 159 | commits, _ := g.CommitsBetween(from, t.Commit, maxReleaseCommits) | ||
| 160 | count, _ := g.CountBetween(from, t.Commit) | ||
| 161 | |||
| 162 | 144 | // The artifact list is the pointer directory on the metadata branch, not a | |
| 163 | 145 | // stored manifest: the same pointers the sweep marks and the hook validates. | |
| 164 | 146 | // The index holds the same set, read from the branch it was built from. | |
| 165 | 147 | artifacts := w.releaseArtifacts(r, m, t.Name) | |
| 166 | var artifactBytes int64 | ||
| 167 | for _, a := range artifacts { | ||
| 168 | artifactBytes += a.Size | ||
| 169 | } | ||
| 170 | 148 | ||
| 171 | 149 | // git archive copies LFS pointer files verbatim, so a tarball of an LFS | |
| 172 | 150 | // repository holds shopping lists where the reader expects bytes. Saying so is | |
| @@ -190,37 +168,23 @@ func (w *Web) ReleaseView(rw http.ResponseWriter, r *http.Request) { | |||
| 190 | 168 | Name string | |
| 191 | 169 | Tag git.Tag | |
| 192 | 170 | Notes template.HTML | |
| 193 | Prev string | ||
| 194 | Count int | ||
| 195 | Commits []git.Commit | ||
| 196 | Capped bool | ||
| 197 | CappedAt int | ||
| 198 | 171 | LFSPointers bool | |
| 199 | 172 | Artifacts []metadata.Artifact | |
| 200 | ArtifactBytes int64 | ||
| 201 | 173 | Channels []string | |
| 202 | 174 | CanEdit bool | |
| 203 | 175 | CanAttach bool | |
| 204 | 176 | ChannelLocked bool | |
| 205 | UploadCap int64 | ||
| 206 | 177 | }{ | |
| 207 | 178 | Page: w.page(r, m.Name+" · "+t.Name), | |
| 208 | 179 | Name: m.Name, | |
| 209 | 180 | Tag: t, | |
| 210 | 181 | Notes: notes, | |
| 211 | Prev: prevName, | ||
| 212 | Count: count, | ||
| 213 | Commits: commits, | ||
| 214 | Capped: count > len(commits), | ||
| 215 | CappedAt: maxReleaseCommits, | ||
| 216 | 182 | LFSPointers: lfsPointers, | |
| 217 | 183 | Artifacts: artifacts, | |
| 218 | ArtifactBytes: artifactBytes, | ||
| 219 | 184 | Channels: channelNames, | |
| 220 | 185 | CanEdit: canManage && refusal == "", | |
| 221 | 186 | CanAttach: canManage && refusal == "", | |
| 222 | 187 | ChannelLocked: t.Annotated && len(channelNames) > 0, | |
| 223 | UploadCap: w.attachLimit(), | ||
| 224 | 188 | }, 0) | |
| 225 | 189 | } | |
| 226 | 190 | ||