changeset 17119:2e13c1bd34dc

graphlog: display obsolete changeset as "x" Changeset detected as obsolete will be displayed as "x" instead of 'o': o new rewritten changeset | | x old obsolete changeset |/ | o base This will be useful even when some obsolete changeset will be "hidden" because not all obsolete changeset can be hidden. If an obsolete changeset have non-obsolete descendant we can't simply hide it. And having a clear visual hint that the changeset is obsolete is useful. The main reason to make this minor change right now is to: 1) introduce an officiel user of the `ctx.obsolete()` method that will detect breakage earlier than third party code (mutable, hgview) 2) Do not display any vocabulary related to obsolete. Such vocabulary will require discussion.
author Pierre-Yves David <pierre-yves.david@logilab.fr>
date Wed, 04 Jul 2012 17:29:49 +0200
parents b3c20b0f5f5a
children 01d847e0fdc9 b87acfda5268
files hgext/graphlog.py tests/test-obsolete.t
diffstat 2 files changed, 82 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/hgext/graphlog.py	Wed Jul 04 17:26:51 2012 +0200
+++ b/hgext/graphlog.py	Wed Jul 04 17:29:49 2012 +0200
@@ -455,7 +455,11 @@
              filematcher=None):
     seen, state = [], asciistate()
     for rev, type, ctx, parents in dag:
-        char = ctx.node() in showparents and '@' or 'o'
+        char = 'o'
+        if ctx.node() in showparents:
+            char = '@'
+        elif ctx.obsolete():
+            char = 'x'
         copies = None
         if getrenamed and ctx.rev():
             copies = []
--- a/tests/test-obsolete.t	Wed Jul 04 17:26:51 2012 +0200
+++ b/tests/test-obsolete.t	Wed Jul 04 17:29:49 2012 +0200
@@ -60,6 +60,83 @@
   ca819180edb99ed25ceafb3e9584ac287e240b00 1337133713371337133713371337133713371337 0 {'date': '1338 0', 'user': 'test'}
   1337133713371337133713371337133713371337 5601fb93a350734d935195fee37f4054c529ff39 0 {'date': '1339 0', 'user': 'test'}
 
+Check that graphlog detect that a changeset is obsolete:
+
+  $ hg --config 'extensions.graphlog=' glog
+  @  changeset:   5:5601fb93a350
+  |  tag:         tip
+  |  parent:      1:7c3bad9141dc
+  |  user:        test
+  |  date:        Thu Jan 01 00:00:00 1970 +0000
+  |  summary:     add new_3_c
+  |
+  | x  changeset:   4:ca819180edb9
+  |/   parent:      1:7c3bad9141dc
+  |    user:        test
+  |    date:        Thu Jan 01 00:00:00 1970 +0000
+  |    summary:     add new_2_c
+  |
+  | x  changeset:   3:cdbce2fbb163
+  |/   parent:      1:7c3bad9141dc
+  |    user:        test
+  |    date:        Thu Jan 01 00:00:00 1970 +0000
+  |    summary:     add new_c
+  |
+  | x  changeset:   2:245bde4270cd
+  |/   user:        test
+  |    date:        Thu Jan 01 00:00:00 1970 +0000
+  |    summary:     add original_c
+  |
+  o  changeset:   1:7c3bad9141dc
+  |  user:        test
+  |  date:        Thu Jan 01 00:00:00 1970 +0000
+  |  summary:     add b
+  |
+  o  changeset:   0:1f0dee641bb7
+     user:        test
+     date:        Thu Jan 01 00:00:00 1970 +0000
+     summary:     add a
+  
+
+Check that public changeset are not accounted as obsolete:
+
+  $ hg phase --public 2
+  $ hg --config 'extensions.graphlog=' glog
+  @  changeset:   5:5601fb93a350
+  |  tag:         tip
+  |  parent:      1:7c3bad9141dc
+  |  user:        test
+  |  date:        Thu Jan 01 00:00:00 1970 +0000
+  |  summary:     add new_3_c
+  |
+  | x  changeset:   4:ca819180edb9
+  |/   parent:      1:7c3bad9141dc
+  |    user:        test
+  |    date:        Thu Jan 01 00:00:00 1970 +0000
+  |    summary:     add new_2_c
+  |
+  | x  changeset:   3:cdbce2fbb163
+  |/   parent:      1:7c3bad9141dc
+  |    user:        test
+  |    date:        Thu Jan 01 00:00:00 1970 +0000
+  |    summary:     add new_c
+  |
+  | o  changeset:   2:245bde4270cd
+  |/   user:        test
+  |    date:        Thu Jan 01 00:00:00 1970 +0000
+  |    summary:     add original_c
+  |
+  o  changeset:   1:7c3bad9141dc
+  |  user:        test
+  |  date:        Thu Jan 01 00:00:00 1970 +0000
+  |  summary:     add b
+  |
+  o  changeset:   0:1f0dee641bb7
+     user:        test
+     date:        Thu Jan 01 00:00:00 1970 +0000
+     summary:     add a
+  
+
   $ cd ..
 
 Exchange Test