]> thyrsus.com Git - src.git/commitdiff
Fix some comments and merge in a helper function.
authorEric S. Raymond <esr@thyrsus.com>
Tue, 11 Nov 2014 20:47:42 +0000 (15:47 -0500)
committerEric S. Raymond <esr@thyrsus.com>
Tue, 11 Nov 2014 20:47:42 +0000 (15:47 -0500)
Regression test passes.

src

diff --git a/src b/src
index eef9f2a19b0a2337aabda0bc1d09fba651abbb20..0871ad571892740f7214cd58135316251f9880e8 100755 (executable)
--- a/src
+++ b/src
@@ -179,10 +179,28 @@ class History:
     def __getitem__(self, i):
         return self.revlist[i]
     def current(self):
+        "Return a list of revnos that are descendants or ancestors of current."
         try:
             return self.lockrevs[0]
         except IndexError:
             croak("no current revision? src checkout to recover")
+    def current_branch(self, reversed=False):
+        "Return a list of revnos that are descendants or ancestors of current."
+        p = s = self.rcs_to_revno(self.current())
+        selection = [self.by_revno(p)]
+        while True:
+            p = backend.pred(p, self)
+            if p is None:
+                break
+            selection = [self.by_revno(p)] + selection
+        while True:
+            s = backend.succ(s, self)
+            if s is None:
+                break
+            selection.append(self.by_revno(s))
+        if reversed:
+            selection.reverse()
+        return selection
     def tip(self):
         return self.revlist[0]
     def rcs_to_revno(self, revision):
@@ -247,7 +265,7 @@ src status ['file'...]
    I = ignored, L = locked (recover with src checkout).  The L
    status should only occur if you have used RCS directly on a file.
 
-src cat [revision-range] ['file'...]
+src cat ['revision'] ['file'...]
    Send the specified revisions of the files to standard output.
 
 src tag [list|-l|delete|del|-d|rename|-r] ['name'] ['revision'] ['file'...] 
@@ -308,7 +326,7 @@ The omission of 'src remove' is a deliberate speed bump.
 """
 
 class CommandContext:
-    "Consime a revision specification or range from an argument list"
+    "Consume a revision specification or range from an argument list"
     def __init__(self, cmd, args, require_empty=False):
         if not os.path.exists(repodir):
             croak("repository subdirectory %s does not exist" % repodir)