##// END OF EJS Templates
template: add showbranch template for {branch}...
Eric Eisner -
r13156:d79fdff5 default
parent child Browse files
Show More
@@ -1,269 +1,273
1 1 # templatekw.py - common changeset template keywords
2 2 #
3 3 # Copyright 2005-2009 Matt Mackall <mpm@selenic.com>
4 4 #
5 5 # This software may be used and distributed according to the terms of the
6 6 # GNU General Public License version 2 or any later version.
7 7
8 8 from node import hex
9 9 import encoding, patch, util, error
10 10
11 11 def showlist(name, values, plural=None, **args):
12 12 '''expand set of values.
13 13 name is name of key in template map.
14 14 values is list of strings or dicts.
15 15 plural is plural of name, if not simply name + 's'.
16 16
17 17 expansion works like this, given name 'foo'.
18 18
19 19 if values is empty, expand 'no_foos'.
20 20
21 21 if 'foo' not in template map, return values as a string,
22 22 joined by space.
23 23
24 24 expand 'start_foos'.
25 25
26 26 for each value, expand 'foo'. if 'last_foo' in template
27 27 map, expand it instead of 'foo' for last key.
28 28
29 29 expand 'end_foos'.
30 30 '''
31 31 templ = args['templ']
32 32 if plural:
33 33 names = plural
34 34 else: names = name + 's'
35 35 if not values:
36 36 noname = 'no_' + names
37 37 if noname in templ:
38 38 yield templ(noname, **args)
39 39 return
40 40 if name not in templ:
41 41 if isinstance(values[0], str):
42 42 yield ' '.join(values)
43 43 else:
44 44 for v in values:
45 45 yield dict(v, **args)
46 46 return
47 47 startname = 'start_' + names
48 48 if startname in templ:
49 49 yield templ(startname, **args)
50 50 vargs = args.copy()
51 51 def one(v, tag=name):
52 52 try:
53 53 vargs.update(v)
54 54 except (AttributeError, ValueError):
55 55 try:
56 56 for a, b in v:
57 57 vargs[a] = b
58 58 except ValueError:
59 59 vargs[name] = v
60 60 return templ(tag, **vargs)
61 61 lastname = 'last_' + name
62 62 if lastname in templ:
63 63 last = values.pop()
64 64 else:
65 65 last = None
66 66 for v in values:
67 67 yield one(v)
68 68 if last is not None:
69 69 yield one(last, tag=lastname)
70 70 endname = 'end_' + names
71 71 if endname in templ:
72 72 yield templ(endname, **args)
73 73
74 74 def getfiles(repo, ctx, revcache):
75 75 if 'files' not in revcache:
76 76 revcache['files'] = repo.status(ctx.parents()[0].node(),
77 77 ctx.node())[:3]
78 78 return revcache['files']
79 79
80 80 def getlatesttags(repo, ctx, cache):
81 81 '''return date, distance and name for the latest tag of rev'''
82 82
83 83 if 'latesttags' not in cache:
84 84 # Cache mapping from rev to a tuple with tag date, tag
85 85 # distance and tag name
86 86 cache['latesttags'] = {-1: (0, 0, 'null')}
87 87 latesttags = cache['latesttags']
88 88
89 89 rev = ctx.rev()
90 90 todo = [rev]
91 91 while todo:
92 92 rev = todo.pop()
93 93 if rev in latesttags:
94 94 continue
95 95 ctx = repo[rev]
96 96 tags = [t for t in ctx.tags() if repo.tagtype(t) == 'global']
97 97 if tags:
98 98 latesttags[rev] = ctx.date()[0], 0, ':'.join(sorted(tags))
99 99 continue
100 100 try:
101 101 # The tuples are laid out so the right one can be found by
102 102 # comparison.
103 103 pdate, pdist, ptag = max(
104 104 latesttags[p.rev()] for p in ctx.parents())
105 105 except KeyError:
106 106 # Cache miss - recurse
107 107 todo.append(rev)
108 108 todo.extend(p.rev() for p in ctx.parents())
109 109 continue
110 110 latesttags[rev] = pdate, pdist + 1, ptag
111 111 return latesttags[rev]
112 112
113 113 def getrenamedfn(repo, endrev=None):
114 114 rcache = {}
115 115 if endrev is None:
116 116 endrev = len(repo)
117 117
118 118 def getrenamed(fn, rev):
119 119 '''looks up all renames for a file (up to endrev) the first
120 120 time the file is given. It indexes on the changerev and only
121 121 parses the manifest if linkrev != changerev.
122 122 Returns rename info for fn at changerev rev.'''
123 123 if fn not in rcache:
124 124 rcache[fn] = {}
125 125 fl = repo.file(fn)
126 126 for i in fl:
127 127 lr = fl.linkrev(i)
128 128 renamed = fl.renamed(fl.node(i))
129 129 rcache[fn][lr] = renamed
130 130 if lr >= endrev:
131 131 break
132 132 if rev in rcache[fn]:
133 133 return rcache[fn][rev]
134 134
135 135 # If linkrev != rev (i.e. rev not found in rcache) fallback to
136 136 # filectx logic.
137 137 try:
138 138 return repo[rev][fn].renamed()
139 139 except error.LookupError:
140 140 return None
141 141
142 142 return getrenamed
143 143
144 144
145 145 def showauthor(repo, ctx, templ, **args):
146 146 return ctx.user()
147 147
148 def showbranch(**args):
149 return args['ctx'].branch()
150
148 151 def showbranches(**args):
149 152 branch = args['ctx'].branch()
150 153 if branch != 'default':
151 154 return showlist('branch', [branch], plural='branches', **args)
152 155
153 156 def showchildren(**args):
154 157 ctx = args['ctx']
155 158 childrevs = ['%d:%s' % (cctx, cctx) for cctx in ctx.children()]
156 159 return showlist('children', childrevs, **args)
157 160
158 161 def showdate(repo, ctx, templ, **args):
159 162 return ctx.date()
160 163
161 164 def showdescription(repo, ctx, templ, **args):
162 165 return ctx.description().strip()
163 166
164 167 def showdiffstat(repo, ctx, templ, **args):
165 168 files, adds, removes = 0, 0, 0
166 169 for i in patch.diffstatdata(util.iterlines(ctx.diff())):
167 170 files += 1
168 171 adds += i[1]
169 172 removes += i[2]
170 173 return '%s: +%s/-%s' % (files, adds, removes)
171 174
172 175 def showextras(**args):
173 176 templ = args['templ']
174 177 for key, value in sorted(args['ctx'].extra().items()):
175 178 args = args.copy()
176 179 args.update(dict(key=key, value=value))
177 180 yield templ('extra', **args)
178 181
179 182 def showfileadds(**args):
180 183 repo, ctx, revcache = args['repo'], args['ctx'], args['revcache']
181 184 return showlist('file_add', getfiles(repo, ctx, revcache)[1], **args)
182 185
183 186 def showfilecopies(**args):
184 187 cache, ctx = args['cache'], args['ctx']
185 188 copies = args['revcache'].get('copies')
186 189 if copies is None:
187 190 if 'getrenamed' not in cache:
188 191 cache['getrenamed'] = getrenamedfn(args['repo'])
189 192 copies = []
190 193 getrenamed = cache['getrenamed']
191 194 for fn in ctx.files():
192 195 rename = getrenamed(fn, ctx.rev())
193 196 if rename:
194 197 copies.append((fn, rename[0]))
195 198
196 199 c = [{'name': x[0], 'source': x[1]} for x in copies]
197 200 return showlist('file_copy', c, plural='file_copies', **args)
198 201
199 202 # showfilecopiesswitch() displays file copies only if copy records are
200 203 # provided before calling the templater, usually with a --copies
201 204 # command line switch.
202 205 def showfilecopiesswitch(**args):
203 206 copies = args['revcache'].get('copies') or []
204 207 c = [{'name': x[0], 'source': x[1]} for x in copies]
205 208 return showlist('file_copy', c, plural='file_copies', **args)
206 209
207 210 def showfiledels(**args):
208 211 repo, ctx, revcache = args['repo'], args['ctx'], args['revcache']
209 212 return showlist('file_del', getfiles(repo, ctx, revcache)[2], **args)
210 213
211 214 def showfilemods(**args):
212 215 repo, ctx, revcache = args['repo'], args['ctx'], args['revcache']
213 216 return showlist('file_mod', getfiles(repo, ctx, revcache)[0], **args)
214 217
215 218 def showfiles(**args):
216 219 return showlist('file', args['ctx'].files(), **args)
217 220
218 221 def showlatesttag(repo, ctx, templ, cache, **args):
219 222 return getlatesttags(repo, ctx, cache)[2]
220 223
221 224 def showlatesttagdistance(repo, ctx, templ, cache, **args):
222 225 return getlatesttags(repo, ctx, cache)[1]
223 226
224 227 def showmanifest(**args):
225 228 repo, ctx, templ = args['repo'], args['ctx'], args['templ']
226 229 args = args.copy()
227 230 args.update(dict(rev=repo.manifest.rev(ctx.changeset()[0]),
228 231 node=hex(ctx.changeset()[0])))
229 232 return templ('manifest', **args)
230 233
231 234 def shownode(repo, ctx, templ, **args):
232 235 return ctx.hex()
233 236
234 237 def showrev(repo, ctx, templ, **args):
235 238 return ctx.rev()
236 239
237 240 def showtags(**args):
238 241 return showlist('tag', args['ctx'].tags(), **args)
239 242
240 243 # keywords are callables like:
241 244 # fn(repo, ctx, templ, cache, revcache, **args)
242 245 # with:
243 246 # repo - current repository instance
244 247 # ctx - the changectx being displayed
245 248 # templ - the templater instance
246 249 # cache - a cache dictionary for the whole templater run
247 250 # revcache - a cache dictionary for the current revision
248 251 keywords = {
249 252 'author': showauthor,
253 'branch': showbranch,
250 254 'branches': showbranches,
251 255 'children': showchildren,
252 256 'date': showdate,
253 257 'desc': showdescription,
254 258 'diffstat': showdiffstat,
255 259 'extras': showextras,
256 260 'file_adds': showfileadds,
257 261 'file_copies': showfilecopies,
258 262 'file_copies_switch': showfilecopiesswitch,
259 263 'file_dels': showfiledels,
260 264 'file_mods': showfilemods,
261 265 'files': showfiles,
262 266 'latesttag': showlatesttag,
263 267 'latesttagdistance': showlatesttagdistance,
264 268 'manifest': showmanifest,
265 269 'node': shownode,
266 270 'rev': showrev,
267 271 'tags': showtags,
268 272 }
269 273
@@ -1,1333 +1,1360
1 1 $ hg init a
2 2 $ cd a
3 3 $ echo a > a
4 4 $ hg add a
5 5 $ echo line 1 > b
6 6 $ echo line 2 >> b
7 7 $ hg commit -l b -d '1000000 0' -u 'User Name <user@hostname>'
8 8
9 9 $ hg add b
10 10 $ echo other 1 > c
11 11 $ echo other 2 >> c
12 12 $ echo >> c
13 13 $ echo other 3 >> c
14 14 $ hg commit -l c -d '1100000 0' -u 'A. N. Other <other@place>'
15 15
16 16 $ hg add c
17 17 $ hg commit -m 'no person' -d '1200000 0' -u 'other@place'
18 18 $ echo c >> c
19 19 $ hg commit -m 'no user, no domain' -d '1300000 0' -u 'person'
20 20
21 21 $ echo foo > .hg/branch
22 22 $ hg commit -m 'new branch' -d '1400000 0' -u 'person'
23 23
24 24 $ hg co -q 3
25 25 $ echo other 4 >> d
26 26 $ hg add d
27 27 $ hg commit -m 'new head' -d '1500000 0' -u 'person'
28 28
29 29 $ hg merge -q foo
30 30 $ hg commit -m 'merge' -d '1500001 0' -u 'person'
31 31
32 32 Second branch starting at nullrev:
33 33
34 34 $ hg update null
35 35 0 files updated, 0 files merged, 4 files removed, 0 files unresolved
36 36 $ echo second > second
37 37 $ hg add second
38 38 $ hg commit -m second -d '1000000 0' -u 'User Name <user@hostname>'
39 39 created new head
40 40
41 41 $ echo third > third
42 42 $ hg add third
43 43 $ hg mv second fourth
44 44 $ hg commit -m third -d "2020-01-01 10:01"
45 45
46 46 Make sure user/global hgrc does not affect tests
47 47
48 48 $ echo '[ui]' > .hg/hgrc
49 49 $ echo 'logtemplate =' >> .hg/hgrc
50 50 $ echo 'style =' >> .hg/hgrc
51 51
52 52 Default style is like normal output:
53 53
54 54 $ hg log > log.out
55 55 $ hg log --style default > style.out
56 56 $ cmp log.out style.out || diff -u log.out style.out
57 57
58 58 $ hg log -v > log.out
59 59 $ hg log -v --style default > style.out
60 60 $ cmp log.out style.out || diff -u log.out style.out
61 61
62 62 $ hg log --debug > log.out
63 63 $ hg log --debug --style default > style.out
64 64 $ cmp log.out style.out || diff -u log.out style.out
65 65
66 66 Revision with no copies (used to print a traceback):
67 67
68 68 $ hg tip -v --template '\n'
69 69
70 70
71 71 Compact style works:
72 72
73 73 $ hg log --style compact
74 74 8[tip] 95c24699272e 2020-01-01 10:01 +0000 test
75 75 third
76 76
77 77 7:-1 29114dbae42b 1970-01-12 13:46 +0000 user
78 78 second
79 79
80 80 6:5,4 c7b487c6c50e 1970-01-18 08:40 +0000 person
81 81 merge
82 82
83 83 5:3 13207e5a10d9 1970-01-18 08:40 +0000 person
84 84 new head
85 85
86 86 4 32a18f097fcc 1970-01-17 04:53 +0000 person
87 87 new branch
88 88
89 89 3 10e46f2dcbf4 1970-01-16 01:06 +0000 person
90 90 no user, no domain
91 91
92 92 2 97054abb4ab8 1970-01-14 21:20 +0000 other
93 93 no person
94 94
95 95 1 b608e9d1a3f0 1970-01-13 17:33 +0000 other
96 96 other 1
97 97
98 98 0 1e4e1b8f71e0 1970-01-12 13:46 +0000 user
99 99 line 1
100 100
101 101
102 102 $ hg log -v --style compact
103 103 8[tip] 95c24699272e 2020-01-01 10:01 +0000 test
104 104 third
105 105
106 106 7:-1 29114dbae42b 1970-01-12 13:46 +0000 User Name <user@hostname>
107 107 second
108 108
109 109 6:5,4 c7b487c6c50e 1970-01-18 08:40 +0000 person
110 110 merge
111 111
112 112 5:3 13207e5a10d9 1970-01-18 08:40 +0000 person
113 113 new head
114 114
115 115 4 32a18f097fcc 1970-01-17 04:53 +0000 person
116 116 new branch
117 117
118 118 3 10e46f2dcbf4 1970-01-16 01:06 +0000 person
119 119 no user, no domain
120 120
121 121 2 97054abb4ab8 1970-01-14 21:20 +0000 other@place
122 122 no person
123 123
124 124 1 b608e9d1a3f0 1970-01-13 17:33 +0000 A. N. Other <other@place>
125 125 other 1
126 126 other 2
127 127
128 128 other 3
129 129
130 130 0 1e4e1b8f71e0 1970-01-12 13:46 +0000 User Name <user@hostname>
131 131 line 1
132 132 line 2
133 133
134 134
135 135 $ hg log --debug --style compact
136 136 8[tip]:7,-1 95c24699272e 2020-01-01 10:01 +0000 test
137 137 third
138 138
139 139 7:-1,-1 29114dbae42b 1970-01-12 13:46 +0000 User Name <user@hostname>
140 140 second
141 141
142 142 6:5,4 c7b487c6c50e 1970-01-18 08:40 +0000 person
143 143 merge
144 144
145 145 5:3,-1 13207e5a10d9 1970-01-18 08:40 +0000 person
146 146 new head
147 147
148 148 4:3,-1 32a18f097fcc 1970-01-17 04:53 +0000 person
149 149 new branch
150 150
151 151 3:2,-1 10e46f2dcbf4 1970-01-16 01:06 +0000 person
152 152 no user, no domain
153 153
154 154 2:1,-1 97054abb4ab8 1970-01-14 21:20 +0000 other@place
155 155 no person
156 156
157 157 1:0,-1 b608e9d1a3f0 1970-01-13 17:33 +0000 A. N. Other <other@place>
158 158 other 1
159 159 other 2
160 160
161 161 other 3
162 162
163 163 0:-1,-1 1e4e1b8f71e0 1970-01-12 13:46 +0000 User Name <user@hostname>
164 164 line 1
165 165 line 2
166 166
167 167
168 168 Test xml styles:
169 169
170 170 $ hg log --style xml
171 171 <?xml version="1.0"?>
172 172 <log>
173 173 <logentry revision="8" node="95c24699272ef57d062b8bccc32c878bf841784a">
174 174 <tag>tip</tag>
175 175 <author email="test">test</author>
176 176 <date>2020-01-01T10:01:00+00:00</date>
177 177 <msg xml:space="preserve">third</msg>
178 178 </logentry>
179 179 <logentry revision="7" node="29114dbae42b9f078cf2714dbe3a86bba8ec7453">
180 180 <parent revision="-1" node="0000000000000000000000000000000000000000" />
181 181 <author email="user@hostname">User Name</author>
182 182 <date>1970-01-12T13:46:40+00:00</date>
183 183 <msg xml:space="preserve">second</msg>
184 184 </logentry>
185 185 <logentry revision="6" node="c7b487c6c50ef1cf464cafdc4f4f5e615fc5999f">
186 186 <parent revision="5" node="13207e5a10d9fd28ec424934298e176197f2c67f" />
187 187 <parent revision="4" node="32a18f097fcccf76ef282f62f8a85b3adf8d13c4" />
188 188 <author email="person">person</author>
189 189 <date>1970-01-18T08:40:01+00:00</date>
190 190 <msg xml:space="preserve">merge</msg>
191 191 </logentry>
192 192 <logentry revision="5" node="13207e5a10d9fd28ec424934298e176197f2c67f">
193 193 <parent revision="3" node="10e46f2dcbf4823578cf180f33ecf0b957964c47" />
194 194 <author email="person">person</author>
195 195 <date>1970-01-18T08:40:00+00:00</date>
196 196 <msg xml:space="preserve">new head</msg>
197 197 </logentry>
198 198 <logentry revision="4" node="32a18f097fcccf76ef282f62f8a85b3adf8d13c4">
199 199 <branch>foo</branch>
200 200 <author email="person">person</author>
201 201 <date>1970-01-17T04:53:20+00:00</date>
202 202 <msg xml:space="preserve">new branch</msg>
203 203 </logentry>
204 204 <logentry revision="3" node="10e46f2dcbf4823578cf180f33ecf0b957964c47">
205 205 <author email="person">person</author>
206 206 <date>1970-01-16T01:06:40+00:00</date>
207 207 <msg xml:space="preserve">no user, no domain</msg>
208 208 </logentry>
209 209 <logentry revision="2" node="97054abb4ab824450e9164180baf491ae0078465">
210 210 <author email="other@place">other</author>
211 211 <date>1970-01-14T21:20:00+00:00</date>
212 212 <msg xml:space="preserve">no person</msg>
213 213 </logentry>
214 214 <logentry revision="1" node="b608e9d1a3f0273ccf70fb85fd6866b3482bf965">
215 215 <author email="other@place">A. N. Other</author>
216 216 <date>1970-01-13T17:33:20+00:00</date>
217 217 <msg xml:space="preserve">other 1
218 218 other 2
219 219
220 220 other 3</msg>
221 221 </logentry>
222 222 <logentry revision="0" node="1e4e1b8f71e05681d422154f5421e385fec3454f">
223 223 <author email="user@hostname">User Name</author>
224 224 <date>1970-01-12T13:46:40+00:00</date>
225 225 <msg xml:space="preserve">line 1
226 226 line 2</msg>
227 227 </logentry>
228 228 </log>
229 229
230 230 $ hg log -v --style xml
231 231 <?xml version="1.0"?>
232 232 <log>
233 233 <logentry revision="8" node="95c24699272ef57d062b8bccc32c878bf841784a">
234 234 <tag>tip</tag>
235 235 <author email="test">test</author>
236 236 <date>2020-01-01T10:01:00+00:00</date>
237 237 <msg xml:space="preserve">third</msg>
238 238 <paths>
239 239 <path action="A">fourth</path>
240 240 <path action="A">third</path>
241 241 <path action="R">second</path>
242 242 </paths>
243 243 <copies>
244 244 <copy source="second">fourth</copy>
245 245 </copies>
246 246 </logentry>
247 247 <logentry revision="7" node="29114dbae42b9f078cf2714dbe3a86bba8ec7453">
248 248 <parent revision="-1" node="0000000000000000000000000000000000000000" />
249 249 <author email="user@hostname">User Name</author>
250 250 <date>1970-01-12T13:46:40+00:00</date>
251 251 <msg xml:space="preserve">second</msg>
252 252 <paths>
253 253 <path action="A">second</path>
254 254 </paths>
255 255 </logentry>
256 256 <logentry revision="6" node="c7b487c6c50ef1cf464cafdc4f4f5e615fc5999f">
257 257 <parent revision="5" node="13207e5a10d9fd28ec424934298e176197f2c67f" />
258 258 <parent revision="4" node="32a18f097fcccf76ef282f62f8a85b3adf8d13c4" />
259 259 <author email="person">person</author>
260 260 <date>1970-01-18T08:40:01+00:00</date>
261 261 <msg xml:space="preserve">merge</msg>
262 262 <paths>
263 263 </paths>
264 264 </logentry>
265 265 <logentry revision="5" node="13207e5a10d9fd28ec424934298e176197f2c67f">
266 266 <parent revision="3" node="10e46f2dcbf4823578cf180f33ecf0b957964c47" />
267 267 <author email="person">person</author>
268 268 <date>1970-01-18T08:40:00+00:00</date>
269 269 <msg xml:space="preserve">new head</msg>
270 270 <paths>
271 271 <path action="A">d</path>
272 272 </paths>
273 273 </logentry>
274 274 <logentry revision="4" node="32a18f097fcccf76ef282f62f8a85b3adf8d13c4">
275 275 <branch>foo</branch>
276 276 <author email="person">person</author>
277 277 <date>1970-01-17T04:53:20+00:00</date>
278 278 <msg xml:space="preserve">new branch</msg>
279 279 <paths>
280 280 </paths>
281 281 </logentry>
282 282 <logentry revision="3" node="10e46f2dcbf4823578cf180f33ecf0b957964c47">
283 283 <author email="person">person</author>
284 284 <date>1970-01-16T01:06:40+00:00</date>
285 285 <msg xml:space="preserve">no user, no domain</msg>
286 286 <paths>
287 287 <path action="M">c</path>
288 288 </paths>
289 289 </logentry>
290 290 <logentry revision="2" node="97054abb4ab824450e9164180baf491ae0078465">
291 291 <author email="other@place">other</author>
292 292 <date>1970-01-14T21:20:00+00:00</date>
293 293 <msg xml:space="preserve">no person</msg>
294 294 <paths>
295 295 <path action="A">c</path>
296 296 </paths>
297 297 </logentry>
298 298 <logentry revision="1" node="b608e9d1a3f0273ccf70fb85fd6866b3482bf965">
299 299 <author email="other@place">A. N. Other</author>
300 300 <date>1970-01-13T17:33:20+00:00</date>
301 301 <msg xml:space="preserve">other 1
302 302 other 2
303 303
304 304 other 3</msg>
305 305 <paths>
306 306 <path action="A">b</path>
307 307 </paths>
308 308 </logentry>
309 309 <logentry revision="0" node="1e4e1b8f71e05681d422154f5421e385fec3454f">
310 310 <author email="user@hostname">User Name</author>
311 311 <date>1970-01-12T13:46:40+00:00</date>
312 312 <msg xml:space="preserve">line 1
313 313 line 2</msg>
314 314 <paths>
315 315 <path action="A">a</path>
316 316 </paths>
317 317 </logentry>
318 318 </log>
319 319
320 320 $ hg log --debug --style xml
321 321 <?xml version="1.0"?>
322 322 <log>
323 323 <logentry revision="8" node="95c24699272ef57d062b8bccc32c878bf841784a">
324 324 <tag>tip</tag>
325 325 <parent revision="7" node="29114dbae42b9f078cf2714dbe3a86bba8ec7453" />
326 326 <parent revision="-1" node="0000000000000000000000000000000000000000" />
327 327 <author email="test">test</author>
328 328 <date>2020-01-01T10:01:00+00:00</date>
329 329 <msg xml:space="preserve">third</msg>
330 330 <paths>
331 331 <path action="A">fourth</path>
332 332 <path action="A">third</path>
333 333 <path action="R">second</path>
334 334 </paths>
335 335 <copies>
336 336 <copy source="second">fourth</copy>
337 337 </copies>
338 338 <extra key="branch">default</extra>
339 339 </logentry>
340 340 <logentry revision="7" node="29114dbae42b9f078cf2714dbe3a86bba8ec7453">
341 341 <parent revision="-1" node="0000000000000000000000000000000000000000" />
342 342 <parent revision="-1" node="0000000000000000000000000000000000000000" />
343 343 <author email="user@hostname">User Name</author>
344 344 <date>1970-01-12T13:46:40+00:00</date>
345 345 <msg xml:space="preserve">second</msg>
346 346 <paths>
347 347 <path action="A">second</path>
348 348 </paths>
349 349 <extra key="branch">default</extra>
350 350 </logentry>
351 351 <logentry revision="6" node="c7b487c6c50ef1cf464cafdc4f4f5e615fc5999f">
352 352 <parent revision="5" node="13207e5a10d9fd28ec424934298e176197f2c67f" />
353 353 <parent revision="4" node="32a18f097fcccf76ef282f62f8a85b3adf8d13c4" />
354 354 <author email="person">person</author>
355 355 <date>1970-01-18T08:40:01+00:00</date>
356 356 <msg xml:space="preserve">merge</msg>
357 357 <paths>
358 358 </paths>
359 359 <extra key="branch">default</extra>
360 360 </logentry>
361 361 <logentry revision="5" node="13207e5a10d9fd28ec424934298e176197f2c67f">
362 362 <parent revision="3" node="10e46f2dcbf4823578cf180f33ecf0b957964c47" />
363 363 <parent revision="-1" node="0000000000000000000000000000000000000000" />
364 364 <author email="person">person</author>
365 365 <date>1970-01-18T08:40:00+00:00</date>
366 366 <msg xml:space="preserve">new head</msg>
367 367 <paths>
368 368 <path action="A">d</path>
369 369 </paths>
370 370 <extra key="branch">default</extra>
371 371 </logentry>
372 372 <logentry revision="4" node="32a18f097fcccf76ef282f62f8a85b3adf8d13c4">
373 373 <branch>foo</branch>
374 374 <parent revision="3" node="10e46f2dcbf4823578cf180f33ecf0b957964c47" />
375 375 <parent revision="-1" node="0000000000000000000000000000000000000000" />
376 376 <author email="person">person</author>
377 377 <date>1970-01-17T04:53:20+00:00</date>
378 378 <msg xml:space="preserve">new branch</msg>
379 379 <paths>
380 380 </paths>
381 381 <extra key="branch">foo</extra>
382 382 </logentry>
383 383 <logentry revision="3" node="10e46f2dcbf4823578cf180f33ecf0b957964c47">
384 384 <parent revision="2" node="97054abb4ab824450e9164180baf491ae0078465" />
385 385 <parent revision="-1" node="0000000000000000000000000000000000000000" />
386 386 <author email="person">person</author>
387 387 <date>1970-01-16T01:06:40+00:00</date>
388 388 <msg xml:space="preserve">no user, no domain</msg>
389 389 <paths>
390 390 <path action="M">c</path>
391 391 </paths>
392 392 <extra key="branch">default</extra>
393 393 </logentry>
394 394 <logentry revision="2" node="97054abb4ab824450e9164180baf491ae0078465">
395 395 <parent revision="1" node="b608e9d1a3f0273ccf70fb85fd6866b3482bf965" />
396 396 <parent revision="-1" node="0000000000000000000000000000000000000000" />
397 397 <author email="other@place">other</author>
398 398 <date>1970-01-14T21:20:00+00:00</date>
399 399 <msg xml:space="preserve">no person</msg>
400 400 <paths>
401 401 <path action="A">c</path>
402 402 </paths>
403 403 <extra key="branch">default</extra>
404 404 </logentry>
405 405 <logentry revision="1" node="b608e9d1a3f0273ccf70fb85fd6866b3482bf965">
406 406 <parent revision="0" node="1e4e1b8f71e05681d422154f5421e385fec3454f" />
407 407 <parent revision="-1" node="0000000000000000000000000000000000000000" />
408 408 <author email="other@place">A. N. Other</author>
409 409 <date>1970-01-13T17:33:20+00:00</date>
410 410 <msg xml:space="preserve">other 1
411 411 other 2
412 412
413 413 other 3</msg>
414 414 <paths>
415 415 <path action="A">b</path>
416 416 </paths>
417 417 <extra key="branch">default</extra>
418 418 </logentry>
419 419 <logentry revision="0" node="1e4e1b8f71e05681d422154f5421e385fec3454f">
420 420 <parent revision="-1" node="0000000000000000000000000000000000000000" />
421 421 <parent revision="-1" node="0000000000000000000000000000000000000000" />
422 422 <author email="user@hostname">User Name</author>
423 423 <date>1970-01-12T13:46:40+00:00</date>
424 424 <msg xml:space="preserve">line 1
425 425 line 2</msg>
426 426 <paths>
427 427 <path action="A">a</path>
428 428 </paths>
429 429 <extra key="branch">default</extra>
430 430 </logentry>
431 431 </log>
432 432
433 433
434 434 Error if style not readable:
435 435
436 436 $ touch q
437 437 $ chmod 0 q
438 438 $ hg log --style ./q
439 439 abort: Permission denied: ./q
440 440 [255]
441 441
442 442 Error if no style:
443 443
444 444 $ hg log --style notexist
445 445 abort: style not found: notexist
446 446 [255]
447 447
448 448 Error if style missing key:
449 449
450 450 $ echo 'q = q' > t
451 451 $ hg log --style ./t
452 452 abort: ./t: no key named 'changeset'
453 453 [255]
454 454
455 455 Error if include fails:
456 456
457 457 $ echo 'changeset = q' >> t
458 458 $ hg log --style ./t
459 459 abort: template file ./q: Permission denied
460 460 [255]
461 461
462 462 Include works:
463 463
464 464 $ rm q
465 465 $ echo '{rev}' > q
466 466 $ hg log --style ./t
467 467 8
468 468 7
469 469 6
470 470 5
471 471 4
472 472 3
473 473 2
474 474 1
475 475 0
476 476
477 477 ui.style works:
478 478
479 479 $ echo '[ui]' > .hg/hgrc
480 480 $ echo 'style = t' >> .hg/hgrc
481 481 $ hg log
482 482 8
483 483 7
484 484 6
485 485 5
486 486 4
487 487 3
488 488 2
489 489 1
490 490 0
491 491
492 492
493 493 Issue338:
494 494
495 495 $ hg log --style=changelog > changelog
496 496
497 497 $ cat changelog
498 498 2020-01-01 test <test>
499 499
500 500 * fourth, second, third:
501 501 third
502 502 [95c24699272e] [tip]
503 503
504 504 1970-01-12 User Name <user@hostname>
505 505
506 506 * second:
507 507 second
508 508 [29114dbae42b]
509 509
510 510 1970-01-18 person <person>
511 511
512 512 * merge
513 513 [c7b487c6c50e]
514 514
515 515 * d:
516 516 new head
517 517 [13207e5a10d9]
518 518
519 519 1970-01-17 person <person>
520 520
521 521 * new branch
522 522 [32a18f097fcc] <foo>
523 523
524 524 1970-01-16 person <person>
525 525
526 526 * c:
527 527 no user, no domain
528 528 [10e46f2dcbf4]
529 529
530 530 1970-01-14 other <other@place>
531 531
532 532 * c:
533 533 no person
534 534 [97054abb4ab8]
535 535
536 536 1970-01-13 A. N. Other <other@place>
537 537
538 538 * b:
539 539 other 1 other 2
540 540
541 541 other 3
542 542 [b608e9d1a3f0]
543 543
544 544 1970-01-12 User Name <user@hostname>
545 545
546 546 * a:
547 547 line 1 line 2
548 548 [1e4e1b8f71e0]
549 549
550 550
551 551 Issue2130: xml output for 'hg heads' is malformed
552 552
553 553 $ hg heads --style changelog
554 554 2020-01-01 test <test>
555 555
556 556 * fourth, second, third:
557 557 third
558 558 [95c24699272e] [tip]
559 559
560 560 1970-01-18 person <person>
561 561
562 562 * merge
563 563 [c7b487c6c50e]
564 564
565 565 1970-01-17 person <person>
566 566
567 567 * new branch
568 568 [32a18f097fcc] <foo>
569 569
570 570
571 571 Keys work:
572 572
573 $ for key in author branches date desc file_adds file_dels file_mods \
573 $ for key in author branch branches date desc file_adds file_dels file_mods \
574 574 > file_copies file_copies_switch files \
575 575 > manifest node parents rev tags diffstat extras; do
576 576 > for mode in '' --verbose --debug; do
577 577 > hg log $mode --template "$key$mode: {$key}\n"
578 578 > done
579 579 > done
580 580 author: test
581 581 author: User Name <user@hostname>
582 582 author: person
583 583 author: person
584 584 author: person
585 585 author: person
586 586 author: other@place
587 587 author: A. N. Other <other@place>
588 588 author: User Name <user@hostname>
589 589 author--verbose: test
590 590 author--verbose: User Name <user@hostname>
591 591 author--verbose: person
592 592 author--verbose: person
593 593 author--verbose: person
594 594 author--verbose: person
595 595 author--verbose: other@place
596 596 author--verbose: A. N. Other <other@place>
597 597 author--verbose: User Name <user@hostname>
598 598 author--debug: test
599 599 author--debug: User Name <user@hostname>
600 600 author--debug: person
601 601 author--debug: person
602 602 author--debug: person
603 603 author--debug: person
604 604 author--debug: other@place
605 605 author--debug: A. N. Other <other@place>
606 606 author--debug: User Name <user@hostname>
607 branch: default
608 branch: default
609 branch: default
610 branch: default
611 branch: foo
612 branch: default
613 branch: default
614 branch: default
615 branch: default
616 branch--verbose: default
617 branch--verbose: default
618 branch--verbose: default
619 branch--verbose: default
620 branch--verbose: foo
621 branch--verbose: default
622 branch--verbose: default
623 branch--verbose: default
624 branch--verbose: default
625 branch--debug: default
626 branch--debug: default
627 branch--debug: default
628 branch--debug: default
629 branch--debug: foo
630 branch--debug: default
631 branch--debug: default
632 branch--debug: default
633 branch--debug: default
607 634 branches:
608 635 branches:
609 636 branches:
610 637 branches:
611 638 branches: foo
612 639 branches:
613 640 branches:
614 641 branches:
615 642 branches:
616 643 branches--verbose:
617 644 branches--verbose:
618 645 branches--verbose:
619 646 branches--verbose:
620 647 branches--verbose: foo
621 648 branches--verbose:
622 649 branches--verbose:
623 650 branches--verbose:
624 651 branches--verbose:
625 652 branches--debug:
626 653 branches--debug:
627 654 branches--debug:
628 655 branches--debug:
629 656 branches--debug: foo
630 657 branches--debug:
631 658 branches--debug:
632 659 branches--debug:
633 660 branches--debug:
634 661 date: 1577872860.00
635 662 date: 1000000.00
636 663 date: 1500001.00
637 664 date: 1500000.00
638 665 date: 1400000.00
639 666 date: 1300000.00
640 667 date: 1200000.00
641 668 date: 1100000.00
642 669 date: 1000000.00
643 670 date--verbose: 1577872860.00
644 671 date--verbose: 1000000.00
645 672 date--verbose: 1500001.00
646 673 date--verbose: 1500000.00
647 674 date--verbose: 1400000.00
648 675 date--verbose: 1300000.00
649 676 date--verbose: 1200000.00
650 677 date--verbose: 1100000.00
651 678 date--verbose: 1000000.00
652 679 date--debug: 1577872860.00
653 680 date--debug: 1000000.00
654 681 date--debug: 1500001.00
655 682 date--debug: 1500000.00
656 683 date--debug: 1400000.00
657 684 date--debug: 1300000.00
658 685 date--debug: 1200000.00
659 686 date--debug: 1100000.00
660 687 date--debug: 1000000.00
661 688 desc: third
662 689 desc: second
663 690 desc: merge
664 691 desc: new head
665 692 desc: new branch
666 693 desc: no user, no domain
667 694 desc: no person
668 695 desc: other 1
669 696 other 2
670 697
671 698 other 3
672 699 desc: line 1
673 700 line 2
674 701 desc--verbose: third
675 702 desc--verbose: second
676 703 desc--verbose: merge
677 704 desc--verbose: new head
678 705 desc--verbose: new branch
679 706 desc--verbose: no user, no domain
680 707 desc--verbose: no person
681 708 desc--verbose: other 1
682 709 other 2
683 710
684 711 other 3
685 712 desc--verbose: line 1
686 713 line 2
687 714 desc--debug: third
688 715 desc--debug: second
689 716 desc--debug: merge
690 717 desc--debug: new head
691 718 desc--debug: new branch
692 719 desc--debug: no user, no domain
693 720 desc--debug: no person
694 721 desc--debug: other 1
695 722 other 2
696 723
697 724 other 3
698 725 desc--debug: line 1
699 726 line 2
700 727 file_adds: fourth third
701 728 file_adds: second
702 729 file_adds:
703 730 file_adds: d
704 731 file_adds:
705 732 file_adds:
706 733 file_adds: c
707 734 file_adds: b
708 735 file_adds: a
709 736 file_adds--verbose: fourth third
710 737 file_adds--verbose: second
711 738 file_adds--verbose:
712 739 file_adds--verbose: d
713 740 file_adds--verbose:
714 741 file_adds--verbose:
715 742 file_adds--verbose: c
716 743 file_adds--verbose: b
717 744 file_adds--verbose: a
718 745 file_adds--debug: fourth third
719 746 file_adds--debug: second
720 747 file_adds--debug:
721 748 file_adds--debug: d
722 749 file_adds--debug:
723 750 file_adds--debug:
724 751 file_adds--debug: c
725 752 file_adds--debug: b
726 753 file_adds--debug: a
727 754 file_dels: second
728 755 file_dels:
729 756 file_dels:
730 757 file_dels:
731 758 file_dels:
732 759 file_dels:
733 760 file_dels:
734 761 file_dels:
735 762 file_dels:
736 763 file_dels--verbose: second
737 764 file_dels--verbose:
738 765 file_dels--verbose:
739 766 file_dels--verbose:
740 767 file_dels--verbose:
741 768 file_dels--verbose:
742 769 file_dels--verbose:
743 770 file_dels--verbose:
744 771 file_dels--verbose:
745 772 file_dels--debug: second
746 773 file_dels--debug:
747 774 file_dels--debug:
748 775 file_dels--debug:
749 776 file_dels--debug:
750 777 file_dels--debug:
751 778 file_dels--debug:
752 779 file_dels--debug:
753 780 file_dels--debug:
754 781 file_mods:
755 782 file_mods:
756 783 file_mods:
757 784 file_mods:
758 785 file_mods:
759 786 file_mods: c
760 787 file_mods:
761 788 file_mods:
762 789 file_mods:
763 790 file_mods--verbose:
764 791 file_mods--verbose:
765 792 file_mods--verbose:
766 793 file_mods--verbose:
767 794 file_mods--verbose:
768 795 file_mods--verbose: c
769 796 file_mods--verbose:
770 797 file_mods--verbose:
771 798 file_mods--verbose:
772 799 file_mods--debug:
773 800 file_mods--debug:
774 801 file_mods--debug:
775 802 file_mods--debug:
776 803 file_mods--debug:
777 804 file_mods--debug: c
778 805 file_mods--debug:
779 806 file_mods--debug:
780 807 file_mods--debug:
781 808 file_copies: fourth (second)
782 809 file_copies:
783 810 file_copies:
784 811 file_copies:
785 812 file_copies:
786 813 file_copies:
787 814 file_copies:
788 815 file_copies:
789 816 file_copies:
790 817 file_copies--verbose: fourth (second)
791 818 file_copies--verbose:
792 819 file_copies--verbose:
793 820 file_copies--verbose:
794 821 file_copies--verbose:
795 822 file_copies--verbose:
796 823 file_copies--verbose:
797 824 file_copies--verbose:
798 825 file_copies--verbose:
799 826 file_copies--debug: fourth (second)
800 827 file_copies--debug:
801 828 file_copies--debug:
802 829 file_copies--debug:
803 830 file_copies--debug:
804 831 file_copies--debug:
805 832 file_copies--debug:
806 833 file_copies--debug:
807 834 file_copies--debug:
808 835 file_copies_switch:
809 836 file_copies_switch:
810 837 file_copies_switch:
811 838 file_copies_switch:
812 839 file_copies_switch:
813 840 file_copies_switch:
814 841 file_copies_switch:
815 842 file_copies_switch:
816 843 file_copies_switch:
817 844 file_copies_switch--verbose:
818 845 file_copies_switch--verbose:
819 846 file_copies_switch--verbose:
820 847 file_copies_switch--verbose:
821 848 file_copies_switch--verbose:
822 849 file_copies_switch--verbose:
823 850 file_copies_switch--verbose:
824 851 file_copies_switch--verbose:
825 852 file_copies_switch--verbose:
826 853 file_copies_switch--debug:
827 854 file_copies_switch--debug:
828 855 file_copies_switch--debug:
829 856 file_copies_switch--debug:
830 857 file_copies_switch--debug:
831 858 file_copies_switch--debug:
832 859 file_copies_switch--debug:
833 860 file_copies_switch--debug:
834 861 file_copies_switch--debug:
835 862 files: fourth second third
836 863 files: second
837 864 files:
838 865 files: d
839 866 files:
840 867 files: c
841 868 files: c
842 869 files: b
843 870 files: a
844 871 files--verbose: fourth second third
845 872 files--verbose: second
846 873 files--verbose:
847 874 files--verbose: d
848 875 files--verbose:
849 876 files--verbose: c
850 877 files--verbose: c
851 878 files--verbose: b
852 879 files--verbose: a
853 880 files--debug: fourth second third
854 881 files--debug: second
855 882 files--debug:
856 883 files--debug: d
857 884 files--debug:
858 885 files--debug: c
859 886 files--debug: c
860 887 files--debug: b
861 888 files--debug: a
862 889 manifest: 8:94961b75a2da
863 890 manifest: 7:f2dbc354b94e
864 891 manifest: 6:91015e9dbdd7
865 892 manifest: 5:4dc3def4f9b4
866 893 manifest: 4:90ae8dda64e1
867 894 manifest: 3:cb5a1327723b
868 895 manifest: 2:6e0e82995c35
869 896 manifest: 1:4e8d705b1e53
870 897 manifest: 0:a0c8bcbbb45c
871 898 manifest--verbose: 8:94961b75a2da
872 899 manifest--verbose: 7:f2dbc354b94e
873 900 manifest--verbose: 6:91015e9dbdd7
874 901 manifest--verbose: 5:4dc3def4f9b4
875 902 manifest--verbose: 4:90ae8dda64e1
876 903 manifest--verbose: 3:cb5a1327723b
877 904 manifest--verbose: 2:6e0e82995c35
878 905 manifest--verbose: 1:4e8d705b1e53
879 906 manifest--verbose: 0:a0c8bcbbb45c
880 907 manifest--debug: 8:94961b75a2da554b4df6fb599e5bfc7d48de0c64
881 908 manifest--debug: 7:f2dbc354b94e5ec0b4f10680ee0cee816101d0bf
882 909 manifest--debug: 6:91015e9dbdd76a6791085d12b0a0ec7fcd22ffbf
883 910 manifest--debug: 5:4dc3def4f9b4c6e8de820f6ee74737f91e96a216
884 911 manifest--debug: 4:90ae8dda64e1a876c792bccb9af66284f6018363
885 912 manifest--debug: 3:cb5a1327723bada42f117e4c55a303246eaf9ccc
886 913 manifest--debug: 2:6e0e82995c35d0d57a52aca8da4e56139e06b4b1
887 914 manifest--debug: 1:4e8d705b1e53e3f9375e0e60dc7b525d8211fe55
888 915 manifest--debug: 0:a0c8bcbbb45c63b90b70ad007bf38961f64f2af0
889 916 node: 95c24699272ef57d062b8bccc32c878bf841784a
890 917 node: 29114dbae42b9f078cf2714dbe3a86bba8ec7453
891 918 node: c7b487c6c50ef1cf464cafdc4f4f5e615fc5999f
892 919 node: 13207e5a10d9fd28ec424934298e176197f2c67f
893 920 node: 32a18f097fcccf76ef282f62f8a85b3adf8d13c4
894 921 node: 10e46f2dcbf4823578cf180f33ecf0b957964c47
895 922 node: 97054abb4ab824450e9164180baf491ae0078465
896 923 node: b608e9d1a3f0273ccf70fb85fd6866b3482bf965
897 924 node: 1e4e1b8f71e05681d422154f5421e385fec3454f
898 925 node--verbose: 95c24699272ef57d062b8bccc32c878bf841784a
899 926 node--verbose: 29114dbae42b9f078cf2714dbe3a86bba8ec7453
900 927 node--verbose: c7b487c6c50ef1cf464cafdc4f4f5e615fc5999f
901 928 node--verbose: 13207e5a10d9fd28ec424934298e176197f2c67f
902 929 node--verbose: 32a18f097fcccf76ef282f62f8a85b3adf8d13c4
903 930 node--verbose: 10e46f2dcbf4823578cf180f33ecf0b957964c47
904 931 node--verbose: 97054abb4ab824450e9164180baf491ae0078465
905 932 node--verbose: b608e9d1a3f0273ccf70fb85fd6866b3482bf965
906 933 node--verbose: 1e4e1b8f71e05681d422154f5421e385fec3454f
907 934 node--debug: 95c24699272ef57d062b8bccc32c878bf841784a
908 935 node--debug: 29114dbae42b9f078cf2714dbe3a86bba8ec7453
909 936 node--debug: c7b487c6c50ef1cf464cafdc4f4f5e615fc5999f
910 937 node--debug: 13207e5a10d9fd28ec424934298e176197f2c67f
911 938 node--debug: 32a18f097fcccf76ef282f62f8a85b3adf8d13c4
912 939 node--debug: 10e46f2dcbf4823578cf180f33ecf0b957964c47
913 940 node--debug: 97054abb4ab824450e9164180baf491ae0078465
914 941 node--debug: b608e9d1a3f0273ccf70fb85fd6866b3482bf965
915 942 node--debug: 1e4e1b8f71e05681d422154f5421e385fec3454f
916 943 parents:
917 944 parents: -1:000000000000
918 945 parents: 5:13207e5a10d9 4:32a18f097fcc
919 946 parents: 3:10e46f2dcbf4
920 947 parents:
921 948 parents:
922 949 parents:
923 950 parents:
924 951 parents:
925 952 parents--verbose:
926 953 parents--verbose: -1:000000000000
927 954 parents--verbose: 5:13207e5a10d9 4:32a18f097fcc
928 955 parents--verbose: 3:10e46f2dcbf4
929 956 parents--verbose:
930 957 parents--verbose:
931 958 parents--verbose:
932 959 parents--verbose:
933 960 parents--verbose:
934 961 parents--debug: 7:29114dbae42b9f078cf2714dbe3a86bba8ec7453 -1:0000000000000000000000000000000000000000
935 962 parents--debug: -1:0000000000000000000000000000000000000000 -1:0000000000000000000000000000000000000000
936 963 parents--debug: 5:13207e5a10d9fd28ec424934298e176197f2c67f 4:32a18f097fcccf76ef282f62f8a85b3adf8d13c4
937 964 parents--debug: 3:10e46f2dcbf4823578cf180f33ecf0b957964c47 -1:0000000000000000000000000000000000000000
938 965 parents--debug: 3:10e46f2dcbf4823578cf180f33ecf0b957964c47 -1:0000000000000000000000000000000000000000
939 966 parents--debug: 2:97054abb4ab824450e9164180baf491ae0078465 -1:0000000000000000000000000000000000000000
940 967 parents--debug: 1:b608e9d1a3f0273ccf70fb85fd6866b3482bf965 -1:0000000000000000000000000000000000000000
941 968 parents--debug: 0:1e4e1b8f71e05681d422154f5421e385fec3454f -1:0000000000000000000000000000000000000000
942 969 parents--debug: -1:0000000000000000000000000000000000000000 -1:0000000000000000000000000000000000000000
943 970 rev: 8
944 971 rev: 7
945 972 rev: 6
946 973 rev: 5
947 974 rev: 4
948 975 rev: 3
949 976 rev: 2
950 977 rev: 1
951 978 rev: 0
952 979 rev--verbose: 8
953 980 rev--verbose: 7
954 981 rev--verbose: 6
955 982 rev--verbose: 5
956 983 rev--verbose: 4
957 984 rev--verbose: 3
958 985 rev--verbose: 2
959 986 rev--verbose: 1
960 987 rev--verbose: 0
961 988 rev--debug: 8
962 989 rev--debug: 7
963 990 rev--debug: 6
964 991 rev--debug: 5
965 992 rev--debug: 4
966 993 rev--debug: 3
967 994 rev--debug: 2
968 995 rev--debug: 1
969 996 rev--debug: 0
970 997 tags: tip
971 998 tags:
972 999 tags:
973 1000 tags:
974 1001 tags:
975 1002 tags:
976 1003 tags:
977 1004 tags:
978 1005 tags:
979 1006 tags--verbose: tip
980 1007 tags--verbose:
981 1008 tags--verbose:
982 1009 tags--verbose:
983 1010 tags--verbose:
984 1011 tags--verbose:
985 1012 tags--verbose:
986 1013 tags--verbose:
987 1014 tags--verbose:
988 1015 tags--debug: tip
989 1016 tags--debug:
990 1017 tags--debug:
991 1018 tags--debug:
992 1019 tags--debug:
993 1020 tags--debug:
994 1021 tags--debug:
995 1022 tags--debug:
996 1023 tags--debug:
997 1024 diffstat: 3: +2/-1
998 1025 diffstat: 1: +1/-0
999 1026 diffstat: 0: +0/-0
1000 1027 diffstat: 1: +1/-0
1001 1028 diffstat: 0: +0/-0
1002 1029 diffstat: 1: +1/-0
1003 1030 diffstat: 1: +4/-0
1004 1031 diffstat: 1: +2/-0
1005 1032 diffstat: 1: +1/-0
1006 1033 diffstat--verbose: 3: +2/-1
1007 1034 diffstat--verbose: 1: +1/-0
1008 1035 diffstat--verbose: 0: +0/-0
1009 1036 diffstat--verbose: 1: +1/-0
1010 1037 diffstat--verbose: 0: +0/-0
1011 1038 diffstat--verbose: 1: +1/-0
1012 1039 diffstat--verbose: 1: +4/-0
1013 1040 diffstat--verbose: 1: +2/-0
1014 1041 diffstat--verbose: 1: +1/-0
1015 1042 diffstat--debug: 3: +2/-1
1016 1043 diffstat--debug: 1: +1/-0
1017 1044 diffstat--debug: 0: +0/-0
1018 1045 diffstat--debug: 1: +1/-0
1019 1046 diffstat--debug: 0: +0/-0
1020 1047 diffstat--debug: 1: +1/-0
1021 1048 diffstat--debug: 1: +4/-0
1022 1049 diffstat--debug: 1: +2/-0
1023 1050 diffstat--debug: 1: +1/-0
1024 1051 extras: branch=default
1025 1052 extras: branch=default
1026 1053 extras: branch=default
1027 1054 extras: branch=default
1028 1055 extras: branch=foo
1029 1056 extras: branch=default
1030 1057 extras: branch=default
1031 1058 extras: branch=default
1032 1059 extras: branch=default
1033 1060 extras--verbose: branch=default
1034 1061 extras--verbose: branch=default
1035 1062 extras--verbose: branch=default
1036 1063 extras--verbose: branch=default
1037 1064 extras--verbose: branch=foo
1038 1065 extras--verbose: branch=default
1039 1066 extras--verbose: branch=default
1040 1067 extras--verbose: branch=default
1041 1068 extras--verbose: branch=default
1042 1069 extras--debug: branch=default
1043 1070 extras--debug: branch=default
1044 1071 extras--debug: branch=default
1045 1072 extras--debug: branch=default
1046 1073 extras--debug: branch=foo
1047 1074 extras--debug: branch=default
1048 1075 extras--debug: branch=default
1049 1076 extras--debug: branch=default
1050 1077 extras--debug: branch=default
1051 1078
1052 1079
1053 1080 Filters work:
1054 1081
1055 1082 $ hg log --template '{author|domain}\n'
1056 1083
1057 1084 hostname
1058 1085
1059 1086
1060 1087
1061 1088
1062 1089 place
1063 1090 place
1064 1091 hostname
1065 1092
1066 1093 $ hg log --template '{author|person}\n'
1067 1094 test
1068 1095 User Name
1069 1096 person
1070 1097 person
1071 1098 person
1072 1099 person
1073 1100 other
1074 1101 A. N. Other
1075 1102 User Name
1076 1103
1077 1104 $ hg log --template '{author|user}\n'
1078 1105 test
1079 1106 user
1080 1107 person
1081 1108 person
1082 1109 person
1083 1110 person
1084 1111 other
1085 1112 other
1086 1113 user
1087 1114
1088 1115 $ hg log --template '{date|age}\n' > /dev/null || exit 1
1089 1116
1090 1117 $ hg log -l1 --template '{date|age}\n'
1091 1118 in the future
1092 1119 $ hg log --template '{date|date}\n'
1093 1120 Wed Jan 01 10:01:00 2020 +0000
1094 1121 Mon Jan 12 13:46:40 1970 +0000
1095 1122 Sun Jan 18 08:40:01 1970 +0000
1096 1123 Sun Jan 18 08:40:00 1970 +0000
1097 1124 Sat Jan 17 04:53:20 1970 +0000
1098 1125 Fri Jan 16 01:06:40 1970 +0000
1099 1126 Wed Jan 14 21:20:00 1970 +0000
1100 1127 Tue Jan 13 17:33:20 1970 +0000
1101 1128 Mon Jan 12 13:46:40 1970 +0000
1102 1129
1103 1130 $ hg log --template '{date|isodate}\n'
1104 1131 2020-01-01 10:01 +0000
1105 1132 1970-01-12 13:46 +0000
1106 1133 1970-01-18 08:40 +0000
1107 1134 1970-01-18 08:40 +0000
1108 1135 1970-01-17 04:53 +0000
1109 1136 1970-01-16 01:06 +0000
1110 1137 1970-01-14 21:20 +0000
1111 1138 1970-01-13 17:33 +0000
1112 1139 1970-01-12 13:46 +0000
1113 1140
1114 1141 $ hg log --template '{date|isodatesec}\n'
1115 1142 2020-01-01 10:01:00 +0000
1116 1143 1970-01-12 13:46:40 +0000
1117 1144 1970-01-18 08:40:01 +0000
1118 1145 1970-01-18 08:40:00 +0000
1119 1146 1970-01-17 04:53:20 +0000
1120 1147 1970-01-16 01:06:40 +0000
1121 1148 1970-01-14 21:20:00 +0000
1122 1149 1970-01-13 17:33:20 +0000
1123 1150 1970-01-12 13:46:40 +0000
1124 1151
1125 1152 $ hg log --template '{date|rfc822date}\n'
1126 1153 Wed, 01 Jan 2020 10:01:00 +0000
1127 1154 Mon, 12 Jan 1970 13:46:40 +0000
1128 1155 Sun, 18 Jan 1970 08:40:01 +0000
1129 1156 Sun, 18 Jan 1970 08:40:00 +0000
1130 1157 Sat, 17 Jan 1970 04:53:20 +0000
1131 1158 Fri, 16 Jan 1970 01:06:40 +0000
1132 1159 Wed, 14 Jan 1970 21:20:00 +0000
1133 1160 Tue, 13 Jan 1970 17:33:20 +0000
1134 1161 Mon, 12 Jan 1970 13:46:40 +0000
1135 1162
1136 1163 $ hg log --template '{desc|firstline}\n'
1137 1164 third
1138 1165 second
1139 1166 merge
1140 1167 new head
1141 1168 new branch
1142 1169 no user, no domain
1143 1170 no person
1144 1171 other 1
1145 1172 line 1
1146 1173
1147 1174 $ hg log --template '{node|short}\n'
1148 1175 95c24699272e
1149 1176 29114dbae42b
1150 1177 c7b487c6c50e
1151 1178 13207e5a10d9
1152 1179 32a18f097fcc
1153 1180 10e46f2dcbf4
1154 1181 97054abb4ab8
1155 1182 b608e9d1a3f0
1156 1183 1e4e1b8f71e0
1157 1184
1158 1185 $ hg log --template '<changeset author="{author|xmlescape}"/>\n'
1159 1186 <changeset author="test"/>
1160 1187 <changeset author="User Name &lt;user@hostname&gt;"/>
1161 1188 <changeset author="person"/>
1162 1189 <changeset author="person"/>
1163 1190 <changeset author="person"/>
1164 1191 <changeset author="person"/>
1165 1192 <changeset author="other@place"/>
1166 1193 <changeset author="A. N. Other &lt;other@place&gt;"/>
1167 1194 <changeset author="User Name &lt;user@hostname&gt;"/>
1168 1195
1169 1196 $ hg log --template '{rev}: {children}\n'
1170 1197 8:
1171 1198 7: 8:95c24699272e
1172 1199 6:
1173 1200 5: 6:c7b487c6c50e
1174 1201 4: 6:c7b487c6c50e
1175 1202 3: 4:32a18f097fcc 5:13207e5a10d9
1176 1203 2: 3:10e46f2dcbf4
1177 1204 1: 2:97054abb4ab8
1178 1205 0: 1:b608e9d1a3f0
1179 1206
1180 1207 Formatnode filter works:
1181 1208
1182 1209 $ hg -q log -r 0 --template '{node|formatnode}\n'
1183 1210 1e4e1b8f71e0
1184 1211
1185 1212 $ hg log -r 0 --template '{node|formatnode}\n'
1186 1213 1e4e1b8f71e0
1187 1214
1188 1215 $ hg -v log -r 0 --template '{node|formatnode}\n'
1189 1216 1e4e1b8f71e0
1190 1217
1191 1218 $ hg --debug log -r 0 --template '{node|formatnode}\n'
1192 1219 1e4e1b8f71e05681d422154f5421e385fec3454f
1193 1220
1194 1221 Error on syntax:
1195 1222
1196 1223 $ echo 'x = "f' >> t
1197 1224 $ hg log
1198 1225 abort: t:3: unmatched quotes
1199 1226 [255]
1200 1227
1201 1228 $ cd ..
1202 1229
1203 1230
1204 1231 latesttag:
1205 1232
1206 1233 $ hg init latesttag
1207 1234 $ cd latesttag
1208 1235
1209 1236 $ echo a > file
1210 1237 $ hg ci -Am a -d '0 0'
1211 1238 adding file
1212 1239
1213 1240 $ echo b >> file
1214 1241 $ hg ci -m b -d '1 0'
1215 1242
1216 1243 $ echo c >> head1
1217 1244 $ hg ci -Am h1c -d '2 0'
1218 1245 adding head1
1219 1246
1220 1247 $ hg update -q 1
1221 1248 $ echo d >> head2
1222 1249 $ hg ci -Am h2d -d '3 0'
1223 1250 adding head2
1224 1251 created new head
1225 1252
1226 1253 $ echo e >> head2
1227 1254 $ hg ci -m h2e -d '4 0'
1228 1255
1229 1256 $ hg merge -q
1230 1257 $ hg ci -m merge -d '5 0'
1231 1258
1232 1259 No tag set:
1233 1260
1234 1261 $ hg log --template '{rev}: {latesttag}+{latesttagdistance}\n'
1235 1262 5: null+5
1236 1263 4: null+4
1237 1264 3: null+3
1238 1265 2: null+3
1239 1266 1: null+2
1240 1267 0: null+1
1241 1268
1242 1269 One common tag: longuest path wins:
1243 1270
1244 1271 $ hg tag -r 1 -m t1 -d '6 0' t1
1245 1272 $ hg log --template '{rev}: {latesttag}+{latesttagdistance}\n'
1246 1273 6: t1+4
1247 1274 5: t1+3
1248 1275 4: t1+2
1249 1276 3: t1+1
1250 1277 2: t1+1
1251 1278 1: t1+0
1252 1279 0: null+1
1253 1280
1254 1281 One ancestor tag: more recent wins:
1255 1282
1256 1283 $ hg tag -r 2 -m t2 -d '7 0' t2
1257 1284 $ hg log --template '{rev}: {latesttag}+{latesttagdistance}\n'
1258 1285 7: t2+3
1259 1286 6: t2+2
1260 1287 5: t2+1
1261 1288 4: t1+2
1262 1289 3: t1+1
1263 1290 2: t2+0
1264 1291 1: t1+0
1265 1292 0: null+1
1266 1293
1267 1294 Two branch tags: more recent wins:
1268 1295
1269 1296 $ hg tag -r 3 -m t3 -d '8 0' t3
1270 1297 $ hg log --template '{rev}: {latesttag}+{latesttagdistance}\n'
1271 1298 8: t3+5
1272 1299 7: t3+4
1273 1300 6: t3+3
1274 1301 5: t3+2
1275 1302 4: t3+1
1276 1303 3: t3+0
1277 1304 2: t2+0
1278 1305 1: t1+0
1279 1306 0: null+1
1280 1307
1281 1308 Merged tag overrides:
1282 1309
1283 1310 $ hg tag -r 5 -m t5 -d '9 0' t5
1284 1311 $ hg tag -r 3 -m at3 -d '10 0' at3
1285 1312 $ hg log --template '{rev}: {latesttag}+{latesttagdistance}\n'
1286 1313 10: t5+5
1287 1314 9: t5+4
1288 1315 8: t5+3
1289 1316 7: t5+2
1290 1317 6: t5+1
1291 1318 5: t5+0
1292 1319 4: at3:t3+1
1293 1320 3: at3:t3+0
1294 1321 2: t2+0
1295 1322 1: t1+0
1296 1323 0: null+1
1297 1324
1298 1325 $ cd ..
1299 1326
1300 1327
1301 1328 Style path expansion: issue1948 - ui.style option doesn't work on OSX
1302 1329 if it is a relative path
1303 1330
1304 1331 $ mkdir -p home/styles
1305 1332
1306 1333 $ cat > home/styles/teststyle <<EOF
1307 1334 > changeset = 'test {rev}:{node|short}\n'
1308 1335 > EOF
1309 1336
1310 1337 $ HOME=`pwd`/home; export HOME
1311 1338
1312 1339 $ cat > latesttag/.hg/hgrc <<EOF
1313 1340 > [ui]
1314 1341 > style = ~/styles/teststyle
1315 1342 > EOF
1316 1343
1317 1344 $ hg -R latesttag tip
1318 1345 test 10:dee8f28249af
1319 1346
1320 1347 Test recursive showlist template (issue1989):
1321 1348
1322 1349 $ cat > style1989 <<EOF
1323 1350 > changeset = '{file_mods}{manifest}{extras}'
1324 1351 > file_mod = 'M|{author|person}\n'
1325 1352 > manifest = '{rev},{author}\n'
1326 1353 > extra = '{key}: {author}\n'
1327 1354 > EOF
1328 1355
1329 1356 $ hg -R latesttag log -r tip --style=style1989
1330 1357 M|test
1331 1358 10,test
1332 1359 branch: test
1333 1360
General Comments 0
You need to be logged in to leave comments. Login now