Commits

Wagner Bruna committed 33938a9

revlog: shows revision graph for revsets

Partially replaces unused similar functionality introduced by 0570db489d62.

Comments (0)

Files changed (2)

tortoisehg/hgtk/logview/revgraph.py

 type_LOOSE_LOW = 1
 type_LOOSE_HIGH = 2
 
-def revision_grapher(repo, start_rev, stop_rev, branch=None, noheads=False,
-    branch_color=False, hide_revs=[], prune_revs=[]):
+def revision_grapher(repo, start_rev=-1, stop_rev=-1, branch=None, noheads=False,
+    branch_color=False, only_revs=[]):
     """incremental revision grapher
 
     This grapher generates a full graph where every edge is visible.
     to show ancestors of a revision.
     if branch_color is True, the branch colour is determined by a hash
     of the branch tip, and will thus always be the same.
-    hide_revs is a list of revisions to be hidden from the graph
-    prune_revs is a list of revisions to be hidden from the graph,
-    together with their ancestors.
+    if only_revs is not [], only those revisions will be shown.
     """
 
+    shown_revs = None
+    if only_revs:
+        shown_revs = set([repo[repo.lookup(r)].rev() for r in only_revs])
+        start_rev = max(shown_revs)
+        stop_rev = min(shown_revs)
+
     assert start_rev >= stop_rev
     curr_rev = start_rev
     revs = []
     rev_color = {}
     nextcolor = [0]
     
-    hidden_revs = set([repo[repo.lookup(r)].rev() for r in hide_revs])
-    pruned_desc = [repo[repo.lookup(r)].rev() for r in prune_revs]
-    pruned_desc.sort()
-    
     def hidden(rev):
-        while pruned_desc and rev <= pruned_desc[-1]:
-            r = pruned_desc.pop()
-            hidden_revs.add(r)
-            for p in __get_parents(repo, r):
-                if p not in pruned_desc:
-                    pruned_desc.append(p)
-            pruned_desc.sort()
-        return rev in hidden_revs
+        return (shown_revs and (rev not in shown_revs)) or False
     
     while curr_rev >= stop_rev:
         if hidden(curr_rev):

tortoisehg/hgtk/logview/treeview.py

                 self.grapher = revision_grapher(self.repo, start, end,
                         only_branch, noheads, self.opts.get('branch-color'))
         elif opts.get('revlist', None):
-            self.grapher = dumb_log_generator(self.repo, opts['revlist'])
+            graphcol = True
+            self.grapher = revision_grapher(self.repo, only_revs=opts['revlist'])
         else:
             self.grapher = filtered_log_generator(self.repo, pats, opts)
         self.opts['show-graph'] = graphcol
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.