mercurial/revset.py
changeset 24458 7d87f672d069
parent 24457 c5022f3579b9
child 24459 7d369fae098e
--- a/mercurial/revset.py	Mon Mar 16 18:15:06 2015 +0900
+++ b/mercurial/revset.py	Mon Mar 16 18:36:53 2015 +0900
@@ -3419,5 +3419,19 @@
         other.sort(reverse=self.isdescending())
         return other
 
+def prettyformatset(revs):
+    lines = []
+    rs = repr(revs)
+    p = 0
+    while p < len(rs):
+        q = rs.find('<', p + 1)
+        if q < 0:
+            q = len(rs)
+        l = rs.count('<', 0, p) - rs.count('>', 0, p)
+        assert l >= 0
+        lines.append((l, rs[p:q].rstrip()))
+        p = q
+    return '\n'.join('  ' * l + s for l, s in lines)
+
 # tell hggettext to extract docstrings from these functions:
 i18nfunctions = symbols.values()