Patchwork [1,of,7,V3] templatekw: introduce obsfate keyword

login
register
mail settings
Submitter Boris Feld
Date Oct. 17, 2017, 3:14 p.m.
Message ID <fc6e8b2484a3eaedd9e4.1508253242@FB>
Download mbox | patch
Permalink /patch/25115/
State Accepted
Headers show

Comments

Boris Feld - Oct. 17, 2017, 3:14 p.m.
# HG changeset patch
# User Boris Feld <boris.feld@octobus.net>
# Date 1507218176 -7200
#      Thu Oct 05 17:42:56 2017 +0200
# Node ID fc6e8b2484a3eaedd9e4b8ec10f3728b57bfbebe
# Parent  68e0bcb903572cb3641c1b1ac11bdcf47d4ff5ac
# EXP-Topic obsfatekeyword
# Available At https://bitbucket.org/octobus/mercurial-devel/
#              hg pull https://bitbucket.org/octobus/mercurial-devel/ -r fc6e8b2484a3
templatekw: introduce obsfate keyword

Introduce an obsfate printer that uses all helpers functions defined in
obsutil to get all the obsfate-related data and format a string according to
the current format in test-obsmarker-template.t.

Then, introduce an obsfate templatekw that uses the obsfateprinter to return a
list of strings.

The goal is not to replace existing obsfate template functions but to propose
a default, good-enough and easily usable obsfate definition for end-users that
don't want to customize it. Such output would ultimately get included in the
default log output.

Here are some output examples for a commit amended:

rewritten using amend as 5:a9b1f8652753 by test (at 1970-01-01 00:00 +0000)

Next patches will make the output dependent on the verbosity.

Exemple of use-cases:

For having the obsfate on a single-line between brackets:

  {if(obsfate, " [{join(obsfate, "; ")}]")}

For having the obsfate in several lines:

  {if(obsfate, "{obsfate % "  Obsfate: {fate}\n"}")}
Yuya Nishihara - Oct. 18, 2017, 1:12 p.m.
On Tue, 17 Oct 2017 17:14:02 +0200, Boris Feld wrote:
> # HG changeset patch
> # User Boris Feld <boris.feld@octobus.net>
> # Date 1507218176 -7200
> #      Thu Oct 05 17:42:56 2017 +0200
> # Node ID fc6e8b2484a3eaedd9e4b8ec10f3728b57bfbebe
> # Parent  68e0bcb903572cb3641c1b1ac11bdcf47d4ff5ac
> # EXP-Topic obsfatekeyword
> # Available At https://bitbucket.org/octobus/mercurial-devel/
> #              hg pull https://bitbucket.org/octobus/mercurial-devel/ -r fc6e8b2484a3
> templatekw: introduce obsfate keyword

Queued the series, thanks.

> +def obsfateprinter(successors, markers, ui):
> +    """ Build a obsfate string for a single successorset using all obsfate
> +    related function defined in obsutil
> +    """
> +    line = []
> +
> +    # Verb
> +    line.append(successorsetverb(successors))
> +
> +    # Operations
> +    operations = markersoperations(markers)
> +    if operations:
> +        line.append(" using %s" % ", ".join(operations))
> +
> +    # Successors
> +    if successors:
> +        fmtsuccessors = [successors.joinfmt(succ) for succ in successors]

We'll make it not depend on templater stuff because this function will be
called by changeset_printer. Please send a follow up after the release.

> +        line.append(" as %s" % ", ".join(fmtsuccessors))
> +
> +    # Users
> +    users = markersusers(markers)
> +
> +    if users:
> +        line.append(" by %s" % ", ".join(users))

These "using" "as" "by" will need to be translated at once. Please send a
follow up after the release.

> +    # Date
> +    dates = markersdates(markers)
> +
> +    min_date = min(dates)
> +    max_date = max(dates)

If dates is empty, ValueError will be raised. Please send a follow up.

And our coding style still discourage the use of underscore.
https://www.mercurial-scm.org/wiki/CodingStyle#Naming_conventions

> +    if min_date == max_date:
> +        fmtmin_date = util.datestr(min_date, '%Y-%m-%d %H:%M %1%2')
> +        line.append(" (at %s)" % fmtmin_date)
> +    else:
> +        fmtmin_date = util.datestr(min_date, '%Y-%m-%d %H:%M %1%2')
> +        fmtmax_date = util.datestr(max_date, '%Y-%m-%d %H:%M %1%2')
> +        line.append(" (between %s and %s)" % (fmtmin_date, fmtmax_date))
> +
> +    return "".join(line)

> diff --git a/mercurial/templatekw.py b/mercurial/templatekw.py
> --- a/mercurial/templatekw.py
> +++ b/mercurial/templatekw.py
> @@ -600,6 +600,24 @@
>      # rev and node are completely different from changeset's.
>      return _mappable(f, None, f, lambda x: {'rev': mrev, 'node': mhex})
>  
> +@templatekeyword('obsfate')
> +def showobsfate(**args):
> +    """ this function returns a list containing pre-formatted obsfate strings.
> +
> +    This function will be replaced by templates fragments when we will have
> +    the verbosity templatekw available.
> +    """

