##// END OF EJS Templates
template: compute verb in obsfateverb...
Boris Feld -
r33995:3d0f8918 default
parent child Browse files
Show More
@@ -590,3 +590,14 b' def successorsandmarkers(repo, ctx):'
590 590 values.append({'successors': sset, 'markers': sset.markers})
591 591
592 592 return values
593
594 def successorsetverb(successorset):
595 """ Return the verb summarizing the successorset
596 """
597 if not successorset:
598 verb = 'pruned'
599 elif len(successorset) == 1:
600 verb = 'rewritten'
601 else:
602 verb = 'split'
603 return verb
@@ -18,6 +18,7 b' from . import ('
18 18 encoding,
19 19 error,
20 20 minirst,
21 obsutil,
21 22 parser,
22 23 pycompat,
23 24 registrar,
@@ -849,6 +850,22 b' def mod(context, mapping, args):'
849 850 func = lambda a, b: a % b
850 851 return runarithmetic(context, mapping, (func, args[0], args[1]))
851 852
853 @templatefunc('obsfateverb(successors)')
854 def obsfateverb(context, mapping, args):
855 """Compute obsfate related information based on successors (EXPERIMENTAL)"""
856 if len(args) != 1:
857 # i18n: "obsfateverb" is a keyword
858 raise error.ParseError(_("obsfateverb expects one arguments"))
859
860 successors = evalfuncarg(context, mapping, args[0])
861
862 try:
863 return obsutil.successorsetverb(successors)
864 except TypeError:
865 # i18n: "obsfateverb" is a keyword
866 errmsg = _("obsfateverb first argument should be countable")
867 raise error.ParseError(errmsg)
868
852 869 @templatefunc('relpath(path)')
853 870 def relpath(context, mapping, args):
854 871 """Convert a repository-absolute path into a filesystem path relative to
@@ -13,7 +13,8 b' Global setup'
13 13 > stabilization=all
14 14 > [templates]
15 15 > obsfatesuccessors = " as {join(successors, ", ")}"
16 > obsfate = "rewritten{obsfatesuccessors}; "
16 > obsfateverb = "{obsfateverb(successors)}"
17 > obsfate = "{obsfateverb}{obsfatesuccessors}; "
17 18 > [alias]
18 19 > tlog = log -G -T '{node|short}\
19 20 > {if(predecessors, "\n Predecessors: {predecessors}")}\
@@ -318,7 +319,7 b' Predecessors template should show curren'
318 319 o 337fec4d2edc
319 320 |
320 321 | @ 471597cad322
321 |/ Obsfate: rewritten as 2:337fec4d2edc, 3:f257fde29c7a;
322 |/ Obsfate: split as 2:337fec4d2edc, 3:f257fde29c7a;
322 323 o ea207398892e
323 324
324 325 $ hg up f257fde29c7a
@@ -359,7 +360,7 b' with --hidden'
359 360 o 337fec4d2edc
360 361 |
361 362 | x 471597cad322
362 |/ Obsfate: rewritten as 2:337fec4d2edc, 3:f257fde29c7a;
363 |/ Obsfate: split as 2:337fec4d2edc, 3:f257fde29c7a;
363 364 o ea207398892e
364 365
365 366 $ hg fatelogjson --hidden
@@ -1528,7 +1529,7 b' Check templates'
1528 1529 o dd800401bd8c
1529 1530 |
1530 1531 | x 9bd10a0775e4
1531 |/ Obsfate: rewritten as 5:dd800401bd8c, 6:4a004186e638, 7:ba2ed02b0c9a;
1532 |/ Obsfate: split as 5:dd800401bd8c, 6:4a004186e638, 7:ba2ed02b0c9a;
1532 1533 o f897c6137566
1533 1534 |
1534 1535 | x 0dec01379d3b
@@ -1603,7 +1604,7 b' Check templates'
1603 1604 o dd800401bd8c
1604 1605 |
1605 1606 | @ 9bd10a0775e4
1606 |/ Obsfate: rewritten as 5:dd800401bd8c, 9:0b997eb7ceee, 10:eceed8f98ffc; rewritten as 5:dd800401bd8c, 8:b18bc8331526, 10:eceed8f98ffc;
1607 |/ Obsfate: split as 5:dd800401bd8c, 9:0b997eb7ceee, 10:eceed8f98ffc; split as 5:dd800401bd8c, 8:b18bc8331526, 10:eceed8f98ffc;
1607 1608 o f897c6137566
1608 1609 |
1609 1610 o ea207398892e
General Comments 0
You need to be logged in to leave comments. Login now