From: Eric S. Raymond Date: Wed, 12 Nov 2014 13:54:22 +0000 (-0500) Subject: Correct behavior from tip(). Regression test passes. X-Git-Tag: 0.6~27 X-Git-Url: http://thyrsus.com/gitweb/?a=commitdiff_plain;h=d69bda4cfd3dfe27385218cdd43af4643bc5f0e8;p=src.git Correct behavior from tip(). Regression test passes. --- diff --git a/src b/src index e288e3f..7d69436 100755 --- a/src +++ b/src @@ -213,9 +213,14 @@ class History: selection.reverse() return selection def tip(self): - "Return the latest revision in the repo." - # FIXME: should return the current branch tip. - return self.revlist[0] + "Return the tip revision of the current branch." + s = self.native_to_revno(self.current()) + while True: + nxt = backend.succ(s, self) + if nxt is None: + return self.by_revno(s) + else: + s = nxt def native_to_revno(self, revision): "Map a native ID to a revno" for item in self.revlist: