]> thyrsus.com Git - src.git/commitdiff
Properly regression-test checkout.
authorEric S. Raymond <esr@thyrsus.com>
Fri, 7 Nov 2014 22:19:08 +0000 (17:19 -0500)
committerEric S. Raymond <esr@thyrsus.com>
Fri, 7 Nov 2014 22:19:08 +0000 (17:19 -0500)
src
srctest

diff --git a/src b/src
index cb3050039f5605bc411be06796ad2da0eec63793..b74fb792993475d6bc7e295a2a224425b33b3611 100755 (executable)
--- a/src
+++ b/src
@@ -465,7 +465,7 @@ def log_method(*args):
 def checkout_method(*args):
     "Refresh the working copy from the history file."
     (revspec, args) = preamble("checkout", args)
-    if revspec and len(revspec) > 1:
+    if revspec and revspec[0] != revspec[1]:
         croak("checkout needs an empty or singleton revision spec")
     for arg in args:
         master = RCSLog(arg)
diff --git a/srctest b/srctest
index d9c45719f46ff008ae2224cfee7609994fbf0bf4..a6c843a466da0d97948c8afad56ecb27e764d758 100755 (executable)
--- a/srctest
+++ b/srctest
@@ -25,6 +25,7 @@ check "smoke test"
 cat >testfile1 <<EOF
 Now is the time
 EOF
+cp testfile1 testrev1
 
 src $TESTOPTS add testfile1 >/dev/null
 check "add"
@@ -39,6 +40,7 @@ cat >testfile1 <<EOF
 Now is the time
 for all good men
 EOF
+cp testfile1 testrev2
 
 echo "Second comment" | src $TESTOPTS commit - testfile1 >/dev/null
 check "commit with -"
@@ -75,6 +77,7 @@ Now is the time
 for all good men
 to come to the aid of foo
 EOF
+cp testfile1 testrev3
 
 echo "Third comment" >testfile4
 src $TESTOPTS commit -f testfile4 testfile1 >/dev/null
@@ -106,6 +109,14 @@ src $TESTOPTS list 5 testfile1 >testfile7 2>&1
 diff testfile6 testfile7
 check "oob revision spec check"
 
-# to do: checkout, tag, fast-export
+for rev in 1 2 3
+do
+    src $TESTOPTS checkout $rev testfile1 >/dev/null
+    check "revision $rev checkout test"
+    diff -u testrev${rev} testfile1
+    check "revision $rev content test"
+done
+
+# to do: tag, fast-export
 
 # end