##// END OF EJS Templates
templates: introduce a obsfateoperation() function...
Martin von Zweigbergk -
r34288:7cdc8c5a default
parent child Browse files
Show More
@@ -646,3 +646,12 b' def markersusers(markers):'
646 users = set(meta.get('user') for meta in markersmeta if meta.get('user'))
646 users = set(meta.get('user') for meta in markersmeta if meta.get('user'))
647
647
648 return sorted(users)
648 return sorted(users)
649
650 def markersoperations(markers):
651 """ Returns a sorted list of markers operations without duplicates
652 """
653 markersmeta = [dict(m[3]) for m in markers]
654 operations = set(meta.get('operation') for meta in markersmeta
655 if meta.get('operation'))
656
657 return sorted(operations)
@@ -878,6 +878,23 b' def mod(context, mapping, args):'
878 func = lambda a, b: a % b
878 func = lambda a, b: a % b
879 return runarithmetic(context, mapping, (func, args[0], args[1]))
879 return runarithmetic(context, mapping, (func, args[0], args[1]))
880
880
881 @templatefunc('obsfateoperations(markers)')
882 def obsfateoperations(context, mapping, args):
883 """Compute obsfate related information based on markers (EXPERIMENTAL)"""
884 if len(args) != 1:
885 # i18n: "obsfateoperations" is a keyword
886 raise error.ParseError(_("obsfateoperations expects one arguments"))
887
888 markers = evalfuncarg(context, mapping, args[0])
889
890 try:
891 data = obsutil.markersoperations(markers)
892 return templatekw.hybridlist(data, name='operation')
893 except (TypeError, KeyError):
894 # i18n: "obsfateoperations" is a keyword
895 errmsg = _("obsfateoperations first argument should be an iterable")
896 raise error.ParseError(errmsg)
897
881 @templatefunc('obsfatedate(markers)')
898 @templatefunc('obsfatedate(markers)')
882 def obsfatedate(context, mapping, args):
899 def obsfatedate(context, mapping, args):
883 """Compute obsfate related information based on markers (EXPERIMENTAL)"""
900 """Compute obsfate related information based on markers (EXPERIMENTAL)"""
@@ -14,9 +14,10 b' Global setup'
14 > [templates]
14 > [templates]
15 > obsfatesuccessors = "{if(successors, " as ")}{join(successors, ", ")}"
15 > obsfatesuccessors = "{if(successors, " as ")}{join(successors, ", ")}"
16 > obsfateverb = "{obsfateverb(successors)}"
16 > obsfateverb = "{obsfateverb(successors)}"
17 > obsfateoperations = "{if(obsfateoperations(markers), " using {join(obsfateoperations(markers), ", ")}")}"
17 > obsfateusers = "{if(obsfateusers(markers), " by {join(obsfateusers(markers), ", ")}")}"
18 > obsfateusers = "{if(obsfateusers(markers), " by {join(obsfateusers(markers), ", ")}")}"
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 > 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}; "
20 > obsfate = "{obsfateverb}{obsfateoperations}{obsfatesuccessors}{obsfateusers}{obsfatedate}; "
20 > [alias]
21 > [alias]
21 > tlog = log -G -T '{node|short}\
22 > tlog = log -G -T '{node|short}\
22 > {if(predecessors, "\n Predecessors: {predecessors}")}\
23 > {if(predecessors, "\n Predecessors: {predecessors}")}\
@@ -90,21 +91,21 b' Predecessors template should show curren'
90 o d004c8f274b9
91 o d004c8f274b9
91 |
92 |
92 | @ 471f378eab4c
93 | @ 471f378eab4c
93 |/ Obsfate: rewritten as 3:d004c8f274b9 by test1, test2 (between 2001-04-19 04:25 +0000 and 2009-02-13 23:31 +0000);
94 |/ Obsfate: rewritten using amend as 3:d004c8f274b9 by test1, test2 (between 2001-04-19 04:25 +0000 and 2009-02-13 23:31 +0000);
94 o ea207398892e
95 o ea207398892e
95
96
96 $ hg fatelog
97 $ hg fatelog
97 o d004c8f274b9
98 o d004c8f274b9
98 |
99 |
99 | @ 471f378eab4c
100 | @ 471f378eab4c
100 |/ Obsfate: rewritten as 3:d004c8f274b9 by test1, test2 (between 2001-04-19 04:25 +0000 and 2009-02-13 23:31 +0000);
101 |/ Obsfate: rewritten using amend as 3:d004c8f274b9 by test1, test2 (between 2001-04-19 04:25 +0000 and 2009-02-13 23:31 +0000);
101 o ea207398892e
102 o ea207398892e
102
103
103 $ hg fatelog -v
104 $ hg fatelog -v
104 o d004c8f274b9
105 o d004c8f274b9
105 |
106 |
106 | @ 471f378eab4c
107 | @ 471f378eab4c
107 |/ Obsfate: rewritten as 3:d004c8f274b9 by test1, test2 (between 2001-04-19 04:25 +0000 and 2009-02-13 23:31 +0000);
108 |/ Obsfate: rewritten using amend as 3:d004c8f274b9 by test1, test2 (between 2001-04-19 04:25 +0000 and 2009-02-13 23:31 +0000);
108 o ea207398892e
109 o ea207398892e
109
110
110 $ hg up 'desc(A1)' --hidden
111 $ hg up 'desc(A1)' --hidden
@@ -127,7 +128,7 b' Predecessors template should show curren'
127 o d004c8f274b9
128 o d004c8f274b9
128 |
129 |
129 | @ a468dc9b3633
130 | @ a468dc9b3633
130 |/ Obsfate: rewritten as 3:d004c8f274b9 by test2 (at 2001-04-19 04:25 +0000);
131 |/ Obsfate: rewritten using amend as 3:d004c8f274b9 by test2 (at 2001-04-19 04:25 +0000);
131 o ea207398892e
132 o ea207398892e
132
133
133 Predecessors template should show all the predecessors as we force their display
134 Predecessors template should show all the predecessors as we force their display
@@ -156,9 +157,9 b' with --hidden'
156 o d004c8f274b9
157 o d004c8f274b9
157 |
158 |
158 | @ a468dc9b3633
159 | @ a468dc9b3633
159 |/ Obsfate: rewritten as 3:d004c8f274b9 by test2 (at 2001-04-19 04:25 +0000);
160 |/ Obsfate: rewritten using amend as 3:d004c8f274b9 by test2 (at 2001-04-19 04:25 +0000);
160 | x 471f378eab4c
161 | x 471f378eab4c
161 |/ Obsfate: rewritten as 2:a468dc9b3633 by test1 (at 2009-02-13 23:31 +0000);
162 |/ Obsfate: rewritten using amend as 2:a468dc9b3633 by test1 (at 2009-02-13 23:31 +0000);
162 o ea207398892e
163 o ea207398892e
163
164
164
165
@@ -201,9 +202,9 b' visible.'
201 @ d004c8f274b9
202 @ d004c8f274b9
202 |
203 |
203 | x a468dc9b3633
204 | x a468dc9b3633
204 |/ Obsfate: rewritten as 3:d004c8f274b9 by test2 (at 2001-04-19 04:25 +0000);
205 |/ Obsfate: rewritten using amend as 3:d004c8f274b9 by test2 (at 2001-04-19 04:25 +0000);
205 | x 471f378eab4c
206 | x 471f378eab4c
206 |/ Obsfate: rewritten as 2:a468dc9b3633 by test1 (at 2009-02-13 23:31 +0000);
207 |/ Obsfate: rewritten using amend as 2:a468dc9b3633 by test1 (at 2009-02-13 23:31 +0000);
207 o ea207398892e
208 o ea207398892e
208
209
209 $ hg fatelogjson --hidden
210 $ hg fatelogjson --hidden
@@ -653,7 +654,7 b' Predecessors template should show curren'
653 | o fdf9bde5129a
654 | o fdf9bde5129a
654 |/
655 |/
655 | @ 471f378eab4c
656 | @ 471f378eab4c
656 |/ 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);
657 |/ Obsfate: rewritten using amend as 2:fdf9bde5129a by test (at 1970-01-01 00:00 +0000); rewritten using amend as 4:019fadeab383 by test (at 1970-01-01 00:00 +0000);
657 o ea207398892e
658 o ea207398892e
658
659
659 $ hg up 'desc(A1)'
660 $ hg up 'desc(A1)'
@@ -709,11 +710,11 b' Predecessors template should the predece'
709 o 019fadeab383
710 o 019fadeab383
710 |
711 |
711 | x 65b757b745b9
712 | x 65b757b745b9
712 |/ Obsfate: rewritten as 4:019fadeab383 by test (at 1970-01-01 00:00 +0000);
713 |/ Obsfate: rewritten using amend as 4:019fadeab383 by test (at 1970-01-01 00:00 +0000);
713 | @ fdf9bde5129a
714 | @ fdf9bde5129a
714 |/
715 |/
715 | x 471f378eab4c
716 | x 471f378eab4c
716 |/ 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);
717 |/ Obsfate: rewritten using amend as 2:fdf9bde5129a by test (at 1970-01-01 00:00 +0000); rewritten using amend as 3:65b757b745b9 by test (at 1970-01-01 00:00 +0000);
717 o ea207398892e
718 o ea207398892e
718
719
719
720
@@ -859,7 +860,7 b' Predecessors template should both predec'
859 o eb5a0daa2192
860 o eb5a0daa2192
860 |
861 |
861 | @ 0dec01379d3b
862 | @ 0dec01379d3b
862 | | Obsfate: rewritten as 4:eb5a0daa2192 by test (at 1970-01-01 00:00 +0000);
863 | | Obsfate: rewritten using amend as 4:eb5a0daa2192 by test (at 1970-01-01 00:00 +0000);
863 | x 471f378eab4c
864 | x 471f378eab4c
864 |/ Obsfate: rewritten as 4:eb5a0daa2192 by test (at 1970-01-01 00:00 +0000);
865 |/ Obsfate: rewritten as 4:eb5a0daa2192 by test (at 1970-01-01 00:00 +0000);
865 o ea207398892e
866 o ea207398892e
@@ -942,7 +943,7 b' with --hidden'
942 | x b7ea6d14e664
943 | x b7ea6d14e664
943 | | Obsfate: rewritten as 4:eb5a0daa2192 by test (at 1970-01-01 00:00 +0000);
944 | | Obsfate: rewritten as 4:eb5a0daa2192 by test (at 1970-01-01 00:00 +0000);
944 | | x 0dec01379d3b
945 | | x 0dec01379d3b
945 | |/ Obsfate: rewritten as 3:b7ea6d14e664 by test (at 1970-01-01 00:00 +0000);
946 | |/ Obsfate: rewritten using amend as 3:b7ea6d14e664 by test (at 1970-01-01 00:00 +0000);
946 | x 471f378eab4c
947 | x 471f378eab4c
947 |/ Obsfate: rewritten as 4:eb5a0daa2192 by test (at 1970-01-01 00:00 +0000);
948 |/ Obsfate: rewritten as 4:eb5a0daa2192 by test (at 1970-01-01 00:00 +0000);
948 o ea207398892e
949 o ea207398892e
@@ -1068,7 +1069,7 b' Predecessors template should show curren'
1068 o 7a230b46bf61
1069 o 7a230b46bf61
1069 |
1070 |
1070 | @ 471f378eab4c
1071 | @ 471f378eab4c
1071 |/ Obsfate: rewritten as 2:7a230b46bf61 by test (at 1970-01-01 00:00 +0000);
1072 |/ Obsfate: rewritten using amend as 2:7a230b46bf61 by test (at 1970-01-01 00:00 +0000);
1072 o ea207398892e
1073 o ea207398892e
1073
1074
1074 $ hg up 'desc(A2)'
1075 $ hg up 'desc(A2)'
@@ -1105,7 +1106,7 b' with --hidden'
1105 @ 7a230b46bf61
1106 @ 7a230b46bf61
1106 |
1107 |
1107 | x 471f378eab4c
1108 | x 471f378eab4c
1108 |/ Obsfate: rewritten as 2:7a230b46bf61 by test (at 1970-01-01 00:00 +0000);
1109 |/ Obsfate: rewritten using amend as 2:7a230b46bf61 by test (at 1970-01-01 00:00 +0000);
1109 o ea207398892e
1110 o ea207398892e
1110
1111
1111
1112
@@ -1438,7 +1439,7 b' Check templates'
1438 | o ba2ed02b0c9a
1439 | o ba2ed02b0c9a
1439 | |
1440 | |
1440 | x 4a004186e638
1441 | x 4a004186e638
1441 |/ 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);
1442 |/ Obsfate: rewritten using amend as 8:b18bc8331526 by test (at 1970-01-01 00:00 +0000); rewritten using amend as 9:0b997eb7ceee by test (at 1970-01-01 00:00 +0000);
1442 o dd800401bd8c
1443 o dd800401bd8c
1443 |
1444 |
1444 o f897c6137566
1445 o f897c6137566
@@ -1511,7 +1512,7 b' Check templates'
1511 | o ba2ed02b0c9a
1512 | o ba2ed02b0c9a
1512 | |
1513 | |
1513 | x 4a004186e638
1514 | x 4a004186e638
1514 |/ 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);
1515 |/ Obsfate: rewritten using amend as 8:b18bc8331526 by test (at 1970-01-01 00:00 +0000); rewritten using amend as 9:0b997eb7ceee by test (at 1970-01-01 00:00 +0000);
1515 o dd800401bd8c
1516 o dd800401bd8c
1516 |
1517 |
1517 | x 9bd10a0775e4
1518 | x 9bd10a0775e4
@@ -1590,7 +1591,7 b' Check templates'
1590 o dd800401bd8c
1591 o dd800401bd8c
1591 |
1592 |
1592 | @ 9bd10a0775e4
1593 | @ 9bd10a0775e4
1593 |/ 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);
1594 |/ Obsfate: split using amend, rebase as 5:dd800401bd8c, 9:0b997eb7ceee, 10:eceed8f98ffc by test (at 1970-01-01 00:00 +0000); split using amend, rebase as 5:dd800401bd8c, 8:b18bc8331526, 10:eceed8f98ffc by test (at 1970-01-01 00:00 +0000);
1594 o f897c6137566
1595 o f897c6137566
1595 |
1596 |
1596 o ea207398892e
1597 o ea207398892e
@@ -1670,7 +1671,7 b' Check output'
1670 | x fdf9bde5129a
1671 | x fdf9bde5129a
1671 |/ Obsfate: pruned by test (at 1970-01-01 00:00 +0000);
1672 |/ Obsfate: pruned by test (at 1970-01-01 00:00 +0000);
1672 | @ 471f378eab4c
1673 | @ 471f378eab4c
1673 |/ 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);
1674 |/ Obsfate: rewritten using amend as 2:fdf9bde5129a by test (at 1970-01-01 00:00 +0000); rewritten using amend as 3:65b757b745b9 by test (at 1970-01-01 00:00 +0000);
1674 o ea207398892e
1675 o ea207398892e
1675
1676
1676
1677
General Comments 0
You need to be logged in to leave comments. Login now