From: Eric S. Raymond Date: Sat, 15 Nov 2014 13:45:25 +0000 (-0500) Subject: succ() and pred() are now only called when building links. X-Git-Tag: 0.9~25 X-Git-Url: http://thyrsus.com/gitweb/?a=commitdiff_plain;h=4bacd14b41c8f81ea55bb009fb41c34292139196;p=src.git succ() and pred() are now only called when building links. Regression test passes. --- 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