Changed this to a comment to hide {ofsfate} in help.
Boris Feld - Oct. 18, 2017, 1:36 p.m.
On Wed, 2017-10-18 at 22:12 +0900, Yuya Nishihara wrote:
> On Tue, 17 Oct 2017 17:14:02 +0200, Boris Feld wrote:
> > # HG changeset patch
> > # User Boris Feld <boris.feld@octobus.net>
> > # Date 1507218176 -7200
> > #      Thu Oct 05 17:42:56 2017 +0200
> > # Node ID fc6e8b2484a3eaedd9e4b8ec10f3728b57bfbebe
> > # Parent  68e0bcb903572cb3641c1b1ac11bdcf47d4ff5ac
> > # EXP-Topic obsfatekeyword
> > # Available At https://bitbucket.org/octobus/mercurial-devel/
> > #              hg pull https://bitbucket.org/octobus/mercurial-deve
> > l/ -r fc6e8b2484a3
> > templatekw: introduce obsfate keyword
> 
> Queued the series, thanks.

Thank you, I will send the required follow-up right now and prepare the
others for after the release.

> 
> > +def obsfateprinter(successors, markers, ui):
> > +    """ Build a obsfate string for a single successorset using all
> > obsfate
> > +    related function defined in obsutil
> > +    """
> > +    line = []
> > +
> > +    # Verb
> > +    line.append(successorsetverb(successors))
> > +
> > +    # Operations
> > +    operations = markersoperations(markers)
> > +    if operations:
> > +        line.append(" using %s" % ", ".join(operations))
> > +
> > +    # Successors
> > +    if successors:
> > +        fmtsuccessors = [successors.joinfmt(succ) for succ in
> > successors]
> 
> We'll make it not depend on templater stuff because this function
> will be
> called by changeset_printer. Please send a follow up after the
> release.
> 
> > +        line.append(" as %s" % ", ".join(fmtsuccessors))
> > +
> > +    # Users
> > +    users = markersusers(markers)
> > +
> > +    if users:
> > +        line.append(" by %s" % ", ".join(users))
> 
> These "using" "as" "by" will need to be translated at once. Please
> send a
> follow up after the release.
> 
> > +    # Date
> > +    dates = markersdates(markers)
> > +
> > +    min_date = min(dates)
> > +    max_date = max(dates)
> 
> If dates is empty, ValueError will be raised. Please send a follow
> up.
> 
> And our coding style still discourage the use of underscore.
> https://www.mercurial-scm.org/wiki/CodingStyle#Naming_conventions
> 
> > +    if min_date == max_date:
> > +        fmtmin_date = util.datestr(min_date, '%Y-%m-%d %H:%M
> > %1%2')
> > +        line.append(" (at %s)" % fmtmin_date)
> > +    else:
> > +        fmtmin_date = util.datestr(min_date, '%Y-%m-%d %H:%M
> > %1%2')
> > +        fmtmax_date = util.datestr(max_date, '%Y-%m-%d %H:%M
> > %1%2')
> > +        line.append(" (between %s and %s)" % (fmtmin_date,
> > fmtmax_date))
> > +
> > +    return "".join(line)
> > diff --git a/mercurial/templatekw.py b/mercurial/templatekw.py
> > --- a/mercurial/templatekw.py
> > +++ b/mercurial/templatekw.py
> > @@ -600,6 +600,24 @@
> >      # rev and node are completely different from changeset's.
> >      return _mappable(f, None, f, lambda x: {'rev': mrev, 'node':
> > mhex})
> >  
> > +@templatekeyword('obsfate')
> > +def showobsfate(**args):
> > +    """ this function returns a list containing pre-formatted
> > obsfate strings.
> > +
> > +    This function will be replaced by templates fragments when we
> > will have
> > +    the verbosity templatekw available.
> > +    """
> 
> Changed this to a comment to hide {ofsfate} in help.

Patch

diff --git a/mercurial/obsutil.py b/mercurial/obsutil.py
--- a/mercurial/obsutil.py
+++ b/mercurial/obsutil.py
@@ -783,3 +783,44 @@ 
                      if meta.get('operation'))
 
     return sorted(operations)
+
+def obsfateprinter(successors, markers, ui):
+    """ Build a obsfate string for a single successorset using all obsfate
+    related function defined in obsutil
+    """
+    line = []
+
+    # Verb
+    line.append(successorsetverb(successors))
+
+    # Operations
+    operations = markersoperations(markers)
+    if operations:
+        line.append(" using %s" % ", ".join(operations))
+
+    # Successors
+    if successors:
+        fmtsuccessors = [successors.joinfmt(succ) for succ in successors]
+        line.append(" as %s" % ", ".join(fmtsuccessors))
+
+    # Users
+    users = markersusers(markers)
+
+    if users:
+        line.append(" by %s" % ", ".join(users))
+
+    # Date
+    dates = markersdates(markers)
+
+    min_date = min(dates)
+    max_date = max(dates)
+
+    if min_date == max_date:
+        fmtmin_date = util.datestr(min_date, '%Y-%m-%d %H:%M %1%2')
+        line.append(" (at %s)" % fmtmin_date)
+    else:
+        fmtmin_date = util.datestr(min_date, '%Y-%m-%d %H:%M %1%2')
+        fmtmax_date = util.datestr(max_date, '%Y-%m-%d %H:%M %1%2')
+        line.append(" (between %s and %s)" % (fmtmin_date, fmtmax_date))
+
+    return "".join(line)
diff --git a/mercurial/templatekw.py b/mercurial/templatekw.py
--- a/mercurial/templatekw.py
+++ b/mercurial/templatekw.py
@@ -600,6 +600,24 @@ 
     # rev and node are completely different from changeset's.
     return _mappable(f, None, f, lambda x: {'rev': mrev, 'node': mhex})
 
+@templatekeyword('obsfate')
+def showobsfate(**args):
+    """ this function returns a list containing pre-formatted obsfate strings.
+
+    This function will be replaced by templates fragments when we will have
+    the verbosity templatekw available.
+    """
+    succsandmarkers = showsuccsandmarkers(**args)
+
+    ui = args['ui']
+
+    values = []
+
+    for x in succsandmarkers:
+        values.append(obsutil.obsfateprinter(x['successors'], x['markers'], ui))
+
+    return showlist("fate", values, args)
+
 def shownames(namespace, **args):
     """helper method to generate a template keyword for a namespace"""
     args = pycompat.byteskwargs(args)
diff --git a/tests/test-obsolete-distributed.t b/tests/test-obsolete-distributed.t
--- a/tests/test-obsolete-distributed.t
+++ b/tests/test-obsolete-distributed.t
@@ -16,15 +16,8 @@ 
   > evolution = all
   > [phases]
   > publish = False
-  > [templates]
-  > obsfatesuccessors = "{if(successors, " as ")}{join(successors, ", ")}"
-  > obsfateverb = "{obsfateverb(successors)}"
-  > obsfateoperations = "{if(obsfateoperations(markers), " using {join(obsfateoperations(markers), ", ")}")}"
-  > obsfateusers = "{if(obsfateusers(markers), " by {join(obsfateusers(markers), ", ")}")}"
-  > 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})")}")}"
-  > obsfate = "{obsfateverb}{obsfateoperations}{obsfatesuccessors}{obsfateusers}{obsfatedate}; "
   > [ui]
