# HG changeset patch # User Peer Sommerlund <p...@users.sourceforge.net> # Date 1253220878 -7200 # Node ID 9bd2d210c063b7271d2b8cd05e871adb46417b57 # Parent eb31164b2b824005d1485c5afa8b379118b6327b logview: Support branch selection on compact graph
diff -r eb31164b2b82 -r 9bd2d210c063 tortoisehg/hgtk/logview/revgraph.py --- a/tortoisehg/hgtk/logview/revgraph.py Thu Sep 17 15:09:16 2009 +0200 +++ b/tortoisehg/hgtk/logview/revgraph.py Thu Sep 17 22:54:38 2009 +0200 @@ -157,10 +157,11 @@ two branches. """ - def __init__(self, repo, start_rev, stop_rev, branch_color): + def __init__(self, repo, start_rev, stop_rev, branch_filter, branch_color): ''' start_rev - first (newest) changeset to cover stop_rev - last (oldest) changeset to cover + branch_filter - if not None, show this branch and all its ancestors branch_color - true if branch name determines colours ''' assert start_rev >= stop_rev @@ -210,6 +211,9 @@ # Next colour used. for branches self.nextcolor = 0 + # If set, show only this branch and all descendants. + self.branch_filter = branch_filter + # Flag to indicate if coloring is done pr micro-branch or pr named branch self.branch_color = branch_color @@ -319,11 +323,23 @@ """Perform one iteration of the branch grapher""" # Compute revision (on CUR branch row) - rev = self.curr_rev - rev_branch = self._get_rev_branch(rev) - if rev_branch not in self.curr_branches: - # New head - self.curr_branches.append(rev_branch) + while self.more(): + rev = self.curr_rev + rev_branch = self._get_rev_branch(rev) + if rev_branch in self.curr_branches: + # Follow parent from known child + break + elif self.branch_filter is None: + # New head - no branch name filter + self.curr_branches.append(rev_branch) + break + elif self._branch_name(rev) == self.branch_filter: + # New head - matches branch name filter + self.curr_branches.append(rev_branch) + break + else: + # Skip this revision + self.curr_rev -= 1 # Compute parents (indicates the branches on NEXT branch row that curr_rev links to) parents = self._get_parents(rev) @@ -345,8 +361,8 @@ # Return result return (rev, node, lines, None) -def branch_grapher(repo, start_rev, stop_rev, branch_color=False): - grapher = BranchGrapher(repo, start_rev, stop_rev, branch_color) +def branch_grapher(repo, start_rev, stop_rev, branch=None, branch_color=False): + grapher = BranchGrapher(repo, start_rev, stop_rev, branch, branch_color) while grapher.more(): yield grapher.next() diff -r eb31164b2b82 -r 9bd2d210c063 tortoisehg/hgtk/logview/treeview.py --- a/tortoisehg/hgtk/logview/treeview.py Thu Sep 17 15:09:16 2009 +0200 +++ b/tortoisehg/hgtk/logview/treeview.py Thu Sep 17 22:54:38 2009 +0200 @@ -165,7 +165,7 @@ noheads = opts.get('noheads', False) if opts.get('branch-view', False): self.grapher = branch_grapher(self.repo, start, end, - self.branch_color) + pats, self.branch_color) else: self.grapher = revision_grapher(self.repo, start, end, pats, noheads, self.branch_color) ------------------------------------------------------------------------------ Come build with us! The BlackBerry® Developer Conference in SF, CA is the only developer event you need to attend this year. Jumpstart your developing skills, take BlackBerry mobile applications to market and stay ahead of the curve. Join us from November 9-12, 2009. Register now! http://p.sf.net/sfu/devconf _______________________________________________ Tortoisehg-develop mailing list Tortoisehg-develop@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/tortoisehg-develop