From 4bacd14b41c8f81ea55bb009fb41c34292139196 Mon Sep 17 00:00:00 2001 From: "Eric S. Raymond" Date: Sat, 15 Nov 2014 08:45:25 -0500 Subject: [PATCH] succ() and pred() are now only called when building links. Regression test passes. --- src | 22 ++++++++++------------ 1 file changed, 10 insertions(+), 12 deletions(-) diff --git a/src b/src index b4bd39a..206be54 100755 --- a/src +++ b/src @@ -214,23 +214,21 @@ class History: def current_branch(self, backwards=False): "Return a list of items that are descendants or ancestors of current." if debug >= DEBUG_SEQUENCE: - print "current_branch(%s)" % self.current().native - p = s = self.current().revno - selection = [self.by_revno(p)] + print "current_branch(%s)" % self.current() + p = self.current() + selection = [p] while True: - rev = self.revno_to_native(p) - rev = backend.pred(rev) - p = self.native_to_revno(rev) - if p is None: + if p.parent is None: break - selection = [self.by_revno(p)] + selection + else: + p = p.parent + selection = [p] + selection + s = self.current() while True: - rev = self.revno_to_native(s) - rev = backend.succ(rev) - s = self.native_to_revno(rev) + s = s.child if s is None: break - selection.append(self.by_revno(s)) + selection.append(s) if backwards: selection.reverse() return selection -- 2.43.0