-  > logtemplate= {rev}:{node|short} {desc} {if(succsandmarkers, "[{succsandmarkers % "{obsfate}"}]")}\n
+  > logtemplate= {rev}:{node|short} {desc}{if(obsfate, " [{join(obsfate, "; ")}]")}\n
   > EOF
 
 Check distributed chain building
@@ -63,7 +56,7 @@ 
   |
   | o  2:7f6b0a6f5c25 c_A1
   |/
-  | x  1:e1b46f0f979f c_A0 [rewritten as 2:7f6b0a6f5c25 by server (at 1970-01-01 00:00 +0000); ]
+  | x  1:e1b46f0f979f c_A0 [rewritten as 2:7f6b0a6f5c25 by server (at 1970-01-01 00:00 +0000)]
   |/
   o  0:e82fb8d02bbf ROOT
   
@@ -100,11 +93,11 @@ 
   $ hg log -G --hidden
   @  4:391a2bf12b1b c_B1
   |
-  | x  3:e5d7dda7cd28 c_B0 [rewritten as 4:391a2bf12b1b by server (at 1970-01-01 00:00 +0000); ]
+  | x  3:e5d7dda7cd28 c_B0 [rewritten as 4:391a2bf12b1b by server (at 1970-01-01 00:00 +0000)]
   |/
   | o  2:7f6b0a6f5c25 c_A1
   |/
-  | x  1:e1b46f0f979f c_A0 [rewritten as 2:7f6b0a6f5c25 by server (at 1970-01-01 00:00 +0000); ]
+  | x  1:e1b46f0f979f c_A0 [rewritten as 2:7f6b0a6f5c25 by server (at 1970-01-01 00:00 +0000)]
   |/
   o  0:e82fb8d02bbf ROOT
   
@@ -127,9 +120,9 @@ 
   $ hg log -G --hidden
   @  3:e5d7dda7cd28 c_B0
   |
-  | x  2:7f6b0a6f5c25 c_A1 [rewritten as 3:e5d7dda7cd28 by client (at 1970-01-01 00:00 +0000); ]
+  | x  2:7f6b0a6f5c25 c_A1 [rewritten as 3:e5d7dda7cd28 by client (at 1970-01-01 00:00 +0000)]
   |/
