-
- {{ $s := "s" }}
- {{ if eq (len $patches) 1 }}
- {{ $s = "" }}
- {{ end }}
-
- {{ i "chevrons-up-down" "w-4 h-4" }} expand {{ len $patches }} commit{{$s}}
-
-
- {{ i "chevrons-down-up" "w-4 h-4" }} hide {{ len $patches }} commit{{$s}}
-
-
- {{ range $patches }}
-
-
- {{ i "git-commit-horizontal" "w-4 h-4" }}
-
-
- {{ $fullRepo := "" }}
- {{ if and $.Pull.IsForkBased $.Pull.PullSource.Repo }}
- {{ $fullRepo = printf "%s/%s" $owner $.Pull.PullSource.Repo.Name }}
- {{ else if $.Pull.IsBranchBased }}
- {{ $fullRepo = $.RepoInfo.FullName }}
- {{ end }}
-
-
- {{ if $fullRepo }}
-
{{ slice .SHA 0 8 }}
- {{ else }}
-
{{ slice .SHA 0 8 }}
- {{ end }}
-
-
- {{ .Title | description }}
- {{ if gt (len .Body) 0 }}
-
- {{ end }}
-
-
- {{ if gt (len .Body) 0 }}
-
- {{ nl2br .Body }}
-
- {{ end }}
-
- {{ end }}
-
- {{ end }}
-
-
-
- {{ range $cidx, $c := .Comments }}
-
- {{ end }}
+{{ define "submission" }}
+ {{ $item := index . 0 }}
+ {{ $idx := index . 1 }}
+ {{ $lastIdx := index . 2 }}
+ {{ $root := index . 3 }}
+
+ {{ template "submissionHeader" $ }}
+ {{ template "submissionComments" $ }}
+
+ {{ if eq $lastIdx $item.RoundNumber }}
+ {{ block "mergeStatus" $root }} {{ end }}
+ {{ block "resubmitStatus" $root }} {{ end }}
+ {{ end }}
- {{ block "pipelineStatus" (list $ .) }} {{ end }}
+ {{ if $root.LoggedInUser }}
+ {{ template "repo/pulls/fragments/pullActions"
+ (dict
+ "LoggedInUser" $root.LoggedInUser
+ "Pull" $root.Pull
+ "RepoInfo" $root.RepoInfo
+ "RoundNumber" $item.RoundNumber
+ "MergeCheck" $root.MergeCheck
+ "ResubmitCheck" $root.ResubmitCheck
+ "BranchDeleteStatus" $root.BranchDeleteStatus
+ "Stack" $root.Stack) }}
+ {{ else }}
+ {{ template "loginPrompt" $ }}
+ {{ end }}
+
+{{ end }}
- {{ if eq $lastIdx .RoundNumber }}
- {{ block "mergeStatus" $ }} {{ end }}
- {{ block "resubmitStatus" $ }} {{ end }}
+{{ define "submissionHeader" }}
+ {{ $item := index . 0 }}
+ {{ $lastIdx := index . 2 }}
+ {{ $root := index . 3 }}
+ {{ $round := $item.RoundNumber }}
+
+
+
+

