##// END OF EJS Templates
hgweb: add display of bookmarks for changelog and changeset
Alexander Solovyov -
r13596:270f57d3 stable
parent child Browse files
Show More
@@ -205,6 +205,7 b' def changelog(web, req, tmpl, shortlog=F'
205 205 "rev": i,
206 206 "node": hex(n),
207 207 "tags": webutil.nodetagsdict(web.repo, n),
208 "bookmarks": webutil.nodebookmarksdict(web.repo, n),
208 209 "inbranch": webutil.nodeinbranch(web.repo, ctx),
209 210 "branches": webutil.nodebranchdict(web.repo, ctx)
210 211 })
@@ -247,6 +248,8 b' def shortlog(web, req, tmpl):'
247 248 def changeset(web, req, tmpl):
248 249 ctx = webutil.changectx(web.repo, req)
249 250 showtags = webutil.showtag(web.repo, tmpl, 'changesettag', ctx.node())
251 showbookmarks = webutil.showbookmark(web.repo, tmpl, 'changesetbookmark',
252 ctx.node())
250 253 showbranch = webutil.nodebranchnodefault(ctx)
251 254
252 255 files = []
@@ -270,6 +273,7 b' def changeset(web, req, tmpl):'
270 273 parent=webutil.parents(ctx),
271 274 child=webutil.children(ctx),
272 275 changesettag=showtags,
276 changesetbookmark=showbookmarks,
273 277 changesetbranch=showbranch,
274 278 author=ctx.user(),
275 279 desc=ctx.description(),
@@ -277,6 +281,7 b' def changeset(web, req, tmpl):'
277 281 files=files,
278 282 archives=web.archivelist(ctx.hex()),
279 283 tags=webutil.nodetagsdict(web.repo, ctx.node()),
284 bookmarks=webutil.nodebookmarksdict(web.repo, ctx.node()),
280 285 branch=webutil.nodebranchnodefault(ctx),
281 286 inbranch=webutil.nodeinbranch(web.repo, ctx),
282 287 branches=webutil.nodebranchdict(web.repo, ctx))
@@ -721,7 +726,7 b' def graph(web, req, tmpl):'
721 726 user = cgi.escape(templatefilters.person(ctx.user()))
722 727 branch = ctx.branch()
723 728 branch = branch, web.repo.branchtags().get(branch) == ctx.node()
724 data.append((node, vtx, edges, desc, user, age, branch, ctx.tags()))
729 data.append((node, vtx, edges, desc, user, age, branch, ctx.tags(), ctx.bookmarks()))
725 730
726 731 return tmpl('graph', rev=rev, revcount=revcount, uprev=uprev,
727 732 lessvars=lessvars, morevars=morevars, downrev=downrev,
@@ -90,6 +90,9 b' def renamelink(fctx):'
90 90 def nodetagsdict(repo, node):
91 91 return [{"name": i} for i in repo.nodetags(node)]
92 92
93 def nodebookmarksdict(repo, node):
94 return [{"name": i} for i in repo.nodebookmarks(node)]
95
93 96 def nodebranchdict(repo, ctx):
94 97 branches = []
95 98 branch = ctx.branch()
@@ -118,6 +121,10 b' def showtag(repo, tmpl, t1, node=nullid,'
118 121 for t in repo.nodetags(node):
119 122 yield tmpl(t1, tag=t, **args)
120 123
124 def showbookmark(repo, tmpl, t1, node=nullid, **args):
125 for t in repo.nodebookmarks(node):
126 yield tmpl(t1, bookmark=t, **args)
127
121 128 def cleanpath(repo, path):
122 129 path = path.lstrip('/')
123 130 return util.canonpath(repo.root, '', path)
@@ -30,7 +30,7 b''
30 30 <div class="main">
31 31
32 32 <h2><a href="{url}{sessionvars%urlparameter}">{repo|escape}</a></h2>
33 <h3>changeset {rev}:{node|short} {changesetbranch%changelogbranchname} {changesettag}</h3>
33 <h3>changeset {rev}:{node|short} {changesetbranch%changelogbranchname} {changesettag} {changesetbookmark}</h3>
34 34
35 35 <form class="search" action="{url}log">
36 36 {sessionvars%hiddenformentry}
@@ -110,6 +110,12 b' graph.vertex = function(x, y, color, par'
110 110 tagspan += '<span class="tag">' + tag + '</span> ';
111 111 }
112 112 }
113 if (cur[8].length) \{
114 for (var b in cur[8]) \{
115 var bookmark = cur[8][b];
116 tagspan += '<span class="tag">' + bookmark + '</span> ';
117 }
118 }
113 119 tagspan += '</span>';
114 120 }
115 121
@@ -155,6 +155,7 b" branchentry = '"
155 155 </tr>'
156 156 changelogtag = '<span class="tag">{name|escape}</span> '
157 157 changesettag = '<span class="tag">{tag|escape}</span> '
158 changesetbookmark = '<span class="tag">{bookmark|escape}</span> '
158 159 changelogbranchhead = '<span class="branchhead">{name|escape}</span> '
159 160 changelogbranchname = '<span class="branchname">{name|escape}</span> '
160 161
@@ -1,5 +1,5 b''
1 1 <tr class="parity{parity}">
2 2 <td class="age">{age(date)}</td>
3 3 <td class="author">{author|person}</td>
4 <td class="description"><a href="{url}rev/{node|short}{sessionvars%urlparameter}">{desc|strip|firstline|escape|nonempty}</a>{inbranch%changelogbranchname}{branches%changelogbranchhead}{tags % '<span class="tag">{name|escape}</span> '}</td>
4 <td class="description"><a href="{url}rev/{node|short}{sessionvars%urlparameter}">{desc|strip|firstline|escape|nonempty}</a>{inbranch%changelogbranchname}{branches%changelogbranchhead}{tags % '<span class="tag">{name|escape}</span> '}{bookmarks % '<span class="tag">{name|escape}</span> '}</td>
5 5 </tr>
@@ -15,6 +15,7 b' Set up the repo'
15 15 adding da/foo
16 16 adding foo
17 17 $ hg tag 1.0
18 $ hg bookmark something
18 19 $ echo another > foo
19 20 $ hg branch stable
20 21 marked working directory as branch stable
@@ -244,7 +245,7 b' Logs and changes'
244 245 <tr class="parity0">
245 246 <td class="age">1970-01-01</td>
246 247 <td class="author">test</td>
247 <td class="description"><a href="/rev/1d22e65f027e">branch</a><span class="branchhead">stable</span> <span class="tag">tip</span> </td>
248 <td class="description"><a href="/rev/1d22e65f027e">branch</a><span class="branchhead">stable</span> <span class="tag">tip</span> <span class="tag">something</span> </td>
248 249 </tr>
249 250 <tr class="parity1">
250 251 <td class="age">1970-01-01</td>
@@ -314,7 +315,7 b' Logs and changes'
314 315 <div class="main">
315 316
316 317 <h2><a href="/">test</a></h2>
317 <h3>changeset 0:2ef0ac749a14 <span class="tag">1.0</span> </h3>
318 <h3>changeset 0:2ef0ac749a14 <span class="tag">1.0</span> </h3>
318 319
319 320 <form class="search" action="/log">
320 321
@@ -811,7 +812,7 b' Overviews'
811 812 <script>
812 813 <!-- hide script content
813 814
814 var data = [["1d22e65f027e", [0, 1], [[0, 0, 1]], "branch", "test", "1970-01-01", ["stable", true], ["tip"]], ["a4f92ed23982", [0, 1], [[0, 0, 1]], "Added tag 1.0 for changeset 2ef0ac749a14", "test", "1970-01-01", ["default", true], []], ["2ef0ac749a14", [0, 1], [], "base", "test", "1970-01-01", ["default", false], ["1.0"]]];
815 var data = [["1d22e65f027e", [0, 1], [[0, 0, 1]], "branch", "test", "1970-01-01", ["stable", true], ["tip"], ["something"]], ["a4f92ed23982", [0, 1], [[0, 0, 1]], "Added tag 1.0 for changeset 2ef0ac749a14", "test", "1970-01-01", ["default", true], [], []], ["2ef0ac749a14", [0, 1], [], "base", "test", "1970-01-01", ["default", false], ["1.0"], []]];
815 816 var graph = new Graph();
816 817 graph.scale(39);
817 818
@@ -1070,7 +1071,7 b' Graph json escape of multibyte character'
1070 1071
1071 1072 $ "$TESTDIR/get-with-headers.py" 127.0.0.1:$HGPORT '/graph/' \
1072 1073 > | grep '^var data ='
1073 var data = [["40b4d6888e92", [0, 1], [[0, 0, 1]], "\u80fd", "test", "1970-01-01", ["stable", true], ["tip"]], ["1d22e65f027e", [0, 1], [[0, 0, 1]], "branch", "test", "1970-01-01", ["stable", false], []], ["a4f92ed23982", [0, 1], [[0, 0, 1]], "Added tag 1.0 for changeset 2ef0ac749a14", "test", "1970-01-01", ["default", true], []], ["2ef0ac749a14", [0, 1], [], "base", "test", "1970-01-01", ["default", false], ["1.0"]]];
1074 var data = [["40b4d6888e92", [0, 1], [[0, 0, 1]], "\u80fd", "test", "1970-01-01", ["stable", true], ["tip"], ["something"]], ["1d22e65f027e", [0, 1], [[0, 0, 1]], "branch", "test", "1970-01-01", ["stable", false], [], []], ["a4f92ed23982", [0, 1], [[0, 0, 1]], "Added tag 1.0 for changeset 2ef0ac749a14", "test", "1970-01-01", ["default", true], [], []], ["2ef0ac749a14", [0, 1], [], "base", "test", "1970-01-01", ["default", false], ["1.0"], []]];
1074 1075
1075 1076 ERRORS ENCOUNTERED
1076 1077
@@ -61,7 +61,7 b' revision'
61 61 <div class="main">
62 62
63 63 <h2><a href="/">test</a></h2>
64 <h3>changeset 0:0cd96de13884 </h3>
64 <h3>changeset 0:0cd96de13884 </h3>
65 65
66 66 <form class="search" action="/log">
67 67
@@ -286,7 +286,7 b' revision'
286 286 <div class="main">
287 287
288 288 <h2><a href="/">test</a></h2>
289 <h3>changeset 0:0cd96de13884 </h3>
289 <h3>changeset 0:0cd96de13884 </h3>
290 290
291 291 <form class="search" action="/log">
292 292
@@ -289,6 +289,12 b' Some tests for hgweb in an empty reposit'
289 289 tagspan += '<span class="tag">' + tag + '</span> ';
290 290 }
291 291 }
292 if (cur[8].length) {
293 for (var b in cur[8]) {
294 var bookmark = cur[8][b];
295 tagspan += '<span class="tag">' + bookmark + '</span> ';
296 }
297 }
292 298 tagspan += '</span>';
293 299 }
294 300
@@ -56,7 +56,7 b' revision'
56 56 <div class="main">
57 57
58 58 <h2><a href="/">test</a></h2>
59 <h3>changeset 1:c78f6c5cbea9 <span class="tag">tip</span> </h3>
59 <h3>changeset 1:c78f6c5cbea9 <span class="tag">tip</span> </h3>
60 60
61 61 <form class="search" action="/log">
62 62
General Comments 0
You need to be logged in to leave comments. Login now