-  | x  1:e1b46f0f979f c_A0 [rewritten as 2:7f6b0a6f5c25 by server (at 1970-01-01 00:00 +0000); ]
+  | x  1:e1b46f0f979f c_A0 [rewritten as 2:7f6b0a6f5c25 by server (at 1970-01-01 00:00 +0000)]
   |/
   o  0:e82fb8d02bbf ROOT
   
@@ -161,11 +154,11 @@ 
   $ hg log -G --hidden
   o  4:391a2bf12b1b c_B1
   |
-  | x  3:e5d7dda7cd28 c_B0 [rewritten as 4:391a2bf12b1b by server (at 1970-01-01 00:00 +0000); ]
+  | x  3:e5d7dda7cd28 c_B0 [rewritten as 4:391a2bf12b1b by server (at 1970-01-01 00:00 +0000)]
   |/
-  | x  2:7f6b0a6f5c25 c_A1 [rewritten as 3:e5d7dda7cd28 by client (at 1970-01-01 00:00 +0000); ]
+  | x  2:7f6b0a6f5c25 c_A1 [rewritten as 3:e5d7dda7cd28 by client (at 1970-01-01 00:00 +0000)]
   |/
-  | x  1:e1b46f0f979f c_A0 [rewritten as 2:7f6b0a6f5c25 by server (at 1970-01-01 00:00 +0000); ]
+  | x  1:e1b46f0f979f c_A0 [rewritten as 2:7f6b0a6f5c25 by server (at 1970-01-01 00:00 +0000)]
   |/
   @  0:e82fb8d02bbf ROOT
   
@@ -197,11 +190,11 @@ 
   $ hg -R ../server/ log -G --hidden
   @  4:391a2bf12b1b c_B1
   |
-  | x  3:e5d7dda7cd28 c_B0 [rewritten as 4:391a2bf12b1b by server (at 1970-01-01 00:00 +0000); ]
+  | x  3:e5d7dda7cd28 c_B0 [rewritten as 4:391a2bf12b1b by server (at 1970-01-01 00:00 +0000)]
   |/
-  | x  2:7f6b0a6f5c25 c_A1 [rewritten as 3:e5d7dda7cd28 by client (at 1970-01-01 00:00 +0000); ]
+  | x  2:7f6b0a6f5c25 c_A1 [rewritten as 3:e5d7dda7cd28 by client (at 1970-01-01 00:00 +0000)]
   |/
-  | x  1:e1b46f0f979f c_A0 [rewritten as 2:7f6b0a6f5c25 by server (at 1970-01-01 00:00 +0000); ]
+  | x  1:e1b46f0f979f c_A0 [rewritten as 2:7f6b0a6f5c25 by server (at 1970-01-01 00:00 +0000)]
   |/
   o  0:e82fb8d02bbf ROOT
   
@@ -298,13 +291,13 @@ 
   $ hg log -G --hidden
   @  5:956063ac4557 c_B1
   |
-  | x  4:5ffb9e311b35 c_B0 [rewritten using amend as 5:956063ac4557 by bob (at 1970-01-01 00:00 +0000); ]
+  | x  4:5ffb9e311b35 c_B0 [rewritten using amend as 5:956063ac4557 by bob (at 1970-01-01 00:00 +0000)]
   |/
   o  3:5b5708a437f2 c_A1
   |
-  | x  2:ef908e42ce65 c_B0 [rewritten using rebase as 4:5ffb9e311b35 by bob (at 1970-01-01 00:00 +0000); ]
+  | x  2:ef908e42ce65 c_B0 [rewritten using rebase as 4:5ffb9e311b35 by bob (at 1970-01-01 00:00 +0000)]
   | |
-  | x  1:d33b0a3a6464 c_A0 [rewritten using amend as 3:5b5708a437f2 by bob (at 1970-01-01 00:00 +0000); ]
+  | x  1:d33b0a3a6464 c_A0 [rewritten using amend as 3:5b5708a437f2 by bob (at 1970-01-01 00:00 +0000)]
   |/
   o  0:e82fb8d02bbf ROOT
   
@@ -345,13 +338,13 @@ 
   $ hg log -G --hidden
   @  5:77ae25d99ff0 c_B2
   |
-  | x  4:3cf8de21cc22 c_B1 [rewritten using amend as 5:77ae25d99ff0 by celeste (at 1970-01-01 00:00 +0000); ]
+  | x  4:3cf8de21cc22 c_B1 [rewritten using amend as 5:77ae25d99ff0 by celeste (at 1970-01-01 00:00 +0000)]
   |/
   o  3:9866d64649a5 c_A2
   |
-  | x  2:956063ac4557 c_B1 [rewritten using rebase as 4:3cf8de21cc22 by celeste (at 1970-01-01 00:00 +0000); ]
+  | x  2:956063ac4557 c_B1 [rewritten using rebase as 4:3cf8de21cc22 by celeste (at 1970-01-01 00:00 +0000)]
   | |
