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