commit.tpl 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234
  1. {*
  2. * commit.tpl
  3. * gitphp: A PHP git repository browser
  4. * Component: Commit view template
  5. *
  6. * Copyright (C) 2009 Christopher Han <xiphux@gmail.com>
  7. *}
  8. {extends file='projectbase.tpl'}
  9. {block name=main}
  10. <div class="page_nav">
  11. {include file='nav.tpl' logcommit=$commit treecommit=$commit current='commit'}
  12. <br /><br />
  13. </div>
  14. {if $commit->GetParent()}
  15. {include file='title.tpl' titlecommit=$commit target='commitdiff'}
  16. {else}
  17. {include file='title.tpl' titlecommit=$commit titletree=$tree target='tree'}
  18. {/if}
  19. <div class="title_text">
  20. {* Commit data *}
  21. <table>
  22. <tr>
  23. <td>{t}author{/t}</td>
  24. <td>{$commit->GetAuthorName()}</td>
  25. <td></td>
  26. </tr>
  27. <tr>
  28. <td></td>
  29. <td>
  30. <time datetime="{$commit->GetAuthorEpoch()|date_format:"%Y-%m-%dT%H:%M:%S+00:00"}">{$commit->GetAuthorEpoch()|date_format:"%a, %d %b %Y %H:%M:%S %z"}</time>
  31. {assign var=hourlocal value=$commit->GetAuthorLocalEpoch()|date_format:"%H"}
  32. {if $hourlocal < 6}
  33. (<time datetime="{$commit->GetAuthorLocalEpoch()|date_format:"%Y-%m-%dT%H:%M:%S"}{$commit->GetAuthorTimezone(true)}"><span class="latenight">{$commit->GetAuthorLocalEpoch()|date_format:"%R"}</span> {$commit->GetAuthorTimezone()}</time>)
  34. {else}
  35. (<time datetime="{$commit->GetAuthorLocalEpoch()|date_format:"%Y-%m-%dT%H:%M:%S"}{$commit->GetAuthorTimezone(true)}">{$commit->GetAuthorLocalEpoch()|date_format:"%R"} {$commit->GetAuthorTimezone()}</time>)
  36. {/if}
  37. </td>
  38. <td></td>
  39. </tr>
  40. <tr>
  41. <td>{t}committer{/t}</td>
  42. <td>{$commit->GetCommitterName()}</td>
  43. <td></td>
  44. </tr>
  45. <tr>
  46. <td></td>
  47. <td> <time datetime="{$commit->GetCommitterEpoch()|date_format:"%Y-%m-%dT%H:%M:%S+00:00"}">{$commit->GetCommitterEpoch()|date_format:"%a, %d %b %Y %H:%M:%S %z"}</time> (<time datetime="{$commit->GetCommitterLocalEpoch()|date_format:"%Y-%m-%dT%H:%M:%S"}{$commit->GetCommitterTimezone(true)}">{$commit->GetCommitterLocalEpoch()|date_format:"%R"} {$commit->GetCommitterTimezone()}</time>)</td>
  48. <td></td>
  49. </tr>
  50. <tr>
  51. <td>{t}commit{/t}</td>
  52. <td class="monospace">{$commit->GetHash()}</td>
  53. <td></td>
  54. </tr>
  55. <tr>
  56. <td>{t}tree{/t}</td>
  57. <td class="monospace"><a href="{geturl project=$project action=tree hash=$tree hashbase=$commit}" class="list">{$tree->GetHash()}</a></td>
  58. <td class="link"><a href="{geturl project=$project action=tree hash=$tree hashbase=$commit}">{t}tree{/t}</a> | <a href="{geturl project=$project action=snapshot hash=$commit}" class="snapshotTip">{t}snapshot{/t}</a></td>
  59. </tr>
  60. {foreach from=$commit->GetParents() item=par}
  61. <tr>
  62. <td>{t}parent{/t}</td>
  63. <td class="monospace"><a href="{geturl project=$project action=commit hash=$par}" class="list">{$par->GetHash()}</a></td>
  64. <td class="link"><a href="{geturl project=$project action=commit hash=$par}">{t}commit{/t}</a> | <a href="{geturl project=$project action=commitdiff hash=$commit hashparent=$par}">{t}commitdiff{/t}</a></td>
  65. </tr>
  66. {/foreach}
  67. </table>
  68. </div>
  69. <div class="page_body">
  70. {assign var=bugpattern value=$project->GetBugPattern()}
  71. {assign var=bugurl value=$project->GetBugUrl()}
  72. {foreach from=$commit->GetComment() item=line}
  73. {if strncasecmp(trim($line),'Signed-off-by:',14) == 0}
  74. <span class="signedOffBy">{$line|htmlspecialchars|buglink:$bugpattern:$bugurl}</span>
  75. {else}
  76. {$line|htmlspecialchars|buglink:$bugpattern:$bugurl}
  77. {/if}
  78. <br />
  79. {/foreach}
  80. </div>
  81. <div class="list_head">
  82. {if $treediff->Count() > 10}
  83. {t count=$treediff->Count() 1=$treediff->Count() plural="%1 files changed:"}%1 file changed:{/t}
  84. {/if}
  85. </div>
  86. <table>
  87. {* Loop and show files changed *}
  88. {foreach from=$treediff item=diffline}
  89. <tr class="{cycle values="light,dark"}">
  90. {if $diffline->GetStatus() == "A"}
  91. <td>
  92. <a href="{geturl project=$project action=blob hash=$diffline->GetToBlob() hashbase=$commit file=$diffline->GetFromFile()}" class="list">
  93. {$diffline->GetFromFile()}
  94. </a>
  95. </td>
  96. <td>
  97. <span class="newfile">
  98. {localfiletype type=$diffline->GetToFileType() assign=localtotype}
  99. [
  100. {if $diffline->ToFileIsRegular()}
  101. {assign var=tomode value=$diffline->GetToModeShort()}
  102. {t 1=$localtotype 2=$tomode}new %1 with mode %2{/t}
  103. {else}
  104. {t 1=$localtotype}new %1{/t}
  105. {/if}
  106. ]
  107. </span>
  108. </td>
  109. <td class="link">
  110. <a href="{geturl project=$project action=blob hash=$diffline->GetToBlob() hashbase=$commit file=$diffline->GetFromFile()}">{t}blob{/t}</a>
  111. |
  112. <a href="{geturl project=$project action=blob hash=$diffline->GetToBlob() file=$diffline->GetFromFile() output=plain}">{t}plain{/t}</a>
  113. </td>
  114. {elseif $diffline->GetStatus() == "D"}
  115. {assign var=parent value=$commit->GetParent()}
  116. <td>
  117. <a href="{geturl project=$project action=blob hash=$diffline->GetFromBlob() hashbase=$commit file=$diffline->GetFromFile()}" class="list">
  118. {$diffline->GetFromFile()}
  119. </a>
  120. </td>
  121. <td>
  122. <span class="deletedfile">
  123. {localfiletype type=$diffline->GetFromFileType() assign=localfromtype}
  124. [ {t 1=$localfromtype}deleted %1{/t} ]
  125. </span>
  126. </td>
  127. <td class="link">
  128. <a href="{geturl project=$project action=blob hash=$diffline->GetFromBlob() hashbase=$commit file=$diffline->GetFromFile()}">{t}blob{/t}</a>
  129. |
  130. <a href="{geturl project=$project action=history hash=$parent file=$diffline->GetFromFile()}">{t}history{/t}</a>
  131. |
  132. <a href="{geturl project=$project action=blob hash=$diffline->GetFromBlob() file=$diffline->GetFromFile() output=plain}">{t}plain{/t}</a>
  133. </td>
  134. {elseif $diffline->GetStatus() == "M" || $diffline->GetStatus() == "T"}
  135. <td>
  136. {if $diffline->GetToHash() != $diffline->GetFromHash()}
  137. <a href="{geturl project=$project action=blobdiff hash=$diffline->GetToBlob() hashparent=$diffline->GetFromBlob() hashbase=$commit file=$diffline->GetToFile()}" class="list">
  138. {$diffline->GetToFile()}
  139. </a>
  140. {else}
  141. <a href="{geturl project=$project action=blob hash=$diffline->GetToBlob() hashbase=$commit file=$diffline->GetToFile()}" class="list">
  142. {$diffline->GetToFile()}
  143. </a>
  144. {/if}
  145. </td>
  146. <td>
  147. {if $diffline->GetFromMode() != $diffline->GetToMode()}
  148. <span class="changedfile">
  149. [
  150. {if $diffline->FileTypeChanged()}
  151. {localfiletype type=$diffline->GetFromFileType() assign=localfromtype}
  152. {localfiletype type=$diffline->GetToFileType() assign=localtotype}
  153. {if $diffline->FileModeChanged()}
  154. {if $diffline->FromFileIsRegular() && $diffline->ToFileIsRegular()}
  155. {assign var=frommode value=$diffline->GetFromModeShort()}
  156. {assign var=tomode value=$diffline->GetToModeShort()}
  157. {t 1=$localfromtype 2=$localtotype 3=$frommode 4=$tomode}changed from %1 to %2 mode: %3 -> %4{/t}
  158. {elseif $diffline->ToFileIsRegular()}
  159. {assign var=tomode value=$diffline->GetToModeShort()}
  160. {t 1=$localfromtype 2=$localtotype 3=$tomode}changed from %1 to %2 mode: %3{/t}
  161. {else}
  162. {t 1=$localfromtype 2=$localtotype}changed from %1 to %2{/t}
  163. {/if}
  164. {else}
  165. {t 1=$localfromtype 2=$localtotype}changed from %1 to %2{/t}
  166. {/if}
  167. {else}
  168. {if $diffline->FileModeChanged()}
  169. {if $diffline->FromFileIsRegular() && $diffline->ToFileIsRegular()}
  170. {assign var=frommode value=$diffline->GetFromModeShort()}
  171. {assign var=tomode value=$diffline->GetToModeShort()}
  172. {t 1=$frommode 2=$tomode}changed mode: %1 -> %2{/t}
  173. {elseif $diffline->ToFileIsRegular()}
  174. {assign var=tomode value=$diffline->GetToModeShort()}
  175. {t 1=$tomode}changed mode: %1{/t}
  176. {else}
  177. {t}changed{/t}
  178. {/if}
  179. {else}
  180. {t}changed{/t}
  181. {/if}
  182. {/if}
  183. ]
  184. </span>
  185. {/if}
  186. </td>
  187. <td class="link">
  188. <a href="{geturl project=$project action=blob hash=$diffline->GetToBlob() hashbase=$commit file=$diffline->GetToFile()}">{t}blob{/t}</a>
  189. {if $diffline->GetToHash() != $diffline->GetFromHash()}
  190. | <a href="{geturl project=$project action=blobdiff hash=$diffline->GetToBlob() hashparent=$diffline->GetFromBlob() hashbase=$commit file=$diffline->GetToFile()}">{t}diff{/t}</a>
  191. {/if}
  192. | <a href="{geturl project=$project action=history hash=$commit file=$diffline->GetFromFile()}">{t}history{/t}</a>
  193. | <a href="{geturl project=$project action=blob hash=$diffline->GetToBlob() file=$diffline->GetToFile() output=plain}">{t}plain{/t}</a>
  194. </td>
  195. {elseif $diffline->GetStatus() == "R"}
  196. <td>
  197. <a href="{geturl project=$project action=blob hash=$diffline->GetToBlob() hashbase=$commit file=$diffline->GetToFile()}" class="list">
  198. {$diffline->GetToFile()}</a>
  199. </td>
  200. <td>
  201. <span class="movedfile">
  202. {capture assign=fromfilelink}
  203. <a href="{geturl project=$project action=blob hash=$diffline->GetFromBlob() hashbase=$commit file=$diffline->GetFromFile()}" class="list">{$diffline->GetFromFile()}</a>
  204. {/capture}
  205. [
  206. {assign var=similarity value=$diffline->GetSimilarity()}
  207. {if $diffline->GetFromMode() != $diffline->GetToMode()}
  208. {assign var=tomode value=$diffline->GetToModeShort()}
  209. {t escape=no 1=$fromfilelink 2=$similarity 3=$tomode}moved from %1 with %2%% similarity, mode: %3{/t}
  210. {else}
  211. {t escape=no 1=$fromfilelink 2=$similarity}moved from %1 with %2%% similarity{/t}
  212. {/if}
  213. ]
  214. </span>
  215. </td>
  216. <td class="link">
  217. <a href="{geturl project=$project action=blob hash=$diffline->GetToBlob() hashbase=$commit file=$diffline->GetToFile()}">{t}blob{/t}</a>
  218. {if $diffline->GetToHash() != $diffline->GetFromHash()}
  219. | <a href="{geturl project=$project action=blobdiff hash=$diffline->GetToBlob() hashparent=$diffline->GetFromBlob() hashbase=$commit file=$diffline->GetToFile()}">{t}diff{/t}</a>
  220. {/if}
  221. | <a href="{geturl project=$project action=blob hash=$diffline->GetToBlob() file=$diffline->GetToFile() output=plain}">{t}plain{/t}</a>
  222. </td>
  223. {/if}
  224. </tr>
  225. {/foreach}
  226. </table>
  227. {/block}