+
+
+
+ {{ template "submissionInfo" $ }}
+ {{ template "submissionCommits" $ }}
+ {{ template "submissionPipeline" $ }}
+ {{ if eq $lastIdx $round }}
+ {{ block "mergeCheck" $root }} {{ end }}
+ {{ end }}
+
+
+{{ end }}
+
+{{ define "submissionInfo" }}
+ {{ $item := index . 0 }}
+ {{ $idx := index . 1 }}
+ {{ $root := index . 3 }}
+ {{ $round := $item.RoundNumber }}
+
+{{ end }}
+
+{{ define "submissionCommits" }}
+ {{ $item := index . 0 }}
+ {{ $root := index . 3 }}
+ {{ $round := $item.RoundNumber }}
+ {{ $patches := $item.AsFormatPatch }}
+ {{ if $patches }}
+
+
+ {{ i "git-commit-horizontal" "w-4 h-4" }}
+ {{ len $patches }} commit{{ if ne (len $patches) 1 }}s{{ end }}
+
+ expand
+ collapse
+
+
+ {{ range $patches }}
+ {{ template "submissionCommit" (list . $item $root) }}
+ {{ end }}
+
+ {{ end }}
+{{ end }}
+
+{{ define "submissionCommit" }}
+ {{ $patch := index . 0 }}
+ {{ $item := index . 1 }}
+ {{ $root := index . 2 }}
+ {{ $round := $item.RoundNumber }}
+ {{ with $patch }}
+
+
+
+
+ {{ $fullRepo := "" }}
+ {{ if and $root.Pull.IsForkBased $root.Pull.PullSource.Repo }}
+ {{ $fullRepo = printf "%s/%s" $root.Pull.OwnerDid $root.Pull.PullSource.Repo.Name }}
+ {{ else if $root.Pull.IsBranchBased }}
+ {{ $fullRepo = $root.RepoInfo.FullName }}
{{ end }}
- {{ if $.LoggedInUser }}
- {{ template "repo/pulls/fragments/pullActions"
- (dict
- "LoggedInUser" $.LoggedInUser
- "Pull" $.Pull
- "RepoInfo" $.RepoInfo
- "RoundNumber" .RoundNumber
- "MergeCheck" $.MergeCheck
- "ResubmitCheck" $.ResubmitCheck
- "BranchDeleteStatus" $.BranchDeleteStatus
- "Stack" $.Stack) }}
+
+ {{ if $fullRepo }}
+
{{ slice .SHA 0 8 }}
{{ else }}
-
+
{{ slice .SHA 0 8 }}
+ {{ end }}
+
+
+
+
{{ .Title | description }}
+ {{ if gt (len .Body) 0 }}
+
+ {{ end }}
+ {{ if gt (len .Body) 0 }}
+
{{ nl2br .Body }}
{{ end }}
+
+
+ {{ end }}
+{{ end }}
+
+{{ define "mergeCheck" }}
+ {{ $isOpen := .Pull.State.IsOpen }}
+ {{ if and $isOpen .MergeCheck .MergeCheck.Error }}
+
+ {{ i "triangle-alert" "w-4 h-4 text-red-600 dark:text-red-500" }}
+ {{ .MergeCheck.Error }}
+
+ {{ else if and $isOpen .MergeCheck .MergeCheck.IsConflicted }}
+
+
+
+ {{ i "triangle-alert" "text-red-600 dark:text-red-500 w-4 h-4" }}
+
merge conflicts detected
+
+ expand
+ collapse
+
+
+
+ {{ if gt (len .MergeCheck.Conflicts) 0 }}
+
+ {{ range .MergeCheck.Conflicts }}
+ {{ if .Filename }}
+ -
+ {{ i "file-warning" "inline-flex w-4 h-4 mr-1.5 text-red-600 dark:text-red-500 flex-shrink-0" }}
+ {{ .Filename }}
+
+ {{ else if .Reason }}
+ -
+ {{ i "file-warning" "w-4 h-4 mr-1.5 text-red-600 dark:text-red-500 " }}
+ {{.Reason}}
+
+ {{ end }}
+ {{ end }}
+
+ {{ end }}
- {{ end }}
+ {{ else if and $isOpen .MergeCheck }}
+
+ {{ i "check" "w-4 h-4 text-green-600 dark:text-green-500" }}
+ no conflicts, ready to merge
+
{{ end }}
{{ end }}
{{ define "mergeStatus" }}
{{ if .Pull.State.IsClosed }}
-
+
{{ i "ban" "w-4 h-4" }}
closed without merging
{{ else if .Pull.State.IsMerged }}
-
+
{{ i "git-merge" "w-4 h-4" }}
pull request successfully merged
{{ else if .Pull.State.IsDeleted }}
-
+
{{ i "git-pull-request-closed" "w-4 h-4" }}
This pull has been deleted (possibly by jj abandon or jj squash)
- {{ else if and .MergeCheck .MergeCheck.Error }}
-
-
- {{ i "triangle-alert" "w-4 h-4" }}
- {{ .MergeCheck.Error }}
-
-
- {{ else if and .MergeCheck .MergeCheck.IsConflicted }}
-
-
-
- {{ i "triangle-alert" "w-4 h-4" }}
- merge conflicts detected
-
- {{ if gt (len .MergeCheck.Conflicts) 0 }}
-
- {{ range .MergeCheck.Conflicts }}
- {{ if .Filename }}
- -
- {{ i "file-warning" "w-4 h-4 mr-1.5 text-red-500 dark:text-red-300" }}
- {{ .Filename }}
-
- {{ else if .Reason }}
- -
- {{ i "file-warning" "w-4 h-4 mr-1.5 text-red-500 dark:text-red-300" }}
- {{.Reason}}
-
- {{ end }}
- {{ end }}
-
- {{ end }}
-
-
- {{ else if .MergeCheck }}
-
-
- {{ i "circle-check-big" "w-4 h-4" }}
- no conflicts, ready to merge
-
-
{{ end }}
{{ end }}
{{ define "resubmitStatus" }}
{{ if .ResubmitCheck.Yes }}
-
+
{{ i "triangle-alert" "w-4 h-4" }}
this branch has been updated, consider resubmitting
@@ -292,37 +451,94 @@
{{ end }}
{{ end }}
-{{ define "pipelineStatus" }}
- {{ $root := index . 0 }}
- {{ $submission := index . 1 }}
- {{ $pipeline := index $root.Pipelines $submission.SourceRev }}
+{{ define "submissionPipeline" }}
+ {{ $item := index . 0 }}
+ {{ $root := index . 3 }}
+ {{ $pipeline := index $root.Pipelines $item.SourceRev }}
{{ with $pipeline }}
{{ $id := .Id }}
{{ if .Statuses }}
-