Show More
@@ -275,6 +275,36 b' def shownode(repo, ctx, templ, **args):' | |||
|
275 | 275 | """ |
|
276 | 276 | return ctx.hex() |
|
277 | 277 | |
|
278 | def showparent1(repo, ctx, templ, **args): | |
|
279 | """:parent1: Integer. The repository-local revision number of the | |
|
280 | changeset's first parent, or -1 if the changeset has no parents.""" | |
|
281 | return ctx.parents()[0].rev() | |
|
282 | ||
|
283 | def showparent2(repo, ctx, templ, **args): | |
|
284 | """:parent2: Integer. The repository-local revision number of the | |
|
285 | changeset's second parent, or -1 if the changeset has no second parent.""" | |
|
286 | parents = ctx.parents() | |
|
287 | if len(parents) > 1: | |
|
288 | return parents[1].rev() | |
|
289 | else: | |
|
290 | return repo['null'].rev() | |
|
291 | ||
|
292 | def showparent1node(repo, ctx, templ, **args): | |
|
293 | """:parent1node: String. The identification hash of the changeset's | |
|
294 | first parent, as a 40 digit hexadecimal string. If the changeset has no | |
|
295 | parents, all digits are 0.""" | |
|
296 | return ctx.parents()[0].hex() | |
|
297 | ||
|
298 | def showparent2node(repo, ctx, templ, **args): | |
|
299 | """:parent2node: String. The identification hash of the changeset's | |
|
300 | second parent, as a 40 digit hexadecimal string. If the changeset has no | |
|
301 | second parent, all digits are 0.""" | |
|
302 | parents = ctx.parents() | |
|
303 | if len(parents) > 1: | |
|
304 | return parents[1].hex() | |
|
305 | else: | |
|
306 | return repo['null'].hex() | |
|
307 | ||
|
278 | 308 | def showphase(repo, ctx, templ, **args): |
|
279 | 309 | """:phase: String. The changeset phase name.""" |
|
280 | 310 | return ctx.phasestr() |
@@ -320,6 +350,10 b' keywords = {' | |||
|
320 | 350 | 'latesttagdistance': showlatesttagdistance, |
|
321 | 351 | 'manifest': showmanifest, |
|
322 | 352 | 'node': shownode, |
|
353 | 'parent1': showparent1, | |
|
354 | 'parent1node': showparent1node, | |
|
355 | 'parent2': showparent2, | |
|
356 | 'parent2node': showparent2node, | |
|
323 | 357 | 'phase': showphase, |
|
324 | 358 | 'phaseidx': showphaseidx, |
|
325 | 359 | 'rev': showrev, |
@@ -36,4 +36,12 b'' | |||
|
36 | 36 | $ hg log --style=./mymap |
|
37 | 37 | 0 97e5f848f0936960273bbf75be6388cd0350a32b test |
|
38 | 38 | |
|
39 | $ cat > changeset.txt << EOF | |
|
40 | > {{parent1}} {{parent1node}} {{parent2}} {{parent2node}} | |
|
41 | > EOF | |
|
42 | $ hg ci -Ama | |
|
43 | $ hg log --style=./mymap | |
|
44 | 0 97e5f848f0936960273bbf75be6388cd0350a32b -1 0000000000000000000000000000000000000000 | |
|
45 | -1 0000000000000000000000000000000000000000 -1 0000000000000000000000000000000000000000 | |
|
46 | ||
|
39 | 47 | $ cd .. |
General Comments 0
You need to be logged in to leave comments.
Login now