]> thyrsus.com Git - src.git/commitdiff
A range argument to cat would be an invitation to shoot self in foot.
authorEric S. Raymond <esr@thyrsus.com>
Wed, 12 Nov 2014 13:39:09 +0000 (08:39 -0500)
committerEric S. Raymond <esr@thyrsus.com>
Wed, 12 Nov 2014 13:39:09 +0000 (08:39 -0500)
Diallow this.  Also, get rid of History __getitem__ - it's a defect attactor.

Regression test passes.

NEWS
src
src.asc

diff --git a/NEWS b/NEWS
index dfaf2133fd7405be73eb34371467dfbdebac28c8..e4d0d6e30963a47382c2f86bb0856075248e5a27 100644 (file)
--- a/NEWS
+++ b/NEWS
@@ -1,5 +1,8 @@
 `                      src project news
 
+Repository head:
+   Fixed yet another fast-export bug.
+
 0.5: 2014-11-11
    Removed src add.  The first src commit to a file adds it.
    Branching is mostly working - branch delete isn't implemented,
diff --git a/src b/src
index d7c2bd90d842fcb85c1f644a8c5aa9c426404d4b..e288e3fb8d8604056ea67a751ed27118e48b20df 100755 (executable)
--- a/src
+++ b/src
@@ -176,8 +176,6 @@ class History:
         backend.parse(self)
     def __len__(self):
         return len(self.revlist)
-    def __getitem__(self, i):
-        return self.revlist[i]
     def current(self):
         "Return the revision currently checked out."
         try:
@@ -215,6 +213,8 @@ 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]
     def native_to_revno(self, revision):
         "Map a native ID to a revno"
@@ -624,13 +624,15 @@ def status_method(*args):
 def cat_method(*args):
     "Dump revision content to standard output."
     ctx = CommandContext("cat", args)
+    if ctx.is_range():
+        croak("cat refuses to cough up a hairball")
     for arg in ctx.args:
         metadata = History(arg)
         ctx.resolve(metadata)
         if ctx.is_empty():
             ctx.select_tip(metadata)
         with backend.lifter(arg):
-            for item in metadata:
+            for item in metadata.revlist:
                 if item.revno in ctx:
                     backend.cat(arg, item.revision)
 
@@ -969,7 +971,7 @@ class RCS:
             rev = self.joinrev(n[:-2])
         for (i, item) in enumerate(metadata.revlist):
             if item.revision == rev:
-                return metadata[i].revno
+                return metadata.revlist[i].revno
         return None
     def succ(self, revno, metadata):
         "Our successor on the current branch (1-origin)."
@@ -979,7 +981,7 @@ class RCS:
         rev = self.joinrev(n)
         for (i, item) in enumerate(metadata.revlist):
             if item.revision == rev:
-                return metadata[i].revno
+                return metadata.revlist[i].revno
         return None
     def branch_to_base(self, revid):
         "Go from a branch ID sticky tag to the revision it was based on."
diff --git a/src.asc b/src.asc
index 69a2fe610ddef6e4f4344ba4cad7430bde6c62e7..4177ff8b6dae558e59278efaf588817581ed6f71 100644 (file)
--- a/src.asc
+++ b/src.asc
@@ -64,8 +64,8 @@ src status ['file'...]::
    I = ignored, L = locked (recover with src checkout).  The A and L
    statuses should only occur if you have used RCS directly on a file.
 
-src cat [revision-range] ['file'...]::
-   Send the specified revisions of the files to standard output.
+src cat ['revision'] ['file'...]::
+   Send the specified revision of the files to standard output.
 
 src tag [list|-ldelete|del|-d}rename|-r] ['name'] ['revision'] ['file'...]::
    Create, rename, or delete a tag. With no or only file arguments, list tags.