-  | x  1:5b5708a437f2 c_A1 [rewritten using amend as 3:9866d64649a5 by celeste (at 1970-01-01 00:00 +0000); ]
+  | x  1:5b5708a437f2 c_A1 [rewritten using amend as 3:9866d64649a5 by celeste (at 1970-01-01 00:00 +0000)]
   |/
   o  0:e82fb8d02bbf ROOT
   
@@ -469,17 +462,17 @@ 
   @  0:e82fb8d02bbf ROOT
   
   $ hg log -G --hidden
-  x  6:956063ac4557 c_B1 [rewritten using amend, rebase as 4:77ae25d99ff0 by celeste (at 1970-01-01 00:00 +0000); ]
+  x  6:956063ac4557 c_B1 [rewritten using amend, rebase as 4:77ae25d99ff0 by celeste (at 1970-01-01 00:00 +0000)]
   |
-  x  5:5b5708a437f2 c_A1 [rewritten using amend as 3:9866d64649a5 by celeste (at 1970-01-01 00:00 +0000); ]
+  x  5:5b5708a437f2 c_A1 [rewritten using amend as 3:9866d64649a5 by celeste (at 1970-01-01 00:00 +0000)]
   |
   | o  4:77ae25d99ff0 c_B2
   | |
   | o  3:9866d64649a5 c_A2
   |/
-  | x  2:ef908e42ce65 c_B0 [rewritten using amend, rebase as 6:956063ac4557 by bob (at 1970-01-01 00:00 +0000); ]
+  | x  2:ef908e42ce65 c_B0 [rewritten using amend, rebase as 6:956063ac4557 by bob (at 1970-01-01 00:00 +0000)]
   | |
-  | x  1:d33b0a3a6464 c_A0 [rewritten using amend as 5:5b5708a437f2 by bob (at 1970-01-01 00:00 +0000); ]
+  | x  1:d33b0a3a6464 c_A0 [rewritten using amend as 5:5b5708a437f2 by bob (at 1970-01-01 00:00 +0000)]
   |/
   @  0:e82fb8d02bbf ROOT
   
diff --git a/tests/test-obsolete-divergent.t b/tests/test-obsolete-divergent.t
--- a/tests/test-obsolete-divergent.t
+++ b/tests/test-obsolete-divergent.t
@@ -7,7 +7,7 @@ 
 
   $ cat >> $HGRCPATH << EOF
   > [ui]
-  > logtemplate = {rev}:{node|short} {desc}\n
+  > logtemplate = {rev}:{node|short} {desc}{if(obsfate, " [{join(obsfate, "; ")}]")}\n
   > [experimental]
   > stabilization=createmarkers
   > [extensions]
@@ -66,7 +66,7 @@ 
   |
   | o  2:82623d38b9ba A_1
   |/
-  | x  1:007dc284c1f8 A_0
+  | x  1:007dc284c1f8 A_0 [rewritten as 2:82623d38b9ba by test (at 1970-01-01 00:00 +0000); rewritten as 3:392fd25390da by test (at 1970-01-01 00:00 +0000)]
   |/
   @  0:d20a80d4def3 base
   
@@ -127,11 +127,11 @@ 
   $ hg log -G --hidden
   @  4:01f36c5a8fda A_3
   |
-  | x  3:392fd25390da A_2
+  | x  3:392fd25390da A_2 [rewritten as 4:01f36c5a8fda by test (at 1970-01-01 00:00 +0000)]
   |/
   | o  2:82623d38b9ba A_1
   |/
-  | x  1:007dc284c1f8 A_0
+  | x  1:007dc284c1f8 A_0 [rewritten as 2:82623d38b9ba by test (at 1970-01-01 00:00 +0000); rewritten as 3:392fd25390da by test (at 1970-01-01 00:00 +0000)]
   |/
   o  0:d20a80d4def3 base
   
@@ -185,7 +185,7 @@ 
   |
   | o  2:82623d38b9ba A_1
   |/
-  | x  1:007dc284c1f8 A_0
+  | x  1:007dc284c1f8 A_0 [rewritten as 2:82623d38b9ba by test (at 1970-01-01 00:00 +0000); rewritten as 3:392fd25390da by test (at 1970-01-01 00:00 +0000)]
   |/
   @  0:d20a80d4def3 base
   
@@ -259,11 +259,11 @@ 
   $ hg log -G --hidden
   @  4:01f36c5a8fda A_3
   |
-  | x  3:392fd25390da A_2
+  | x  3:392fd25390da A_2 [rewritten as 4:01f36c5a8fda by test (at 1970-01-01 00:00 +0000)]
   |/
-  | x  2:82623d38b9ba A_1
+  | x  2:82623d38b9ba A_1 [rewritten as 4:01f36c5a8fda by test (at 1970-01-01 00:00 +0000)]
   |/
-  | x  1:007dc284c1f8 A_0
+  | x  1:007dc284c1f8 A_0 [rewritten as 2:82623d38b9ba by test (at 1970-01-01 00:00 +0000); rewritten as 3:392fd25390da by test (at 1970-01-01 00:00 +0000)]
   |/
   o  0:d20a80d4def3 base
   
