]> thyrsus.com Git - src.git/commitdiff
In list and log, explicit ranges are no longer reversed.
authorEric S. Raymond <esr@thyrsus.com>
Sat, 20 Dec 2014 12:43:59 +0000 (07:43 -0500)
committerEric S. Raymond <esr@thyrsus.com>
Sat, 20 Dec 2014 12:43:59 +0000 (07:43 -0500)
NEWS
TODO
src
srctest

diff --git a/NEWS b/NEWS
index c748885ccdfebd7cec630a176530689fc530f01e..fec1770aad3d4618f66dca8611459910ea7b5d6c 100644 (file)
--- a/NEWS
+++ b/NEWS
@@ -2,6 +2,7 @@
 
 Repository headL
    Reversed range expressons are now supported.
+   In list and log, explicit ranges are no longer reversed.
 
 0.17: 2014-12-19
    Undocumented 'add' command abolished; Emacs VC will use 'commit -a' instead.
diff --git a/TODO b/TODO
index beb615b54edb4b4e6dc2189e6d78505e299b1736..a149e723af510d4214e0fc422ba7546c4548383f 100644 (file)
--- a/TODO
+++ b/TODO
@@ -6,8 +6,6 @@
 * Next step: Run with files always 'unlocked' in RCS terminology, except
   during commit.  This would eliminate the need for the 'release' command.
 
-* Implement reverse ranges and remove automatic reversal in print and log.
-
 * Stop using rcsdiff, it leaks RCS version numbers onto the screen.
 
 * Should be possible to range-restrict a tag or branch listing.
diff --git a/src b/src
index 30280451a27285a36eed165241bd6b2a5e8b6563..af5751448dfde4c81837cdc3cdcd4a67b99f6148 100755 (executable)
--- a/src
+++ b/src
@@ -435,8 +435,7 @@ take a singleton revision spec.
 Some commands (log, list, diff, fast-export) accept a range or a singleton.
 
 Unless otherwise noted under individual commands, the default revision
-is the tip revision on the current branch and the default range is all
-revisions on the current branch.
+is the tip revision on the current branch.
 
 A good topic to read next would be 'commands'.
 """,
@@ -484,11 +483,13 @@ src list [-l n] [-f fmt] ['revision-range'] ['file'...]
    The summary line tagged with '*' is the state that the file would
    return to on checkout without a revision-spec. See 'help list' for
    information about custom formats. Use -l n to omit the listing length.
+   Default range is thec current branch, reversed.
 
 src log [-l n] ['revision-range'] ['file'...]
    Sends log information about the specified commits to standard output.
-   Use -l n to omit the listing length.
-   
+   Use -l n to omit the listing length.  Default range is the current branch,
+   reversed.
+
 src diff ['revision-range'] ['file'...]
    Sends a diff listing to standard output. With no revision spec, diffs
    the working copy against the last version checked in. With one revno,
@@ -927,7 +928,7 @@ class CommandContext:
         if self.seq is None:
             croak("revision spec hasn't been resolved")
         return i in self.seq
-    def resolve(self, metadata, backwards=True):
+    def resolve(self, metadata):
         "Resolve a revision spec that may contain tags into revnos."
         if debug >= DEBUG_SEQUENCE:
             sys.stderr.write("Entering resolve with start=%s, end=%s\n" % (self.start, self.end))
@@ -978,11 +979,11 @@ class CommandContext:
                 else:
                     e = e.parent
         if debug >= DEBUG_SEQUENCE:
-            sys.stderr.write("selection: %s, branchwise is %s\n" % (self.seq, "on" if self.branchwise else "off"))
+            sys.stderr.write("selection: %s, branchwise is %s\n" % ([x.revno for x in self.seq], "on" if self.branchwise else "off"))
             for item in metadata.revlist:
                 sys.stdout.write("%s\t%s\t%s\n" % (item.revno, item.date, item.native))
         # Because in the branchwise case the sequence is generated in reverse
-        if backwards != self.branchwise:
+        if self.branchwise:
             self.seq.reverse()
         # Range might have been reversed
         if reversed:
@@ -1186,7 +1187,7 @@ def list_method(*args):
             continue
         if custom is None:
             sys.stdout.write("= %s %s\n" % (arg, ((WIDTH - len(arg) - 3) * "=")))
-        for item in ctx.resolve(History(arg), backwards=True):
+        for item in ctx.resolve(History(arg)):
             # Must allow enough room for revno and date
             if item.selected():
                 mark = "*"
@@ -1230,7 +1231,7 @@ def log_method(*args):
         if ignore(arg) or os.path.isdir(arg) or not registered(arg):
             continue
         sys.stdout.write("= %s %s\n" % (arg, ((WIDTH - len(arg) - 3) * "=")))
-        for item in ctx.resolve(History(arg), backwards=True):
+        for item in ctx.resolve(History(arg)):
             sys.stdout.write("%-4d | %s | %s\n%s" \
                              % (item.revno, item.date, item.branch, item.log))
             sys.stdout.write(("-" * WIDTH) + "\n")
diff --git a/srctest b/srctest
index c88dc0b63ee8035eb18ece0fa6900ed321cf94ba..fed4bbc49d316e7488aaa54070abe9def33bdbd6 100755 (executable)
--- a/srctest
+++ b/srctest
@@ -485,7 +485,7 @@ Second comment.
 ------------------------------------------------------------------------
 EOF
 
-src $TESTOPTS log 2-6 sample >tryit
+src $TESTOPTS log 6-2 sample >tryit
 diff -u tryit sample.seqlog
 check "traversal by -"
 
@@ -505,7 +505,7 @@ Second comment.
 ------------------------------------------------------------------------
 EOF
 
-src $TESTOPTS log 2..6 sample >tryit
+src $TESTOPTS log 6..2 sample >tryit
 diff -u tryit sample.branchlog
 check "traversal by .."