| 1 | {{ define "page" -}} |
| 2 | <section class="shithub-repo-page"> |
| 3 | {{ template "repo-header" . }} |
| 4 | |
| 5 | <div class="shithub-compare-flow"> |
| 6 | <header class="shithub-compare-subhead"> |
| 7 | <h1>{{ if .HasSelection }}Comparing changes{{ else }}Compare changes{{ end }}</h1> |
| 8 | <p> |
| 9 | {{ if .HasSelection }} |
| 10 | Choose two branches to see what's changed or to start a new pull request. |
| 11 | {{ else }} |
| 12 | Compare changes across branches, commits, tags, and more below. |
| 13 | {{ end }} |
| 14 | </p> |
| 15 | </header> |
| 16 | |
| 17 | <div class="shithub-range-editor" aria-label="Compare branches"> |
| 18 | {{ template "compare-ref-menu" (dict "Menu" .BaseMenu) }} |
| 19 | <span class="shithub-range-separator" aria-hidden="true">...</span> |
| 20 | {{ template "compare-ref-menu" (dict "Menu" .HeadMenu) }} |
| 21 | {{ if .CanOpenPull }} |
| 22 | <a href="{{ .PullNewHref }}" class="shithub-button shithub-button-primary shithub-range-create">Create pull request</a> |
| 23 | {{ else }} |
| 24 | <button type="button" class="shithub-button shithub-button-primary shithub-range-create" disabled>Create pull request</button> |
| 25 | {{ end }} |
| 26 | </div> |
| 27 | |
| 28 | {{ if .NotFound }} |
| 29 | <div class="shithub-compare-flash shithub-compare-flash-danger" role="alert"> |
| 30 | {{ octicon "x-circle" }} |
| 31 | <div> |
| 32 | <strong>There was a problem comparing these refs.</strong> |
| 33 | <p>One or both refs were not found in this repository.</p> |
| 34 | </div> |
| 35 | </div> |
| 36 | {{ else if not .HasSelection }} |
| 37 | <div class="shithub-compare-flash shithub-compare-flash-warning"> |
| 38 | {{ octicon "git-pull-request" }} |
| 39 | <div>Choose different branches or tags above to discuss and review changes.</div> |
| 40 | </div> |
| 41 | <section class="shithub-compare-blankslate"> |
| 42 | {{ octicon "git-pull-request" }} |
| 43 | <h2>Compare and review just about anything</h2> |
| 44 | <p>Branches, tags, commits, and time ranges in the same repository can be compared from here.</p> |
| 45 | {{ if .Examples }} |
| 46 | <div class="shithub-compare-examples"> |
| 47 | <div class="shithub-compare-examples-head">Example comparisons</div> |
| 48 | {{ range .Examples }} |
| 49 | <a href="{{ .Href }}"> |
| 50 | <span>{{ octicon "git-branch" }} {{ .Name }}</span> |
| 51 | <span>compare</span> |
| 52 | </a> |
| 53 | {{ end }} |
| 54 | </div> |
| 55 | {{ end }} |
| 56 | </section> |
| 57 | {{ else if .SameRef }} |
| 58 | <div class="shithub-compare-flash shithub-compare-flash-warning"> |
| 59 | {{ octicon "git-pull-request" }} |
| 60 | <div>Choose different branches or tags above to discuss and review changes.</div> |
| 61 | </div> |
| 62 | <section class="shithub-compare-blankslate"> |
| 63 | {{ octicon "git-pull-request" }} |
| 64 | <h2>Compare and review just about anything</h2> |
| 65 | <p><code>{{ .Base }}</code> and <code>{{ .Head }}</code> are the same ref.</p> |
| 66 | </section> |
| 67 | {{ else if .NoCommits }} |
| 68 | <div class="shithub-compare-flash shithub-compare-flash-warning"> |
| 69 | {{ octicon "check-circle" }} |
| 70 | <div> |
| 71 | <strong>There isn't anything to compare.</strong> |
| 72 | <p><code>{{ .Head }}</code> is up to date with <code>{{ .Base }}</code>.</p> |
| 73 | </div> |
| 74 | </div> |
| 75 | {{ else }} |
| 76 | <div class="shithub-compare-flash shithub-compare-flash-{{ .MergeState.State }}"> |
| 77 | {{ if eq .MergeState.State "clean" }}{{ octicon "check" }}{{ else if eq .MergeState.State "conflict" }}{{ octicon "x-circle" }}{{ else }}{{ octicon "git-pull-request" }}{{ end }} |
| 78 | <div> |
| 79 | <strong>{{ .MergeState.Label }}</strong> |
| 80 | <span>{{ .MergeState.Description }}</span> |
| 81 | </div> |
| 82 | </div> |
| 83 | |
| 84 | <div class="shithub-compare-stats" aria-label="Comparison summary"> |
| 85 | <span>{{ octicon "git-commit" }} {{ .Stats.CommitCount }} {{ pluralize .Stats.CommitCount "commit" "commits" }}</span> |
| 86 | <span>{{ octicon "diff" }} {{ .Stats.FileCount }} {{ pluralize .Stats.FileCount "file changed" "files changed" }}</span> |
| 87 | <span>{{ octicon "person" }} {{ .Stats.ContributorCount }} {{ pluralize .Stats.ContributorCount "contributor" "contributors" }}</span> |
| 88 | </div> |
| 89 | |
| 90 | {{ if .Commits }} |
| 91 | <section class="shithub-compare-commits"> |
| 92 | <h2>Commits on {{ .Head }}</h2> |
| 93 | <ul class="shithub-commits-list"> |
| 94 | {{ range .Commits }} |
| 95 | <li class="shithub-commits-row"> |
| 96 | <div class="shithub-commits-meta"> |
| 97 | <a class="shithub-commits-subject" href="/{{ $.Owner }}/{{ $.Repo.Name }}/commit/{{ .OID }}">{{ .Subject }}</a> |
| 98 | <code class="shithub-commits-sha">{{ .ShortOID }}</code> |
| 99 | <small>{{ .AuthorName }} committed <time datetime="{{ .AuthorWhen.Format "2006-01-02T15:04:05Z" }}">{{ relativeTime .AuthorWhen }}</time></small> |
| 100 | </div> |
| 101 | </li> |
| 102 | {{ end }} |
| 103 | </ul> |
| 104 | </section> |
| 105 | {{ end }} |
| 106 | |
| 107 | {{ if .DiffHTML }} |
| 108 | <section class="shithub-diff-body" aria-label="Diff"> |
| 109 | {{ safeHTML .DiffHTML }} |
| 110 | </section> |
| 111 | {{ end }} |
| 112 | {{ end }} |
| 113 | </div> |
| 114 | </section> |
| 115 | {{- end }} |