##// END OF EJS Templates
template: add successors template...
Boris Feld -
r33276:89796a25 default
parent child Browse files
Show More
@@ -602,6 +602,38 def showpredecessors(repo, ctx, **args):
602 602 lambda x: {'ctx': repo[x], 'revcache': {}},
603 603 lambda d: _formatrevnode(d['ctx']))
604 604
605 @templatekeyword("successorssets")
606 def showsuccessorssets(repo, ctx, **args):
607 """Returns a string of sets of successors for a changectx
608
609 Format used is: [ctx1, ctx2], [ctx3] if ctx has been splitted into ctx1 and
610 ctx2 while also diverged into ctx3"""
611 if not ctx.obsolete():
612 return ''
613 args = pycompat.byteskwargs(args)
614
615 ssets = obsutil.successorssets(repo, ctx.node(), closest=True)
616 ssets = [[hex(n) for n in ss] for ss in ssets]
617
618 data = []
619 for ss in ssets:
620 h = _hybrid(None, ss, lambda x: {'ctx': repo[x], 'revcache': {}},
621 lambda d: _formatrevnode(d['ctx']))
622 data.append(h)
623
624 # Format the successorssets
625 def render(d):
626 t = []
627 for i in d.gen:
628 t.append(i)
629 return "".join(t)
630
631 def gen(data):
632 yield "; ".join(render(d) for d in data)
633
634 return _hybrid(gen(data), data, lambda x: {'successorset': x},
635 lambda d: d["successorset"])
636
605 637 @templatekeyword('p1rev')
606 638 def showp1rev(repo, ctx, templ, **args):
607 639 """Integer. The repository-local revision number of the changeset's
@@ -16,7 +16,10 Global setup
16 16 > {if(predecessors, "\n Predecessors: {predecessors}")}\
17 17 > {if(predecessors, "\n semi-colon: {join(predecessors, "; ")}")}\
18 18 > {if(predecessors, "\n json: {predecessors|json}")}\
19 > {if(predecessors, "\n map: {join(predecessors % "{rev}:{node}", " ")}")}\n'
19 > {if(predecessors, "\n map: {join(predecessors % "{rev}:{node}", " ")}")}\
20 > {if(successorssets, "\n Successors: {successorssets}")}\
21 > {if(successorssets, "\n multi-line: {join(successorssets, "\n multi-line: ")}")}\
22 > {if(successorssets, "\n json: {successorssets|json}")}\n'
20 23 > EOF
21 24
22 25 Test templates on amended commit
@@ -75,7 +78,9 Predecessors template should show curren
75 78 | json: ["471f378eab4c5e25f6c77f785b27c936efb22874"]
76 79 | map: 1:471f378eab4c5e25f6c77f785b27c936efb22874
77 80 | @ 471f378eab4c
78 |/
81 |/ Successors: 4:d004c8f274b9
82 | multi-line: 4:d004c8f274b9
83 | json: [["d004c8f274b9ec480a47a93c10dac5eee63adb78"]]
79 84 o ea207398892e
80 85
81 86 $ hg up 'desc(A1)' --hidden
@@ -89,7 +94,9 Predecessors template should show curren
89 94 | json: ["a468dc9b36338b14fdb7825f55ce3df4e71517ad"]
90 95 | map: 3:a468dc9b36338b14fdb7825f55ce3df4e71517ad
91 96 | @ a468dc9b3633
92 |/
97 |/ Successors: 4:d004c8f274b9
98 | multi-line: 4:d004c8f274b9
99 | json: [["d004c8f274b9ec480a47a93c10dac5eee63adb78"]]
93 100 o ea207398892e
94 101
95 102 Predecessors template should show all the predecessors as we force their display
@@ -105,10 +112,15 with --hidden
105 112 | semi-colon: 1:471f378eab4c
106 113 | json: ["471f378eab4c5e25f6c77f785b27c936efb22874"]
107 114 | map: 1:471f378eab4c5e25f6c77f785b27c936efb22874
115 | Successors: 4:d004c8f274b9
116 | multi-line: 4:d004c8f274b9
117 | json: [["d004c8f274b9ec480a47a93c10dac5eee63adb78"]]
108 118 | x f137d23bb3e1
109 119 | |
110 120 | x 471f378eab4c
111 |/
121 |/ Successors: 3:a468dc9b3633
122 | multi-line: 3:a468dc9b3633
123 | json: [["a468dc9b36338b14fdb7825f55ce3df4e71517ad"]]
112 124 o ea207398892e
113 125
114 126
@@ -132,10 +144,15 visible.
132 144 | semi-colon: 1:471f378eab4c
133 145 | json: ["471f378eab4c5e25f6c77f785b27c936efb22874"]
134 146 | map: 1:471f378eab4c5e25f6c77f785b27c936efb22874
147 | Successors: 4:d004c8f274b9
148 | multi-line: 4:d004c8f274b9
149 | json: [["d004c8f274b9ec480a47a93c10dac5eee63adb78"]]
135 150 | x f137d23bb3e1
136 151 | |
137 152 | x 471f378eab4c
138 |/
153 |/ Successors: 3:a468dc9b3633
154 | multi-line: 3:a468dc9b3633
155 | json: [["a468dc9b36338b14fdb7825f55ce3df4e71517ad"]]
139 156 o ea207398892e
140 157
141 158
@@ -216,7 +233,9 Predecessors template should show curren
216 233 | json: ["471597cad322d1f659bb169751be9133dad92ef3"]
217 234 | map: 1:471597cad322d1f659bb169751be9133dad92ef3
218 235 | @ 471597cad322
219 |/
236 |/ Successors: 2:337fec4d2edc 3:f257fde29c7a
237 | multi-line: 2:337fec4d2edc 3:f257fde29c7a
238 | json: [["337fec4d2edcf0e7a467e35f818234bc620068b5", "f257fde29c7a847c9b607f6e958656d0df0fb15c"]]
220 239 o ea207398892e
221 240
222 241 $ hg up f257fde29c7a
@@ -245,7 +264,9 with --hidden
245 264 | json: ["471597cad322d1f659bb169751be9133dad92ef3"]
246 265 | map: 1:471597cad322d1f659bb169751be9133dad92ef3
247 266 | x 471597cad322
248 |/
267 |/ Successors: 2:337fec4d2edc 3:f257fde29c7a
268 | multi-line: 2:337fec4d2edc 3:f257fde29c7a
269 | json: [["337fec4d2edcf0e7a467e35f818234bc620068b5", "f257fde29c7a847c9b607f6e958656d0df0fb15c"]]
249 270 o ea207398892e
250 271
251 272 Test templates with folded commit
@@ -325,7 +346,9 Predecessors template should show curren
325 346 | json: ["471f378eab4c5e25f6c77f785b27c936efb22874"]
326 347 | map: 1:471f378eab4c5e25f6c77f785b27c936efb22874
327 348 | @ 471f378eab4c
328 |/
349 |/ Successors: 3:eb5a0daa2192
350 | multi-line: 3:eb5a0daa2192
351 | json: [["eb5a0daa21923bbf8caeb2c42085b9e463861fd0"]]
329 352 o ea207398892e
330 353
331 354 $ hg up 'desc(B0)' --hidden
@@ -340,9 +363,13 displayed
340 363 | json: ["0dec01379d3be6318c470ead31b1fe7ae7cb53d5", "471f378eab4c5e25f6c77f785b27c936efb22874"]
341 364 | map: 2:0dec01379d3be6318c470ead31b1fe7ae7cb53d5 1:471f378eab4c5e25f6c77f785b27c936efb22874
342 365 | @ 0dec01379d3b
343 | |
366 | | Successors: 3:eb5a0daa2192
367 | | multi-line: 3:eb5a0daa2192
368 | | json: [["eb5a0daa21923bbf8caeb2c42085b9e463861fd0"]]
344 369 | x 471f378eab4c
345 |/
370 |/ Successors: 3:eb5a0daa2192
371 | multi-line: 3:eb5a0daa2192
372 | json: [["eb5a0daa21923bbf8caeb2c42085b9e463861fd0"]]
346 373 o ea207398892e
347 374
348 375 $ hg up 'desc(C0)'
@@ -364,9 +391,13 with --hidden
364 391 | json: ["0dec01379d3be6318c470ead31b1fe7ae7cb53d5", "471f378eab4c5e25f6c77f785b27c936efb22874"]
365 392 | map: 2:0dec01379d3be6318c470ead31b1fe7ae7cb53d5 1:471f378eab4c5e25f6c77f785b27c936efb22874
366 393 | x 0dec01379d3b
367 | |
394 | | Successors: 3:eb5a0daa2192
395 | | multi-line: 3:eb5a0daa2192
396 | | json: [["eb5a0daa21923bbf8caeb2c42085b9e463861fd0"]]
368 397 | x 471f378eab4c
369 |/
398 |/ Successors: 3:eb5a0daa2192
399 | multi-line: 3:eb5a0daa2192
400 | json: [["eb5a0daa21923bbf8caeb2c42085b9e463861fd0"]]
370 401 o ea207398892e
371 402
372 403
@@ -481,7 +512,10 Predecessors template should show curren
481 512 | json: ["471f378eab4c5e25f6c77f785b27c936efb22874"]
482 513 | map: 1:471f378eab4c5e25f6c77f785b27c936efb22874
483 514 | @ 471f378eab4c
484 |/
515 |/ Successors: 2:fdf9bde5129a; 4:019fadeab383
516 | multi-line: 2:fdf9bde5129a
517 | multi-line: 4:019fadeab383
518 | json: [["fdf9bde5129a28d4548fadd3f62b265cdd3b7a2e"], ["019fadeab383f6699fa83ad7bdb4d82ed2c0e5ab"]]
485 519 o ea207398892e
486 520
487 521 $ hg up 'desc(A1)'
@@ -509,13 +543,19 Predecessors template should the predece
509 543 | semi-colon: 1:471f378eab4c
510 544 | json: ["471f378eab4c5e25f6c77f785b27c936efb22874"]
511 545 | map: 1:471f378eab4c5e25f6c77f785b27c936efb22874
546 | Successors: 4:019fadeab383
547 | multi-line: 4:019fadeab383
548 | json: [["019fadeab383f6699fa83ad7bdb4d82ed2c0e5ab"]]
512 549 | @ fdf9bde5129a
513 550 |/ Predecessors: 1:471f378eab4c
514 551 | semi-colon: 1:471f378eab4c
515 552 | json: ["471f378eab4c5e25f6c77f785b27c936efb22874"]
516 553 | map: 1:471f378eab4c5e25f6c77f785b27c936efb22874
517 554 | x 471f378eab4c
518 |/
555 |/ Successors: 2:fdf9bde5129a; 3:65b757b745b9
556 | multi-line: 2:fdf9bde5129a
557 | multi-line: 3:65b757b745b9
558 | json: [["fdf9bde5129a28d4548fadd3f62b265cdd3b7a2e"], ["65b757b745b935093c87a2bccd877521cccffcbd"]]
519 559 o ea207398892e
520 560
521 561
@@ -609,7 +649,9 Predecessors template should show curren
609 649 | json: ["471f378eab4c5e25f6c77f785b27c936efb22874"]
610 650 | map: 1:471f378eab4c5e25f6c77f785b27c936efb22874
611 651 | @ 471f378eab4c
612 |/
652 |/ Successors: 4:eb5a0daa2192
653 | multi-line: 4:eb5a0daa2192
654 | json: [["eb5a0daa21923bbf8caeb2c42085b9e463861fd0"]]
613 655 o ea207398892e
614 656
615 657 $ hg up 'desc(B0)' --hidden
@@ -623,9 +665,13 Predecessors template should both predec
623 665 | json: ["0dec01379d3be6318c470ead31b1fe7ae7cb53d5", "471f378eab4c5e25f6c77f785b27c936efb22874"]
624 666 | map: 2:0dec01379d3be6318c470ead31b1fe7ae7cb53d5 1:471f378eab4c5e25f6c77f785b27c936efb22874
625 667 | @ 0dec01379d3b
626 | |
668 | | Successors: 4:eb5a0daa2192
669 | | multi-line: 4:eb5a0daa2192
670 | | json: [["eb5a0daa21923bbf8caeb2c42085b9e463861fd0"]]
627 671 | x 471f378eab4c
628 |/
672 |/ Successors: 4:eb5a0daa2192
673 | multi-line: 4:eb5a0daa2192
674 | json: [["eb5a0daa21923bbf8caeb2c42085b9e463861fd0"]]
629 675 o ea207398892e
630 676
631 677 $ hg up 'desc(B1)' --hidden
@@ -639,9 +685,13 Predecessors template should both predec
639 685 | json: ["471f378eab4c5e25f6c77f785b27c936efb22874", "b7ea6d14e664bdc8922221f7992631b50da3fb07"]
640 686 | map: 1:471f378eab4c5e25f6c77f785b27c936efb22874 3:b7ea6d14e664bdc8922221f7992631b50da3fb07
641 687 | @ b7ea6d14e664
642 | |
688 | | Successors: 4:eb5a0daa2192
689 | | multi-line: 4:eb5a0daa2192
690 | | json: [["eb5a0daa21923bbf8caeb2c42085b9e463861fd0"]]
643 691 | x 471f378eab4c
644 |/
692 |/ Successors: 4:eb5a0daa2192
693 | multi-line: 4:eb5a0daa2192
694 | json: [["eb5a0daa21923bbf8caeb2c42085b9e463861fd0"]]
645 695 o ea207398892e
646 696
647 697 $ hg up 'desc(C0)'
@@ -666,10 +716,17 with --hidden
666 716 | | semi-colon: 2:0dec01379d3b
667 717 | | json: ["0dec01379d3be6318c470ead31b1fe7ae7cb53d5"]
668 718 | | map: 2:0dec01379d3be6318c470ead31b1fe7ae7cb53d5
719 | | Successors: 4:eb5a0daa2192
720 | | multi-line: 4:eb5a0daa2192
721 | | json: [["eb5a0daa21923bbf8caeb2c42085b9e463861fd0"]]
669 722 | | x 0dec01379d3b
670 | |/
723 | |/ Successors: 3:b7ea6d14e664
724 | | multi-line: 3:b7ea6d14e664
725 | | json: [["b7ea6d14e664bdc8922221f7992631b50da3fb07"]]
671 726 | x 471f378eab4c
672 |/
727 |/ Successors: 4:eb5a0daa2192
728 | multi-line: 4:eb5a0daa2192
729 | json: [["eb5a0daa21923bbf8caeb2c42085b9e463861fd0"]]
673 730 o ea207398892e
674 731
675 732
@@ -771,7 +828,9 Predecessors template should show curren
771 828 | json: ["471f378eab4c5e25f6c77f785b27c936efb22874"]
772 829 | map: 1:471f378eab4c5e25f6c77f785b27c936efb22874
773 830 | @ 471f378eab4c
774 |/
831 |/ Successors: 2:7a230b46bf61
832 | multi-line: 2:7a230b46bf61
833 | json: [["7a230b46bf61e50b30308c6cfd7bd1269ef54702"]]
775 834 o ea207398892e
776 835
777 836 $ hg up 'desc(A2)'
@@ -792,7 +851,9 with --hidden
792 851 | json: ["471f378eab4c5e25f6c77f785b27c936efb22874"]
793 852 | map: 1:471f378eab4c5e25f6c77f785b27c936efb22874
794 853 | x 471f378eab4c
795 |/
854 |/ Successors: 2:7a230b46bf61
855 | multi-line: 2:7a230b46bf61
856 | json: [["7a230b46bf61e50b30308c6cfd7bd1269ef54702"]]
796 857 o ea207398892e
797 858
798 859
@@ -840,11 +901,18 Check templates
840 901 | | semi-colon: 1:471f378eab4c
841 902 | | json: ["471f378eab4c5e25f6c77f785b27c936efb22874"]
842 903 | | map: 1:471f378eab4c5e25f6c77f785b27c936efb22874
904 | | Successors: 3:f897c6137566; 1:471f378eab4c
905 | | multi-line: 3:f897c6137566
906 | | multi-line: 1:471f378eab4c
907 | | json: [["f897c6137566320b081514b4c7227ecc3d384b39"], ["471f378eab4c5e25f6c77f785b27c936efb22874"]]
843 908 | x 471f378eab4c
844 909 |/ Predecessors: 2:0dec01379d3b
845 910 | semi-colon: 2:0dec01379d3b
846 911 | json: ["0dec01379d3be6318c470ead31b1fe7ae7cb53d5"]
847 912 | map: 2:0dec01379d3be6318c470ead31b1fe7ae7cb53d5
913 | Successors: 2:0dec01379d3b
914 | multi-line: 2:0dec01379d3b
915 | json: [["0dec01379d3be6318c470ead31b1fe7ae7cb53d5"]]
848 916 o ea207398892e
849 917
850 918
@@ -880,11 +948,18 Check templates
880 948 | | semi-colon: 1:471f378eab4c
881 949 | | json: ["471f378eab4c5e25f6c77f785b27c936efb22874"]
882 950 | | map: 1:471f378eab4c5e25f6c77f785b27c936efb22874
951 | | Successors: 3:f897c6137566; 1:471f378eab4c
952 | | multi-line: 3:f897c6137566
953 | | multi-line: 1:471f378eab4c
954 | | json: [["f897c6137566320b081514b4c7227ecc3d384b39"], ["471f378eab4c5e25f6c77f785b27c936efb22874"]]
883 955 | x 471f378eab4c
884 956 |/ Predecessors: 2:0dec01379d3b
885 957 | semi-colon: 2:0dec01379d3b
886 958 | json: ["0dec01379d3be6318c470ead31b1fe7ae7cb53d5"]
887 959 | map: 2:0dec01379d3be6318c470ead31b1fe7ae7cb53d5
960 | Successors: 2:0dec01379d3b
961 | multi-line: 2:0dec01379d3b
962 | json: [["0dec01379d3be6318c470ead31b1fe7ae7cb53d5"]]
888 963 @ ea207398892e
889 964
890 965 Test template with split + divergence with cycles
@@ -1060,7 +1135,10 Check templates
1060 1135 | o ba2ed02b0c9a
1061 1136 | |
1062 1137 | x 4a004186e638
1063 |/
1138 |/ Successors: 8:b18bc8331526; 9:0b997eb7ceee
1139 | multi-line: 8:b18bc8331526
1140 | multi-line: 9:0b997eb7ceee
1141 | json: [["b18bc8331526a22cbb1801022bd1555bf291c48b"], ["0b997eb7ceeee06200a02f8aab185979092d514e"]]
1064 1142 o dd800401bd8c
1065 1143 |
1066 1144 o f897c6137566
@@ -1088,13 +1166,19 Check templates
1088 1166 | semi-colon: 4:9bd10a0775e4
1089 1167 | json: ["9bd10a0775e478708cada5f176ec6de654359ce7"]
1090 1168 | map: 4:9bd10a0775e478708cada5f176ec6de654359ce7
1169 | Successors: 8:b18bc8331526; 9:0b997eb7ceee
1170 | multi-line: 8:b18bc8331526
1171 | multi-line: 9:0b997eb7ceee
1172 | json: [["b18bc8331526a22cbb1801022bd1555bf291c48b"], ["0b997eb7ceeee06200a02f8aab185979092d514e"]]
1091 1173 o dd800401bd8c
1092 1174 | Predecessors: 4:9bd10a0775e4
1093 1175 | semi-colon: 4:9bd10a0775e4
1094 1176 | json: ["9bd10a0775e478708cada5f176ec6de654359ce7"]
1095 1177 | map: 4:9bd10a0775e478708cada5f176ec6de654359ce7
1096 1178 | x 9bd10a0775e4
1097 |/
1179 |/ Successors: 5:dd800401bd8c 6:4a004186e638 7:ba2ed02b0c9a
1180 | multi-line: 5:dd800401bd8c 6:4a004186e638 7:ba2ed02b0c9a
1181 | json: [["dd800401bd8c79d815329277739e433e883f784e", "4a004186e63889f20cb16434fcbd72220bd1eace", "ba2ed02b0c9a56b9fdbc4e79c7e57866984d8a1f"]]
1098 1182 o f897c6137566
1099 1183 | Predecessors: 2:0dec01379d3b
1100 1184 | semi-colon: 2:0dec01379d3b
@@ -1105,11 +1189,18 Check templates
1105 1189 | | semi-colon: 1:471f378eab4c
1106 1190 | | json: ["471f378eab4c5e25f6c77f785b27c936efb22874"]
1107 1191 | | map: 1:471f378eab4c5e25f6c77f785b27c936efb22874
1192 | | Successors: 3:f897c6137566; 1:471f378eab4c
1193 | | multi-line: 3:f897c6137566
1194 | | multi-line: 1:471f378eab4c
1195 | | json: [["f897c6137566320b081514b4c7227ecc3d384b39"], ["471f378eab4c5e25f6c77f785b27c936efb22874"]]
1108 1196 | x 471f378eab4c
1109 1197 |/ Predecessors: 2:0dec01379d3b
1110 1198 | semi-colon: 2:0dec01379d3b
1111 1199 | json: ["0dec01379d3be6318c470ead31b1fe7ae7cb53d5"]
1112 1200 | map: 2:0dec01379d3be6318c470ead31b1fe7ae7cb53d5
1201 | Successors: 2:0dec01379d3b
1202 | multi-line: 2:0dec01379d3b
1203 | json: [["0dec01379d3be6318c470ead31b1fe7ae7cb53d5"]]
1113 1204 o ea207398892e
1114 1205
1115 1206 $ hg up --hidden 4
@@ -1138,7 +1229,10 Check templates
1138 1229 | json: ["9bd10a0775e478708cada5f176ec6de654359ce7"]
1139 1230 | map: 4:9bd10a0775e478708cada5f176ec6de654359ce7
1140 1231 | @ 9bd10a0775e4
1141 |/
1232 |/ Successors: 5:dd800401bd8c 9:0b997eb7ceee 10:eceed8f98ffc; 5:dd800401bd8c 8:b18bc8331526 10:eceed8f98ffc
1233 | multi-line: 5:dd800401bd8c 9:0b997eb7ceee 10:eceed8f98ffc
1234 | multi-line: 5:dd800401bd8c 8:b18bc8331526 10:eceed8f98ffc
1235 | json: [["dd800401bd8c79d815329277739e433e883f784e", "0b997eb7ceeee06200a02f8aab185979092d514e", "eceed8f98ffc4186032e29a6542ab98888ebf68d"], ["dd800401bd8c79d815329277739e433e883f784e", "b18bc8331526a22cbb1801022bd1555bf291c48b", "eceed8f98ffc4186032e29a6542ab98888ebf68d"]]
1142 1236 o f897c6137566
1143 1237 |
1144 1238 o ea207398892e
General Comments 0
You need to be logged in to leave comments. Login now