Monorepo for Tangled tangled.org
822
fork

Configure Feed

Select the types of activity you want to include in your feed.

types,appview/pages: pull compose renderer, source enum, step templates

Lewis: May this revision serve well! <lewis@tangled.org>

Lewis d532295e f1041580

+460 -48
+39 -47
appview/pages/pages.go
··· 1260 1260 return p.executePlain("repo/issues/fragments/issueCommentBody", w, params) 1261 1261 } 1262 1262 1263 + type StackedDiff struct { 1264 + Diff *types.NiceDiff 1265 + Opts types.DiffOpts 1266 + } 1267 + 1263 1268 type RepoNewPullParams struct { 1264 - LoggedInUser *oauth.MultiAccountUser 1265 - RepoInfo repoinfo.RepoInfo 1266 - Branches []types.Branch 1267 - Strategy string 1268 - SourceBranch string 1269 - TargetBranch string 1270 - Title string 1271 - Body string 1272 - Active string 1269 + LoggedInUser *oauth.MultiAccountUser 1270 + RepoInfo repoinfo.RepoInfo 1271 + Branches []types.Branch 1272 + SourceBranches []types.Branch 1273 + ForkBranches []types.Branch 1274 + Forks []models.Repo 1275 + Source Source 1276 + SourceBranch string 1277 + TargetBranch string 1278 + Fork string 1279 + Patch string 1280 + Title string 1281 + Body string 1282 + IsStacked bool 1283 + Comparison *types.RepoFormatPatchResponse 1284 + Diff *types.NiceDiff 1285 + DiffOpts types.DiffOpts 1286 + StackedDiffs []StackedDiff 1287 + MergeCheck *types.MergeCheckResponse 1288 + StackTitles map[string]string 1289 + StackBodies map[string]string 1290 + PrefillError string 1291 + Active string 1292 + LabelDefs map[string]*models.LabelDefinition 1293 + LabelState models.LabelState 1294 + StackLabelStates map[string]models.LabelState 1273 1295 } 1274 1296 1275 1297 func (p *Pages) RepoNewPull(w io.Writer, params RepoNewPullParams) error { 1276 1298 params.Active = "pulls" 1277 1299 return p.executeRepo("repo/pulls/new", w, params) 1300 + } 1301 + 1302 + func (p *Pages) PullComposeHostFragment(w io.Writer, params RepoNewPullParams) error { 1303 + return p.executePlain("repo/pulls/fragments/pullComposeHost", w, params) 1304 + } 1305 + 1306 + func (p *Pages) MarkdownPreviewFragment(w io.Writer, body string) error { 1307 + return p.executePlain("fragments/markdownPreview", w, body) 1278 1308 } 1279 1309 1280 1310 type RepoPullsParams struct { ··· 1371 1401 // this name is a mouthful 1372 1402 func (p *Pages) RepoPullInterdiffPage(w io.Writer, params RepoPullInterdiffParams) error { 1373 1403 return p.execute("repo/pulls/interdiff", w, params) 1374 - } 1375 - 1376 - type PullPatchUploadParams struct { 1377 - RepoInfo repoinfo.RepoInfo 1378 - } 1379 - 1380 - func (p *Pages) PullPatchUploadFragment(w io.Writer, params PullPatchUploadParams) error { 1381 - return p.executePlain("repo/pulls/fragments/pullPatchUpload", w, params) 1382 - } 1383 - 1384 - type PullCompareBranchesParams struct { 1385 - RepoInfo repoinfo.RepoInfo 1386 - Branches []types.Branch 1387 - SourceBranch string 1388 - } 1389 - 1390 - func (p *Pages) PullCompareBranchesFragment(w io.Writer, params PullCompareBranchesParams) error { 1391 - return p.executePlain("repo/pulls/fragments/pullCompareBranches", w, params) 1392 - } 1393 - 1394 - type PullCompareForkParams struct { 1395 - RepoInfo repoinfo.RepoInfo 1396 - Forks []models.Repo 1397 - Selected string 1398 - } 1399 - 1400 - func (p *Pages) PullCompareForkFragment(w io.Writer, params PullCompareForkParams) error { 1401 - return p.executePlain("repo/pulls/fragments/pullCompareForks", w, params) 1402 - } 1403 - 1404 - type PullCompareForkBranchesParams struct { 1405 - RepoInfo repoinfo.RepoInfo 1406 - SourceBranches []types.Branch 1407 - TargetBranches []types.Branch 1408 - } 1409 - 1410 - func (p *Pages) PullCompareForkBranchesFragment(w io.Writer, params PullCompareForkBranchesParams) error { 1411 - return p.executePlain("repo/pulls/fragments/pullCompareForksBranches", w, params) 1412 1404 } 1413 1405 1414 1406 type PullResubmitParams struct {
+24
appview/pages/pulls_compose.go
··· 1 + package pages 2 + 3 + import "strings" 4 + 5 + type Source string 6 + 7 + const ( 8 + SourcePatch Source = "patch" 9 + SourceBranch Source = "branch" 10 + SourceFork Source = "fork" 11 + ) 12 + 13 + func ParseSource(s string) (Source, bool) { 14 + switch strings.ToLower(s) { 15 + case string(SourcePatch): 16 + return SourcePatch, true 17 + case string(SourceFork): 18 + return SourceFork, true 19 + case string(SourceBranch): 20 + return SourceBranch, true 21 + default: 22 + return "", false 23 + } 24 + }
+9
appview/pages/templates/fragments/markdownPreview.html
··· 1 + {{ define "fragments/markdownPreview" }} 2 + {{ if . }} 3 + <div class="prose dark:prose-invert max-w-none"> 4 + {{ . | markdown }} 5 + </div> 6 + {{ else }} 7 + <div class="text-gray-400 dark:text-gray-500 italic">Nothing to preview.</div> 8 + {{ end }} 9 + {{ end }}
+74
appview/pages/templates/repo/pulls/fragments/pullComposeHost.html
··· 1 + {{ define "repo/pulls/fragments/pullComposeHost" }} 2 + <div id="pr-compose-host" class="flex flex-col"> 3 + {{ if .PrefillError }} 4 + <div class="mb-4 p-3 border border-red-200 dark:border-red-800 rounded bg-red-50 dark:bg-red-900/30 text-sm text-red-800 dark:text-red-200 flex items-center gap-2"> 5 + {{ i "triangle-alert" "w-4 h-4 flex-shrink-0" }} 6 + <span>{{ .PrefillError }}</span> 7 + </div> 8 + {{ end }} 9 + 10 + {{ $hasCommits := and .Comparison .Comparison.FormatPatch }} 11 + {{ $hasDiff := false }} 12 + {{ if .Diff }}{{ if .Diff.Diff }}{{ $hasDiff = true }}{{ end }}{{ end }} 13 + {{ $showDetails := and (or $hasCommits $hasDiff) (not .IsStacked) }} 14 + 15 + <form 16 + hx-post="/{{ .RepoInfo.FullName }}/pulls/new" 17 + hx-trigger="submit, keydown[(ctrlKey || metaKey) && key=='Enter'] from:(#patch,#title,#body)" 18 + hx-indicator="#create-pull-spinner" 19 + hx-swap="none" 20 + class="flex flex-col gap-6" 21 + > 22 + <section class="relative flex flex-col gap-3"> 23 + <div class="absolute left-3 -translate-x-1/2 top-3 -bottom-6 w-px bg-gray-200 dark:bg-gray-700"></div> 24 + <div class="flex items-center gap-4 relative"> 25 + <div class="flex-shrink-0 relative z-10"> 26 + {{ template "pullComposeSectionNumber" 1 }} 27 + </div> 28 + <h3 class="uppercase text-sm tracking-wide font-bold my-0 dark:text-white">source</h3> 29 + </div> 30 + <div class="ml-10 flex flex-col gap-3"> 31 + {{ template "repo/pulls/fragments/pullStepSource" . }} 32 + </div> 33 + </section> 34 + 35 + <section class="relative flex flex-col gap-3"> 36 + {{ if $showDetails }} 37 + <div class="absolute left-3 -translate-x-1/2 -top-6 -bottom-6 w-px bg-gray-200 dark:bg-gray-700"></div> 38 + {{ else }} 39 + <div class="absolute left-3 -translate-x-1/2 -top-6 -bottom-12 w-px bg-gray-200 dark:bg-gray-700 [mask-image:linear-gradient(to_bottom,black_calc(100%-1.5rem),transparent)]"></div> 40 + {{ end }} 41 + <div class="flex items-center gap-4 relative"> 42 + <div class="flex-shrink-0 relative z-10"> 43 + {{ template "pullComposeSectionNumber" 2 }} 44 + </div> 45 + <h3 class="uppercase text-sm tracking-wide font-bold my-0 dark:text-white">review</h3> 46 + </div> 47 + <div class="ml-10 flex flex-col gap-3"> 48 + {{ template "repo/pulls/fragments/pullStepReview" . }} 49 + </div> 50 + </section> 51 + 52 + {{ if $showDetails }} 53 + <section class="relative flex flex-col gap-3"> 54 + <div class="absolute left-3 -translate-x-1/2 -top-6 -bottom-12 w-px bg-gray-200 dark:bg-gray-700 [mask-image:linear-gradient(to_bottom,black_calc(100%-1.5rem),transparent)]"></div> 55 + <div class="flex items-center gap-4 relative"> 56 + <div class="flex-shrink-0 relative z-10"> 57 + {{ template "pullComposeSectionNumber" 3 }} 58 + </div> 59 + <h3 class="uppercase text-sm tracking-wide font-bold my-0 dark:text-white">details</h3> 60 + </div> 61 + <div class="ml-10 flex flex-col gap-3"> 62 + {{ template "repo/pulls/fragments/pullStepDetails" . }} 63 + </div> 64 + </section> 65 + {{ end }} 66 + </form> 67 + 68 + <div id="pull" class="error dark:text-red-300 mt-4 ml-10"></div> 69 + </div> 70 + {{ end }} 71 + 72 + {{ define "pullComposeSectionNumber" }} 73 + <span class="inline-flex items-center justify-center w-6 h-6 rounded-full bg-gray-200 text-gray-600 dark:bg-gray-700 dark:text-gray-300 text-xs font-bold">{{ . }}</span> 74 + {{ end }}
+146
appview/pages/templates/repo/pulls/fragments/pullStepDetails.html
··· 1 + {{ define "repo/pulls/fragments/pullStepDetails" }} 2 + {{ $hasSidePanel := and .LabelDefs .RepoInfo.Roles.IsPushAllowed }} 3 + {{ $previewUrl := printf "/%s/pulls/new/preview" .RepoInfo.FullName }} 4 + {{ $labelCtx := dict "Defs" .LabelDefs "State" .LabelState "RepoInfo" .RepoInfo "Subject" "" "LoggedInUser" .LoggedInUser }} 5 + 6 + <section class="flex flex-col md:flex-row gap-6"> 7 + <div class="flex-1 min-w-0 flex flex-col gap-4"> 8 + {{ template "pullStepDetailsSingle" (dict "Root" . "PreviewUrl" $previewUrl) }} 9 + {{ template "pullSubmitRow" . }} 10 + </div> 11 + 12 + {{ if $hasSidePanel }} 13 + <aside class="w-full md:w-72 md:flex-shrink-0 flex flex-col gap-6"> 14 + {{ template "editBasicLabels" $labelCtx }} 15 + {{ template "editKvLabels" $labelCtx }} 16 + </aside> 17 + {{ end }} 18 + </section> 19 + 20 + {{ template "markdownEditorScript" }} 21 + {{ end }} 22 + 23 + {{ define "pullStepDetailsSingle" }} 24 + {{ $root := .Root }} 25 + {{ $previewUrl := .PreviewUrl }} 26 + <div class="flex flex-col gap-1"> 27 + <label for="title" class="text-xs uppercase tracking-wide text-gray-800 dark:text-gray-200">title</label> 28 + <input 29 + type="text" 30 + name="title" 31 + id="title" 32 + value="{{ $root.Title }}" 33 + class="w-full dark:bg-gray-700 dark:text-white dark:border-gray-600" 34 + placeholder="One-line summary of your change." 35 + /> 36 + </div> 37 + 38 + {{ template "markdownEditor" (dict 39 + "Id" "pull-body" 40 + "Name" "body" 41 + "Value" $root.Body 42 + "Rows" 6 43 + "Placeholder" "Describe your change. Markdown is supported." 44 + "PreviewUrl" $previewUrl 45 + ) }} 46 + {{ end }} 47 + 48 + {{ define "markdownEditor" }} 49 + {{ $id := .Id }} 50 + {{ $name := .Name }} 51 + {{ $value := .Value }} 52 + {{ $rows := .Rows }} 53 + {{ $placeholder := .Placeholder }} 54 + {{ $previewUrl := .PreviewUrl }} 55 + <div class="flex flex-col gap-2" data-md-editor="{{ $id }}"> 56 + {{ $tabClasses := "group flex items-center gap-2 px-3 py-1 text-sm whitespace-nowrap rounded hover:no-underline data-[active=true]:bg-white data-[active=true]:dark:bg-gray-800 data-[active=true]:shadow-sm data-[active=true]:cursor-default data-[active=false]:hover:text-gray-900 data-[active=false]:dark:hover:text-white" }} 57 + <div class="inline-flex items-center gap-1 p-1 bg-slate-100 dark:bg-gray-900 rounded-md text-gray-600 dark:text-gray-300 self-start"> 58 + <button type="button" data-md-mode="write" 59 + data-active="true" 60 + class="{{ $tabClasses }}"> 61 + {{ i "pencil" "w-3.5 h-3.5 inline group-[.htmx-request]:hidden" }} 62 + Write 63 + </button> 64 + <button type="button" data-md-mode="preview" 65 + data-active="false" 66 + hx-post="{{ $previewUrl }}" 67 + hx-vals='js:{body: document.querySelector("[data-md-editor=\"{{ $id }}\"] textarea").value}' 68 + hx-params="body" 69 + hx-target="[data-md-editor='{{ $id }}'] [data-md-preview]" 70 + hx-swap="innerHTML" 71 + hx-indicator="this" 72 + class="{{ $tabClasses }}"> 73 + {{ i "eye" "w-3.5 h-3.5 inline group-[.htmx-request]:hidden" }} 74 + {{ i "loader-circle" "w-3.5 h-3.5 animate-spin hidden group-[.htmx-request]:inline" }} 75 + Preview 76 + </button> 77 + </div> 78 + <div data-md-panel="write"> 79 + <textarea 80 + id="{{ $id }}" 81 + name="{{ $name }}" 82 + rows="{{ $rows }}" 83 + class="w-full resize-y dark:bg-gray-700 dark:text-white dark:border-gray-600" 84 + placeholder="{{ $placeholder }}" 85 + >{{ $value }}</textarea> 86 + </div> 87 + <div data-md-panel="preview" class="hidden"> 88 + <div data-md-preview class="min-h-[6rem] p-3 border border-gray-200 dark:border-gray-700 rounded bg-gray-50 dark:bg-gray-900/30"> 89 + <span class="text-gray-400 dark:text-gray-500 italic">Loading preview...</span> 90 + </div> 91 + </div> 92 + </div> 93 + {{ end }} 94 + 95 + {{ define "pullSubmitRow" }} 96 + <div class="flex items-center justify-end gap-4 mt-auto"> 97 + {{ if and .MergeCheck .MergeCheck.IsConflicted }} 98 + <div class="flex items-center gap-2 text-sm"> 99 + <span class="inline-flex items-center gap-1 text-red-600 dark:text-red-400"> 100 + {{ i "x" "w-4 h-4" }} 101 + Can't automatically merge 102 + </span> 103 + <span class="text-gray-500 dark:text-gray-400">You can still create the pull request</span> 104 + </div> 105 + {{ else if and .MergeCheck .MergeCheck.Error }} 106 + <div class="flex items-center gap-2 text-sm text-red-600 dark:text-red-400"> 107 + {{ i "triangle-alert" "w-4 h-4" }} 108 + Merge check failed 109 + </div> 110 + {{ end }} 111 + 112 + <button 113 + type="submit" 114 + class="btn-create flex items-center gap-2" 115 + hx-indicator="#create-pull-spinner" 116 + > 117 + {{ i "git-pull-request-create" "w-4 h-4" }} 118 + Create pull request 119 + <span id="create-pull-spinner" class="group"> 120 + {{ i "loader-circle" "w-4 h-4 animate-spin hidden group-[.htmx-request]:inline" }} 121 + </span> 122 + </button> 123 + </div> 124 + {{ end }} 125 + 126 + {{ define "markdownEditorScript" }} 127 + <script> 128 + (() => { 129 + if (window.__mdEditorWired) return; 130 + window.__mdEditorWired = true; 131 + document.body.addEventListener('click', (e) => { 132 + const btn = e.target.closest('[data-md-mode]'); 133 + if (!btn) return; 134 + const editor = btn.closest('[data-md-editor]'); 135 + if (!editor) return; 136 + const mode = btn.dataset.mdMode; 137 + editor.querySelectorAll('[data-md-panel]').forEach(p => { 138 + p.classList.toggle('hidden', p.dataset.mdPanel !== mode); 139 + }); 140 + editor.querySelectorAll('[data-md-mode]').forEach(b => { 141 + b.dataset.active = (b === btn) ? 'true' : 'false'; 142 + }); 143 + }); 144 + })(); 145 + </script> 146 + {{ end }}
+156
appview/pages/templates/repo/pulls/fragments/pullStepSource.html
··· 1 + {{ define "repo/pulls/fragments/pullStepSource" }} 2 + <section class="flex flex-col gap-3"> 3 + <input type="hidden" name="source" value="{{ .Source }}"> 4 + 5 + {{ template "pullSourceTabs" . }} 6 + 7 + {{ if eq .Source "patch" }} 8 + <div class="flex flex-col gap-1"> 9 + {{ template "repo/fragments/labelSectionHeaderText" "Merge into" }} 10 + {{ template "pullTargetBranchSelect" . }} 11 + </div> 12 + {{ template "repo/pulls/fragments/pullPatchUpload" . }} 13 + {{ else }} 14 + <div class="flex flex-col md:flex-row md:flex-wrap gap-3"> 15 + <div class="flex flex-col gap-1"> 16 + {{ template "repo/fragments/labelSectionHeaderText" "Merge into" }} 17 + {{ template "pullTargetBranchSelect" . }} 18 + </div> 19 + <div id="patch-strategy" class="flex flex-col gap-1"> 20 + {{ template "repo/fragments/labelSectionHeaderText" "Pull from" }} 21 + {{ if eq .Source "fork" }} 22 + {{ template "repo/pulls/fragments/pullCompareForks" . }} 23 + {{ else }} 24 + {{ template "repo/pulls/fragments/pullCompareBranches" . }} 25 + {{ end }} 26 + </div> 27 + </div> 28 + {{ end }} 29 + 30 + <div id="patch-error" class="error dark:text-red-300 empty:hidden"></div> 31 + 32 + {{ if ne .Source "patch" }} 33 + <div class="flex items-center gap-2"> 34 + <input type="checkbox" id="mode-stack" name="mode" value="stack" autocomplete="off" {{ if .IsStacked }}checked{{ end }} 35 + hx-post="/{{ .RepoInfo.FullName }}/pulls/new/refresh" 36 + hx-include="closest form" 37 + hx-target="#pr-compose-host" 38 + hx-swap="outerHTML" 39 + hx-trigger="change" 40 + hx-indicator="this" 41 + class="peer"> 42 + <label for="mode-stack" class="my-0 py-0 normal-case font-normal dark:text-white"> 43 + Submit as stacked PRs 44 + </label> 45 + <a 46 + href="https://blog.tangled.org/stacking" 47 + target="_blank" 48 + rel="noopener noreferrer" 49 + aria-label="What are stacked PRs?" 50 + class="text-gray-500 hover:text-gray-900 dark:text-gray-400 dark:hover:text-white peer-[.htmx-request]:hidden" 51 + > 52 + {{ i "circle-question-mark" "size-4" }} 53 + </a> 54 + {{ i "loader-circle" "size-4 animate-spin hidden peer-[.htmx-request]:inline text-gray-500 dark:text-gray-400" }} 55 + </div> 56 + {{ end }} 57 + </section> 58 + {{ end }} 59 + 60 + {{ define "pullTargetBranchSelect" }} 61 + <div class="flex flex-wrap gap-2 items-center"> 62 + <select 63 + id="targetBranch" 64 + name="targetBranch" 65 + required 66 + hx-post="/{{ .RepoInfo.FullName }}/pulls/new/refresh" 67 + hx-include="closest form" 68 + hx-target="#pr-compose-host" 69 + hx-swap="outerHTML" 70 + hx-trigger="change" 71 + hx-indicator="this" 72 + class="peer p-1 border border-gray-200 bg-white dark:bg-gray-700 dark:text-white dark:border-gray-600" 73 + > 74 + <option disabled {{ if not .TargetBranch }}selected{{ end }}>Target branch</option> 75 + {{ $disableSource := and (eq .Source "branch") $.SourceBranch }} 76 + {{ range .Branches }} 77 + {{ $preset := false }} 78 + {{ if $.TargetBranch }} 79 + {{ $preset = eq .Reference.Name $.TargetBranch }} 80 + {{ else }} 81 + {{ $preset = .IsDefault }} 82 + {{ end }} 83 + {{ $isSource := and $disableSource (eq .Reference.Name $.SourceBranch) }} 84 + <option value="{{ .Reference.Name }}" class="py-1" 85 + {{ if $preset }}selected{{ end }} 86 + {{ if $isSource }}disabled{{ end }}> 87 + {{ .Reference.Name }} 88 + {{ if $isSource }}(source){{ end }} 89 + </option> 90 + {{ end }} 91 + </select> 92 + {{ i "loader-circle" "size-4 animate-spin hidden peer-[.htmx-request]:inline text-gray-500 dark:text-gray-400" }} 93 + </div> 94 + {{ end }} 95 + 96 + {{ define "pullSourceTabs" }} 97 + {{ $active := "bg-white dark:bg-gray-800 shadow-sm cursor-default" }} 98 + {{ $inactive := "bg-transparent hover:bg-white/50 dark:hover:bg-gray-800/50" }} 99 + {{ $shared := "group flex-1 p-3 text-left hover:no-underline flex flex-col gap-1 rounded border-0" }} 100 + {{ $titleCls := "font-medium text-sm dark:text-white flex items-center gap-2" }} 101 + {{ $descCls := "text-xs text-gray-500 dark:text-gray-400" }} 102 + {{ $fullName := .RepoInfo.FullName }} 103 + <div class="flex gap-1 p-1 rounded-md bg-slate-100 dark:bg-gray-900" 104 + hx-on::before-request="const t=event.target.closest('button'); if(!t||t.classList.contains('shadow-sm'))return event.preventDefault();"> 105 + {{ if .RepoInfo.Roles.IsPushAllowed }} 106 + <button 107 + type="button" 108 + class="{{ $shared }} {{ if eq .Source "branch" }}{{ $active }}{{ else }}{{ $inactive }}{{ end }}" 109 + hx-post="/{{ $fullName }}/pulls/new/refresh" 110 + hx-vals='{"source": "branch"}' 111 + hx-include="closest form" 112 + hx-target="#pr-compose-host" 113 + hx-swap="outerHTML" 114 + hx-indicator="this" 115 + > 116 + <span class="{{ $titleCls }}"> 117 + Compare branches 118 + {{ i "loader-circle" "size-3 animate-spin hidden group-[.htmx-request]:inline" }} 119 + </span> 120 + <span class="{{ $descCls }}">Select a source branch</span> 121 + </button> 122 + {{ end }} 123 + <button 124 + type="button" 125 + class="{{ $shared }} {{ if eq .Source "fork" }}{{ $active }}{{ else }}{{ $inactive }}{{ end }}" 126 + hx-post="/{{ $fullName }}/pulls/new/refresh" 127 + hx-vals='{"source": "fork"}' 128 + hx-include="closest form" 129 + hx-target="#pr-compose-host" 130 + hx-swap="outerHTML" 131 + hx-indicator="this" 132 + > 133 + <span class="{{ $titleCls }}"> 134 + Compare forks 135 + {{ i "loader-circle" "size-3 animate-spin hidden group-[.htmx-request]:inline" }} 136 + </span> 137 + <span class="{{ $descCls }}">Select a fork and branch as the source</span> 138 + </button> 139 + <button 140 + type="button" 141 + class="{{ $shared }} {{ if eq .Source "patch" }}{{ $active }}{{ else }}{{ $inactive }}{{ end }}" 142 + hx-post="/{{ $fullName }}/pulls/new/refresh" 143 + hx-vals='{"source": "patch"}' 144 + hx-include="closest form" 145 + hx-target="#pr-compose-host" 146 + hx-swap="outerHTML" 147 + hx-indicator="this" 148 + > 149 + <span class="{{ $titleCls }}"> 150 + Paste patch 151 + {{ i "loader-circle" "size-3 animate-spin hidden group-[.htmx-request]:inline" }} 152 + </span> 153 + <span class="{{ $descCls }}">Paste a <code class="font-mono">git diff</code> or <code class="font-mono">git format-patch</code></span> 154 + </button> 155 + </div> 156 + {{ end }}
+4 -1
types/diff.go
··· 8 8 ) 9 9 10 10 type DiffOpts struct { 11 - Split bool `json:"split"` 11 + Split bool `json:"split"` 12 + RefreshUrl string `json:"refresh_url,omitempty"` 13 + Target string `json:"target,omitempty"` 14 + Field string `json:"field,omitempty"` 12 15 } 13 16 14 17 func (d DiffOpts) Encode() string {
+8
types/patch.go
··· 18 18 } 19 19 return "", fmt.Errorf("no change-id found") 20 20 } 21 + 22 + func (f FormatPatch) ChangeIdOrEmpty() string { 23 + id, err := f.ChangeId() 24 + if err != nil { 25 + return "" 26 + } 27 + return id 28 + }