@@ -309,7 +309,7 @@ 
   |
   | o  2:82623d38b9ba A_1
   |/
-  | x  1:007dc284c1f8 A_0
+  | x  1:007dc284c1f8 A_0 [split as 2:82623d38b9ba, 3:392fd25390da by test (at 1970-01-01 00:00 +0000)]
   |/
   @  0:d20a80d4def3 base
   
@@ -361,15 +361,15 @@ 
   $ hg log -G --hidden
   @  6:e442cfc57690 A_5
   |
-  | x  5:6a411f0d7a0a A_4
+  | x  5:6a411f0d7a0a A_4 [rewritten as 6:e442cfc57690 by test (at 1970-01-01 00:00 +0000)]
   |/
   | o  4:01f36c5a8fda A_3
   |/
-  | x  3:392fd25390da A_2
+  | x  3:392fd25390da A_2 [rewritten as 5:6a411f0d7a0a by test (at 1970-01-01 00:00 +0000)]
   |/
-  | x  2:82623d38b9ba A_1
+  | x  2:82623d38b9ba A_1 [rewritten as 4:01f36c5a8fda by test (at 1970-01-01 00:00 +0000)]
   |/
-  | x  1:007dc284c1f8 A_0
+  | x  1:007dc284c1f8 A_0 [split as 2:82623d38b9ba, 3:392fd25390da by test (at 1970-01-01 00:00 +0000)]
   |/
   o  0:d20a80d4def3 base
   
@@ -437,19 +437,19 @@ 
   |/
   | o  8:7ae126973a96 A_7
   |/
-  | x  7:3750ebee865d B_0
+  | x  7:3750ebee865d B_0 [rewritten as 3:392fd25390da by test (at 1970-01-01 00:00 +0000)]
   | |
-  | x  6:e442cfc57690 A_5
+  | x  6:e442cfc57690 A_5 [rewritten as 10:bed64f5d2f5a by test (at 1970-01-01 00:00 +0000); split as 8:7ae126973a96, 9:14608b260df8 by test (at 1970-01-01 00:00 +0000)]
   |/
-  | x  5:6a411f0d7a0a A_4
+  | x  5:6a411f0d7a0a A_4 [rewritten as 6:e442cfc57690 by test (at 1970-01-01 00:00 +0000)]
   |/
   | o  4:01f36c5a8fda A_3
   |/
-  | x  3:392fd25390da A_2
+  | x  3:392fd25390da A_2 [rewritten as 5:6a411f0d7a0a by test (at 1970-01-01 00:00 +0000)]
   |/
-  | x  2:82623d38b9ba A_1
+  | x  2:82623d38b9ba A_1 [rewritten as 4:01f36c5a8fda by test (at 1970-01-01 00:00 +0000)]
   |/
-  | x  1:007dc284c1f8 A_0
+  | x  1:007dc284c1f8 A_0 [split as 2:82623d38b9ba, 3:392fd25390da by test (at 1970-01-01 00:00 +0000)]
   |/
   @  0:d20a80d4def3 base
   
@@ -535,25 +535,25 @@ 
   $ hg log -G --hidden
   o  11:a139f71be9da A_A
   |
-  | x  10:bed64f5d2f5a A_9
+  | x  10:bed64f5d2f5a A_9 [rewritten as 11:a139f71be9da by test (at 1970-01-01 00:00 +0000)]
   |/
-  | x  9:14608b260df8 A_8
+  | x  9:14608b260df8 A_8 [rewritten as 11:a139f71be9da by test (at 1970-01-01 00:00 +0000)]
   |/
-  | x  8:7ae126973a96 A_7
+  | x  8:7ae126973a96 A_7 [rewritten as 11:a139f71be9da by test (at 1970-01-01 00:00 +0000)]
   |/
-  | x  7:3750ebee865d B_0
+  | x  7:3750ebee865d B_0 [rewritten as 3:392fd25390da by test (at 1970-01-01 00:00 +0000)]
   | |
-  | x  6:e442cfc57690 A_5
+  | x  6:e442cfc57690 A_5 [rewritten as 10:bed64f5d2f5a by test (at 1970-01-01 00:00 +0000); split as 8:7ae126973a96, 9:14608b260df8 by test (at 1970-01-01 00:00 +0000)]
   |/
-  | x  5:6a411f0d7a0a A_4
+  | x  5:6a411f0d7a0a A_4 [rewritten as 6:e442cfc57690 by test (at 1970-01-01 00:00 +0000)]
   |/
   | o  4:01f36c5a8fda A_3
   |/
-  | x  3:392fd25390da A_2
+  | x  3:392fd25390da A_2 [rewritten as 5:6a411f0d7a0a by test (at 1970-01-01 00:00 +0000)]
   |/
-  | x  2:82623d38b9ba A_1
+  | x  2:82623d38b9ba A_1 [rewritten as 4:01f36c5a8fda by test (at 1970-01-01 00:00 +0000)]
   |/
