##// END OF EJS Templates
template: compute dates in obsfatedate...
Boris Feld -
r33997:c35c0f54 default
parent child Browse files
Show More
@@ -602,6 +602,11 b' def successorsetverb(successorset):'
602 verb = 'split'
602 verb = 'split'
603 return verb
603 return verb
604
604
605 def markersdates(markers):
606 """returns the list of dates for a list of markers
607 """
608 return [m[4] for m in markers]
609
605 def markersusers(markers):
610 def markersusers(markers):
606 """ Returns a sorted list of markers users without duplicates
611 """ Returns a sorted list of markers users without duplicates
607 """
612 """
@@ -840,6 +840,34 b' def localdate(context, mapping, args):'
840 tzoffset = util.makedate()[1]
840 tzoffset = util.makedate()[1]
841 return (date[0], tzoffset)
841 return (date[0], tzoffset)
842
842
843 @templatefunc('max(iterable)')
844 def max_(context, mapping, args, **kwargs):
845 """Return the max of an iterable"""
846 if len(args) != 1:
847 # i18n: "max" is a keyword
848 raise error.ParseError(_("max expects one arguments"))
849
850 iterable = evalfuncarg(context, mapping, args[0])
851 try:
852 return max(iterable)
853 except (TypeError, ValueError):
854 # i18n: "max" is a keyword
855 raise error.ParseError(_("max first argument should be an iterable"))
856
857 @templatefunc('min(iterable)')
858 def min_(context, mapping, args, **kwargs):
859 """Return the min of an iterable"""
860 if len(args) != 1:
861 # i18n: "min" is a keyword
862 raise error.ParseError(_("min expects one arguments"))
863
864 iterable = evalfuncarg(context, mapping, args[0])
865 try:
866 return min(iterable)
867 except (TypeError, ValueError):
868 # i18n: "min" is a keyword
869 raise error.ParseError(_("min first argument should be an iterable"))
870
843 @templatefunc('mod(a, b)')
871 @templatefunc('mod(a, b)')
844 def mod(context, mapping, args):
872 def mod(context, mapping, args):
845 """Calculate a mod b such that a / b + a mod b == a"""
873 """Calculate a mod b such that a / b + a mod b == a"""
@@ -850,6 +878,23 b' def mod(context, mapping, args):'
850 func = lambda a, b: a % b
878 func = lambda a, b: a % b
851 return runarithmetic(context, mapping, (func, args[0], args[1]))
879 return runarithmetic(context, mapping, (func, args[0], args[1]))
852
880
881 @templatefunc('obsfatedate(markers)')
882 def obsfatedate(context, mapping, args):
883 """Compute obsfate related information based on markers (EXPERIMENTAL)"""
884 if len(args) != 1:
885 # i18n: "obsfatedate" is a keyword
886 raise error.ParseError(_("obsfatedate expects one arguments"))
887
888 markers = evalfuncarg(context, mapping, args[0])
889
890 try:
891 data = obsutil.markersdates(markers)
892 return templatekw.hybridlist(data, name='date', fmt='%d %d')
893 except (TypeError, KeyError):
894 # i18n: "obsfatedate" is a keyword
895 errmsg = _("obsfatedate first argument should be an iterable")
896 raise error.ParseError(errmsg)
897
853 @templatefunc('obsfateusers(markers)')
898 @templatefunc('obsfateusers(markers)')
854 def obsfateusers(context, mapping, args):
899 def obsfateusers(context, mapping, args):
855 """Compute obsfate related information based on markers (EXPERIMENTAL)"""
900 """Compute obsfate related information based on markers (EXPERIMENTAL)"""
@@ -15,7 +15,8 b' Global setup'
15 > obsfatesuccessors = " as {join(successors, ", ")}"
15 > obsfatesuccessors = " as {join(successors, ", ")}"
16 > obsfateverb = "{obsfateverb(successors)}"
16 > obsfateverb = "{obsfateverb(successors)}"
17 > obsfateusers = "{if(obsfateusers(markers), " by {join(obsfateusers(markers), ", ")}")}"
17 > obsfateusers = "{if(obsfateusers(markers), " by {join(obsfateusers(markers), ", ")}")}"
18 > obsfate = "{obsfateverb}{obsfatesuccessors}{obsfateusers}; "
18 > obsfatedate = "{if(obsfatedate(markers), "{ifeq(min(obsfatedate(markers)), max(obsfatedate(markers)), " (at {min(obsfatedate(markers))|isodate})", " (between {min(obsfatedate(markers))|isodate} and {max(obsfatedate(markers))|isodate})")}")}"
19 > obsfate = "{obsfateverb}{obsfatesuccessors}{obsfateusers}{obsfatedate}; "
19 > [alias]
20 > [alias]
20 > tlog = log -G -T '{node|short}\
21 > tlog = log -G -T '{node|short}\
21 > {if(predecessors, "\n Predecessors: {predecessors}")}\
22 > {if(predecessors, "\n Predecessors: {predecessors}")}\
@@ -94,21 +95,21 b' Predecessors template should show curren'
94 o d004c8f274b9
95 o d004c8f274b9
95 |
96 |
96 | @ 471f378eab4c
97 | @ 471f378eab4c
97 |/ Obsfate: rewritten as 4:d004c8f274b9 by test1, test2;
98 |/ Obsfate: rewritten as 4:d004c8f274b9 by test1, test2 (between 2001-04-19 04:25 +0000 and 2009-02-13 23:31 +0000);
98 o ea207398892e
99 o ea207398892e
99
100
100 $ hg fatelog
101 $ hg fatelog
101 o d004c8f274b9
102 o d004c8f274b9
102 |
103 |
103 | @ 471f378eab4c
104 | @ 471f378eab4c
104 |/ Obsfate: rewritten as 4:d004c8f274b9 by test1, test2;
105 |/ Obsfate: rewritten as 4:d004c8f274b9 by test1, test2 (between 2001-04-19 04:25 +0000 and 2009-02-13 23:31 +0000);
105 o ea207398892e
106 o ea207398892e
106
107
107 $ hg fatelog -v
108 $ hg fatelog -v
108 o d004c8f274b9
109 o d004c8f274b9
109 |
110 |
110 | @ 471f378eab4c
111 | @ 471f378eab4c
111 |/ Obsfate: rewritten as 4:d004c8f274b9 by test1, test2;
112 |/ Obsfate: rewritten as 4:d004c8f274b9 by test1, test2 (between 2001-04-19 04:25 +0000 and 2009-02-13 23:31 +0000);
112 o ea207398892e
113 o ea207398892e
113
114
114 $ hg up 'desc(A1)' --hidden
115 $ hg up 'desc(A1)' --hidden
@@ -131,7 +132,7 b' Predecessors template should show curren'
131 o d004c8f274b9
132 o d004c8f274b9
132 |
133 |
133 | @ a468dc9b3633
134 | @ a468dc9b3633
134 |/ Obsfate: rewritten as 4:d004c8f274b9 by test2;
135 |/ Obsfate: rewritten as 4:d004c8f274b9 by test2 (at 2001-04-19 04:25 +0000);
135 o ea207398892e
136 o ea207398892e
136
137
137 Predecessors template should show all the predecessors as we force their display
138 Predecessors template should show all the predecessors as we force their display
@@ -162,11 +163,11 b' with --hidden'
162 o d004c8f274b9
163 o d004c8f274b9
163 |
164 |
164 | @ a468dc9b3633
165 | @ a468dc9b3633
165 |/ Obsfate: rewritten as 4:d004c8f274b9 by test2;
166 |/ Obsfate: rewritten as 4:d004c8f274b9 by test2 (at 2001-04-19 04:25 +0000);
166 | x f137d23bb3e1
167 | x f137d23bb3e1
167 | |
168 | |
168 | x 471f378eab4c
169 | x 471f378eab4c
169 |/ Obsfate: rewritten as 3:a468dc9b3633 by test1;
170 |/ Obsfate: rewritten as 3:a468dc9b3633 by test1 (at 2009-02-13 23:31 +0000);
170 o ea207398892e
171 o ea207398892e
171
172
172
173
@@ -211,11 +212,11 b' visible.'
211 @ d004c8f274b9
212 @ d004c8f274b9
212 |
213 |
213 | x a468dc9b3633
214 | x a468dc9b3633
214 |/ Obsfate: rewritten as 4:d004c8f274b9 by test2;
215 |/ Obsfate: rewritten as 4:d004c8f274b9 by test2 (at 2001-04-19 04:25 +0000);
215 | x f137d23bb3e1
216 | x f137d23bb3e1
216 | |
217 | |
217 | x 471f378eab4c
218 | x 471f378eab4c
218 |/ Obsfate: rewritten as 3:a468dc9b3633 by test1;
219 |/ Obsfate: rewritten as 3:a468dc9b3633 by test1 (at 2009-02-13 23:31 +0000);
219 o ea207398892e
220 o ea207398892e
220
221
221 $ hg fatelogjson --hidden
222 $ hg fatelogjson --hidden
@@ -319,7 +320,7 b' Predecessors template should show curren'
319 o 337fec4d2edc
320 o 337fec4d2edc
320 |
321 |
321 | @ 471597cad322
322 | @ 471597cad322
322 |/ Obsfate: split as 2:337fec4d2edc, 3:f257fde29c7a by test;
323 |/ Obsfate: split as 2:337fec4d2edc, 3:f257fde29c7a by test (at 1970-01-01 00:00 +0000);
323 o ea207398892e
324 o ea207398892e
324
325
325 $ hg up f257fde29c7a
326 $ hg up f257fde29c7a
@@ -360,7 +361,7 b' with --hidden'
360 o 337fec4d2edc
361 o 337fec4d2edc
361 |
362 |
362 | x 471597cad322
363 | x 471597cad322
363 |/ Obsfate: split as 2:337fec4d2edc, 3:f257fde29c7a by test;
364 |/ Obsfate: split as 2:337fec4d2edc, 3:f257fde29c7a by test (at 1970-01-01 00:00 +0000);
364 o ea207398892e
365 o ea207398892e
365
366
366 $ hg fatelogjson --hidden
367 $ hg fatelogjson --hidden
@@ -461,7 +462,7 b' Predecessors template should show curren'
461 o eb5a0daa2192
462 o eb5a0daa2192
462 |
463 |
463 | @ 471f378eab4c
464 | @ 471f378eab4c
464 |/ Obsfate: rewritten as 3:eb5a0daa2192 by test;
465 |/ Obsfate: rewritten as 3:eb5a0daa2192 by test (at 1970-01-01 00:00 +0000);
465 o ea207398892e
466 o ea207398892e
466
467
467 $ hg up 'desc(B0)' --hidden
468 $ hg up 'desc(B0)' --hidden
@@ -490,9 +491,9 b' displayed'
490 o eb5a0daa2192
491 o eb5a0daa2192
491 |
492 |
492 | @ 0dec01379d3b
493 | @ 0dec01379d3b
493 | | Obsfate: rewritten as 3:eb5a0daa2192 by test;
494 | | Obsfate: rewritten as 3:eb5a0daa2192 by test (at 1970-01-01 00:00 +0000);
494 | x 471f378eab4c
495 | x 471f378eab4c
495 |/ Obsfate: rewritten as 3:eb5a0daa2192 by test;
496 |/ Obsfate: rewritten as 3:eb5a0daa2192 by test (at 1970-01-01 00:00 +0000);
496 o ea207398892e
497 o ea207398892e
497
498
498 $ hg up 'desc(C0)'
499 $ hg up 'desc(C0)'
@@ -528,9 +529,9 b' with --hidden'
528 @ eb5a0daa2192
529 @ eb5a0daa2192
529 |
530 |
530 | x 0dec01379d3b
531 | x 0dec01379d3b
531 | | Obsfate: rewritten as 3:eb5a0daa2192 by test;
532 | | Obsfate: rewritten as 3:eb5a0daa2192 by test (at 1970-01-01 00:00 +0000);
532 | x 471f378eab4c
533 | x 471f378eab4c
533 |/ Obsfate: rewritten as 3:eb5a0daa2192 by test;
534 |/ Obsfate: rewritten as 3:eb5a0daa2192 by test (at 1970-01-01 00:00 +0000);
534 o ea207398892e
535 o ea207398892e
535
536
536
537
@@ -667,7 +668,7 b' Predecessors template should show curren'
667 | o fdf9bde5129a
668 | o fdf9bde5129a
668 |/
669 |/
669 | @ 471f378eab4c
670 | @ 471f378eab4c
670 |/ Obsfate: rewritten as 2:fdf9bde5129a by test; rewritten as 4:019fadeab383 by test;
671 |/ Obsfate: rewritten as 2:fdf9bde5129a by test (at 1970-01-01 00:00 +0000); rewritten as 4:019fadeab383 by test (at 1970-01-01 00:00 +0000);
671 o ea207398892e
672 o ea207398892e
672
673
673 $ hg up 'desc(A1)'
674 $ hg up 'desc(A1)'
@@ -723,11 +724,11 b' Predecessors template should the predece'
723 o 019fadeab383
724 o 019fadeab383
724 |
725 |
725 | x 65b757b745b9
726 | x 65b757b745b9
726 |/ Obsfate: rewritten as 4:019fadeab383 by test;
727 |/ Obsfate: rewritten as 4:019fadeab383 by test (at 1970-01-01 00:00 +0000);
727 | @ fdf9bde5129a
728 | @ fdf9bde5129a
728 |/
729 |/
729 | x 471f378eab4c
730 | x 471f378eab4c
730 |/ Obsfate: rewritten as 2:fdf9bde5129a by test; rewritten as 3:65b757b745b9 by test;
731 |/ Obsfate: rewritten as 2:fdf9bde5129a by test (at 1970-01-01 00:00 +0000); rewritten as 3:65b757b745b9 by test (at 1970-01-01 00:00 +0000);
731 o ea207398892e
732 o ea207398892e
732
733
733
734
@@ -845,7 +846,7 b' Predecessors template should show curren'
845 o eb5a0daa2192
846 o eb5a0daa2192
846 |
847 |
847 | @ 471f378eab4c
848 | @ 471f378eab4c
848 |/ Obsfate: rewritten as 4:eb5a0daa2192 by test;
849 |/ Obsfate: rewritten as 4:eb5a0daa2192 by test (at 1970-01-01 00:00 +0000);
849 o ea207398892e
850 o ea207398892e
850
851
851 $ hg up 'desc(B0)' --hidden
852 $ hg up 'desc(B0)' --hidden
@@ -873,9 +874,9 b' Predecessors template should both predec'
873 o eb5a0daa2192
874 o eb5a0daa2192
874 |
875 |
875 | @ 0dec01379d3b
876 | @ 0dec01379d3b
876 | | Obsfate: rewritten as 4:eb5a0daa2192 by test;
877 | | Obsfate: rewritten as 4:eb5a0daa2192 by test (at 1970-01-01 00:00 +0000);
877 | x 471f378eab4c
878 | x 471f378eab4c
878 |/ Obsfate: rewritten as 4:eb5a0daa2192 by test;
879 |/ Obsfate: rewritten as 4:eb5a0daa2192 by test (at 1970-01-01 00:00 +0000);
879 o ea207398892e
880 o ea207398892e
880
881
881 $ hg up 'desc(B1)' --hidden
882 $ hg up 'desc(B1)' --hidden
@@ -903,9 +904,9 b' Predecessors template should both predec'
903 o eb5a0daa2192
904 o eb5a0daa2192
904 |
905 |
905 | @ b7ea6d14e664
906 | @ b7ea6d14e664
906 | | Obsfate: rewritten as 4:eb5a0daa2192 by test;
907 | | Obsfate: rewritten as 4:eb5a0daa2192 by test (at 1970-01-01 00:00 +0000);
907 | x 471f378eab4c
908 | x 471f378eab4c
908 |/ Obsfate: rewritten as 4:eb5a0daa2192 by test;
909 |/ Obsfate: rewritten as 4:eb5a0daa2192 by test (at 1970-01-01 00:00 +0000);
909 o ea207398892e
910 o ea207398892e
910
911
911 $ hg up 'desc(C0)'
912 $ hg up 'desc(C0)'
@@ -954,11 +955,11 b' with --hidden'
954 @ eb5a0daa2192
955 @ eb5a0daa2192
955 |
956 |
956 | x b7ea6d14e664
957 | x b7ea6d14e664
957 | | Obsfate: rewritten as 4:eb5a0daa2192 by test;
958 | | Obsfate: rewritten as 4:eb5a0daa2192 by test (at 1970-01-01 00:00 +0000);
958 | | x 0dec01379d3b
959 | | x 0dec01379d3b
959 | |/ Obsfate: rewritten as 3:b7ea6d14e664 by test;
960 | |/ Obsfate: rewritten as 3:b7ea6d14e664 by test (at 1970-01-01 00:00 +0000);
960 | x 471f378eab4c
961 | x 471f378eab4c
961 |/ Obsfate: rewritten as 4:eb5a0daa2192 by test;
962 |/ Obsfate: rewritten as 4:eb5a0daa2192 by test (at 1970-01-01 00:00 +0000);
962 o ea207398892e
963 o ea207398892e
963
964
964
965
@@ -1082,7 +1083,7 b' Predecessors template should show curren'
1082 o 7a230b46bf61
1083 o 7a230b46bf61
1083 |
1084 |
1084 | @ 471f378eab4c
1085 | @ 471f378eab4c
1085 |/ Obsfate: rewritten as 2:7a230b46bf61 by test;
1086 |/ Obsfate: rewritten as 2:7a230b46bf61 by test (at 1970-01-01 00:00 +0000);
1086 o ea207398892e
1087 o ea207398892e
1087
1088
1088 $ hg up 'desc(A2)'
1089 $ hg up 'desc(A2)'
@@ -1119,7 +1120,7 b' with --hidden'
1119 @ 7a230b46bf61
1120 @ 7a230b46bf61
1120 |
1121 |
1121 | x 471f378eab4c
1122 | x 471f378eab4c
1122 |/ Obsfate: rewritten as 2:7a230b46bf61 by test;
1123 |/ Obsfate: rewritten as 2:7a230b46bf61 by test (at 1970-01-01 00:00 +0000);
1123 o ea207398892e
1124 o ea207398892e
1124
1125
1125
1126
@@ -1194,9 +1195,9 b' Check templates'
1194 o f897c6137566
1195 o f897c6137566
1195 |
1196 |
1196 | @ 0dec01379d3b
1197 | @ 0dec01379d3b
1197 | | Obsfate: rewritten as 3:f897c6137566 by test; rewritten as 1:471f378eab4c by test;
1198 | | Obsfate: rewritten as 3:f897c6137566 by test (at 1970-01-01 00:00 +0000); rewritten as 1:471f378eab4c by test (at 1970-01-01 00:00 +0000);
1198 | x 471f378eab4c
1199 | x 471f378eab4c
1199 |/ Obsfate: rewritten as 2:0dec01379d3b by test;
1200 |/ Obsfate: rewritten as 2:0dec01379d3b by test (at 1970-01-01 00:00 +0000);
1200 o ea207398892e
1201 o ea207398892e
1201
1202
1202
1203
@@ -1452,7 +1453,7 b' Check templates'
1452 | o ba2ed02b0c9a
1453 | o ba2ed02b0c9a
1453 | |
1454 | |
1454 | x 4a004186e638
1455 | x 4a004186e638
1455 |/ Obsfate: rewritten as 8:b18bc8331526 by test; rewritten as 9:0b997eb7ceee by test;
1456 |/ Obsfate: rewritten as 8:b18bc8331526 by test (at 1970-01-01 00:00 +0000); rewritten as 9:0b997eb7ceee by test (at 1970-01-01 00:00 +0000);
1456 o dd800401bd8c
1457 o dd800401bd8c
1457 |
1458 |
1458 o f897c6137566
1459 o f897c6137566
@@ -1525,17 +1526,17 b' Check templates'
1525 | o ba2ed02b0c9a
1526 | o ba2ed02b0c9a
1526 | |
1527 | |
1527 | x 4a004186e638
1528 | x 4a004186e638
1528 |/ Obsfate: rewritten as 8:b18bc8331526 by test; rewritten as 9:0b997eb7ceee by test;
1529 |/ Obsfate: rewritten as 8:b18bc8331526 by test (at 1970-01-01 00:00 +0000); rewritten as 9:0b997eb7ceee by test (at 1970-01-01 00:00 +0000);
1529 o dd800401bd8c
1530 o dd800401bd8c
1530 |
1531 |
1531 | x 9bd10a0775e4
1532 | x 9bd10a0775e4
1532 |/ Obsfate: split as 5:dd800401bd8c, 6:4a004186e638, 7:ba2ed02b0c9a by test;
1533 |/ Obsfate: split as 5:dd800401bd8c, 6:4a004186e638, 7:ba2ed02b0c9a by test (at 1970-01-01 00:00 +0000);
1533 o f897c6137566
1534 o f897c6137566
1534 |
1535 |
1535 | x 0dec01379d3b
1536 | x 0dec01379d3b
1536 | | Obsfate: rewritten as 3:f897c6137566 by test; rewritten as 1:471f378eab4c by test;
1537 | | Obsfate: rewritten as 3:f897c6137566 by test (at 1970-01-01 00:00 +0000); rewritten as 1:471f378eab4c by test (at 1970-01-01 00:00 +0000);
1537 | x 471f378eab4c
1538 | x 471f378eab4c
1538 |/ Obsfate: rewritten as 2:0dec01379d3b by test;
1539 |/ Obsfate: rewritten as 2:0dec01379d3b by test (at 1970-01-01 00:00 +0000);
1539 o ea207398892e
1540 o ea207398892e
1540
1541
1541 $ hg fatelogjson --hidden
1542 $ hg fatelogjson --hidden
@@ -1604,7 +1605,7 b' Check templates'
1604 o dd800401bd8c
1605 o dd800401bd8c
1605 |
1606 |
1606 | @ 9bd10a0775e4
1607 | @ 9bd10a0775e4
1607 |/ Obsfate: split as 5:dd800401bd8c, 9:0b997eb7ceee, 10:eceed8f98ffc by test; split as 5:dd800401bd8c, 8:b18bc8331526, 10:eceed8f98ffc by test;
1608 |/ Obsfate: split as 5:dd800401bd8c, 9:0b997eb7ceee, 10:eceed8f98ffc by test (at 1970-01-01 00:00 +0000); split as 5:dd800401bd8c, 8:b18bc8331526, 10:eceed8f98ffc by test (at 1970-01-01 00:00 +0000);
1608 o f897c6137566
1609 o f897c6137566
1609 |
1610 |
1610 o ea207398892e
1611 o ea207398892e
General Comments 0
You need to be logged in to leave comments. Login now