]> thyrsus.com Git - src.git/commitdiff
Fix recently introduced bug in cat. Regression test passes.
authorEric S. Raymond <esr@thyrsus.com>
Mon, 10 Nov 2014 15:14:48 +0000 (10:14 -0500)
committerEric S. Raymond <esr@thyrsus.com>
Mon, 10 Nov 2014 15:14:48 +0000 (10:14 -0500)
src
srctest

diff --git a/src b/src
index 834eb613bddf25bf48f25cd689f61a8de873d7ff..1e57c919871cde31c9a3aad651ffa366c7350643 100755 (executable)
--- a/src
+++ b/src
@@ -332,6 +332,10 @@ class CommandContext:
         "Set the range to all revisions."
         self.start = 1
         self.end = len(metadata)
+    def select_tip(self, metadata):
+        "Set the range to the tip revision."
+        self.start = len(metadata)
+        self.end = None
     def __contains__(self, i):
         "Does the spec contain the given revno?"
         return i >= self.start and (self.end is None or i <= self.end)
@@ -570,7 +574,7 @@ def cat_method(*args):
         metadata = History(arg)
         ctx.resolve(metadata)
         if ctx.is_empty():
-            ctx.select_all(metadata)
+            ctx.select_tip(metadata)
         with backend.lifter(arg):
             for item in metadata:
                 if item.revno in ctx:
diff --git a/srctest b/srctest
index ba44935a4a434075b46eab684438b85e28d22476..912bf6a5f7f5158cfdbb771d646d58e6dbfc1695 100755 (executable)
--- a/srctest
+++ b/srctest
@@ -59,9 +59,8 @@ check "nonempty diff"
 echo "Second comment" | src $TESTOPTS commit - testfile1 >/dev/null
 check "commit with -"
 
-# FIXME: test fails for unknown reasons
-#src $TESTOPTS cat testfile1 | diff -u testfile1 -
-#check "content check after second commit"
+src $TESTOPTS cat testfile1 | diff -u testfile1 -
+check "content check after second commit"
 
 cat >testfile2 <<EOF
 = testfile1 =================================================================