-  | x  1:007dc284c1f8 A_0
+  | x  1:007dc284c1f8 A_0 [split as 2:82623d38b9ba, 3:392fd25390da by test (at 1970-01-01 00:00 +0000)]
   |/
   @  0:d20a80d4def3 base
   
diff --git a/tests/test-obsolete.t b/tests/test-obsolete.t
--- a/tests/test-obsolete.t
+++ b/tests/test-obsolete.t
@@ -3,7 +3,7 @@ 
   > # public changeset are not obsolete
   > publish=false
   > [ui]
-  > logtemplate="{rev}:{node|short} ({phase}{if(obsolete, ' *{obsolete}*')}{if(instabilities, ' {instabilities}')}) [{tags} {bookmarks}] {desc|firstline}\n"
+  > logtemplate="{rev}:{node|short} ({phase}{if(obsolete, ' *{obsolete}*')}{if(instabilities, ' {instabilities}')}) [{tags} {bookmarks}] {desc|firstline}{if(obsfate, " [{join(obsfate, "; ")}]")}\n"
   > EOF
   $ mkcommit() {
   >    echo "$1" > "$1"
@@ -159,9 +159,9 @@ 
   5:5601fb93a350 (draft) [tip ] add new_3_c
   $ hg heads --hidden
   5:5601fb93a350 (draft) [tip ] add new_3_c
-  4:ca819180edb9 (draft *obsolete*) [ ] add new_2_c
-  3:cdbce2fbb163 (draft *obsolete*) [ ] add new_c
-  2:245bde4270cd (draft *obsolete*) [ ] add original_c
+  4:ca819180edb9 (draft *obsolete*) [ ] add new_2_c [rewritten as 5:5601fb93a350 by test (between 1970-01-01 00:22 +0000 and 1970-01-01 00:22 +0000)]
+  3:cdbce2fbb163 (draft *obsolete*) [ ] add new_c [rewritten as 4:ca819180edb9 by test (at 1970-01-01 00:22 +0000)]
+  2:245bde4270cd (draft *obsolete*) [ ] add original_c [rewritten as 3:cdbce2fbb163 by test (at 1970-01-01 00:00 -0002)]
 
 
 check that summary does not report them
@@ -277,11 +277,11 @@ 
   $ hg log -G --hidden
   @  6:6f9641995072 (draft) [tip ] add n3w_3_c
   |
-  | x  5:5601fb93a350 (draft *obsolete*) [ ] add new_3_c
+  | x  5:5601fb93a350 (draft *obsolete*) [ ] add new_3_c [rewritten as 6:6f9641995072 by test (at 1970-01-01 00:22 +0000)]
   |/
-  | x  4:ca819180edb9 (draft *obsolete*) [ ] add new_2_c
+  | x  4:ca819180edb9 (draft *obsolete*) [ ] add new_2_c [rewritten as 5:5601fb93a350 by test (between 1970-01-01 00:22 +0000 and 1970-01-01 00:22 +0000)]
   |/
-  | x  3:cdbce2fbb163 (draft *obsolete*) [ ] add new_c
+  | x  3:cdbce2fbb163 (draft *obsolete*) [ ] add new_c [rewritten as 4:ca819180edb9 by test (at 1970-01-01 00:22 +0000)]
   |/
   | o  2:245bde4270cd (public) [ ] add original_c
   |/
@@ -435,11 +435,11 @@ 
   $ hg -R clone-dest log -G --hidden
   @  6:6f9641995072 (draft) [tip ] add n3w_3_c
   |
-  | x  5:5601fb93a350 (draft *obsolete*) [ ] add new_3_c
+  | x  5:5601fb93a350 (draft *obsolete*) [ ] add new_3_c [rewritten as 6:6f9641995072 by test (at 1970-01-01 00:22 +0000)]
   |/
-  | x  4:ca819180edb9 (draft *obsolete*) [ ] add new_2_c
+  | x  4:ca819180edb9 (draft *obsolete*) [ ] add new_2_c [rewritten as 5:5601fb93a350 by test (between 1970-01-01 00:22 +0000 and 1970-01-01 00:22 +0000)]
   |/
-  | x  3:cdbce2fbb163 (draft *obsolete*) [ ] add new_c
+  | x  3:cdbce2fbb163 (draft *obsolete*) [ ] add new_c [rewritten as 4:ca819180edb9 by test (at 1970-01-01 00:22 +0000)]
   |/
   | o  2:245bde4270cd (public) [ ] add original_c
   |/
@@ -520,7 +520,7 @@ 
   $ hg debugobsolete | grep `getid original_d`
   94b33453f93bdb8d457ef9b770851a618bf413e1 0 {6f96419950729f3671185b847352890f074f7557} (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'}
   $ hg log -r 'obsolete()'
-  4:94b33453f93b (draft *obsolete*) [ ] add original_d
+  4:94b33453f93b (draft *obsolete*) [ ] add original_d [pruned by test (at 1970-01-01 00:00 +0000)]
   $ hg summary
   parent: 5:cda648ca50f5 tip (orphan)
    add original_e
@@ -532,7 +532,7 @@ 
   $ hg log -G -r '::orphan()'
   @  5:cda648ca50f5 (draft orphan) [tip ] add original_e
   |
-  x  4:94b33453f93b (draft *obsolete*) [ ] add original_d
+  x  4:94b33453f93b (draft *obsolete*) [ ] add original_d [pruned by test (at 1970-01-01 00:00 +0000)]
   |
   o  3:6f9641995072 (draft) [ ] add n3w_3_c
   |
@@ -571,7 +571,7 @@ 
   1:7c3bad9141dc (public) [ ] add b
   2:245bde4270cd (public) [ ] add original_c
   3:6f9641995072 (draft) [ ] add n3w_3_c
-  4:94b33453f93b (draft *obsolete*) [ ] add original_d
+  4:94b33453f93b (draft *obsolete*) [ ] add original_d [pruned by test (at 1970-01-01 00:00 +0000)]
   5:cda648ca50f5 (draft orphan) [tip ] add original_e
   $ hg push ../tmpf -f # -f because be push unstable too
   pushing to ../tmpf
@@ -595,7 +595,7 @@ 
   $ hg log -G
   @  5:cda648ca50f5 (draft orphan) [tip ] add original_e
   |
-  x  4:94b33453f93b (draft *obsolete*) [ ] add original_d
+  x  4:94b33453f93b (draft *obsolete*) [ ] add original_d [pruned by test (at 1970-01-01 00:00 +0000)]
   |
   o  3:6f9641995072 (draft) [ ] add n3w_3_c
   |
@@ -636,9 +636,9 @@ 
   $ hg log --hidden --graph
   @  6:3de5eca88c00 (draft) [tip ] add obsolete_e
   |
-  | x  5:cda648ca50f5 (draft *obsolete*) [ ] add original_e
+  | x  5:cda648ca50f5 (draft *obsolete*) [ ] add original_e [rewritten as 6:3de5eca88c00 by test <test@example.net> (at 1970-01-01 00:00 +0000)]
   | |
-  | x  4:94b33453f93b (draft *obsolete*) [ ] add original_d
+  | x  4:94b33453f93b (draft *obsolete*) [ ] add original_d [pruned by test (at 1970-01-01 00:00 +0000)]
   |/
   o  3:6f9641995072 (draft) [ ] add n3w_3_c
   |
@@ -928,7 +928,7 @@ 
 test the "obsolete" templatekw
 
   $ hg log -r 'obsolete()'
-  6:3de5eca88c00 (draft *obsolete*) [ ] add obsolete_e
+  6:3de5eca88c00 (draft *obsolete*) [ ] add obsolete_e [pruned by test (at 1970-01-01 00:00 +0000)]
 
 test the "troubles" templatekw
 
@@ -1098,7 +1098,7 @@ 
   $ hg log -G
   @  2:323a9c3ddd91 (draft) [tip ] A
   |
-  | x  1:29f0c6921ddd (draft *obsolete*) [visible ] A
+  | x  1:29f0c6921ddd (draft *obsolete*) [visible ] A [rewritten using amend as 2:323a9c3ddd91 by test (at 1970-01-01 00:00 +0000)]
   |/
   o  0:d20a80d4def3 (draft) [ ] base
   
@@ -1152,7 +1152,7 @@ 
   $ hg log -G --hidden
   @  2:b7d587542d40 (draft) [tip ] B+
   |
-  | x  1:44526ebb0f98 (draft *obsolete*) [ ] B
+  | x  1:44526ebb0f98 (draft *obsolete*) [ ] B [rewritten using amend as 2:b7d587542d40 by test (at 1970-01-01 00:00 +0000)]
   |/
   o  0:4b34ecfb0d56 (draft) [ ] A
   
@@ -1279,7 +1279,7 @@ 
   $ hg commit --amend -m "message"
   $ hg book bookb -r 13bedc178fce --hidden
   $ hg log -r 13bedc178fce
-  4:13bedc178fce (draft *obsolete*) [ bookb] add b
+  4:13bedc178fce (draft *obsolete*) [ bookb] add b [rewritten using amend as 5:a9b1f8652753 by test (at 1970-01-01 00:00 +0000)]
   $ hg book -d bookb
   $ hg log -r 13bedc178fce
   abort: hidden revision '13bedc178fce'!
@@ -1319,7 +1319,7 @@ 
   $ hg log -G --hidden
   @  3:b0551702f918 (draft) [tip ] 2
   |
-  | x  2:e008cf283490 (draft *obsolete*) [ ] 2
+  | x  2:e008cf283490 (draft *obsolete*) [ ] 2 [rewritten using amend as 3:b0551702f918 by test (at 1970-01-01 00:00 +0000)]
   |/
   o  1:e016b03fd86f (draft) [ ] 1
   |