]> thyrsus.com Git - src.git/commitdiff
Improved debugging. Correctly recognize numeric ranges.
authorEric S. Raymond <esr@thyrsus.com>
Wed, 12 Nov 2014 18:01:26 +0000 (13:01 -0500)
committerEric S. Raymond <esr@thyrsus.com>
Wed, 12 Nov 2014 18:01:26 +0000 (13:01 -0500)
Regression test passes.

src

diff --git a/src b/src
index 61c7f20951b5d28255ac9e96bbe6078ba69effeb..289bd65992173a105ce3f976749358c9f3154869 100755 (executable)
--- a/src
+++ b/src
@@ -76,8 +76,9 @@ def croak(msg):
     sys.exit(1)
 
 debug = 0
-DEBUG_COMMANDS  = 1    # Show commands as they are executed
-DEBUG_PARSE     = 2    # Debug logfile parse
+DEBUG_SEQUENCE  = 1    # Sequence debugging
+DEBUG_COMMANDS  = 2    # Show commands as they are executed
+DEBUG_PARSE     = 3    # Debug logfile parse
 
 quiet = False          # option -q: run more quietly
 pseudotime = False     # option -T: artificial clock for regression testing
@@ -184,6 +185,8 @@ class History:
             croak("no current revision? src checkout to recover")
     def current_branch(self, reversed=False):
         "Return a list of items that are descendants or ancestors of current."
+        if debug >= DEBUG_SEQUENCE:
+            print "current_branch(%s)" % self.current()
         p = s = self.native_to_revno(self.current())
         selection = [self.by_revno(p)]
         while True:
@@ -356,7 +359,7 @@ class CommandContext:
         if self.args:
             if self.args[0] == "--":
                 self.args.pop(0)
-            elif self.args[0].isdigit():
+            elif self.args[0][0].isdigit():
                 revspec = self.args.pop(0)
                 try:
                     if "-" in revspec or ".." in revspec:
@@ -442,12 +445,16 @@ class CommandContext:
             self.seq = [self.start]
             s = self.start
             while True:
-                s = backend.succ(s, self)
+                s = backend.succ(s, metadata)
                 if s is None:
                     croak("%s is not an ancestor of %s" % (self.start, self.end))
-                selection.append(s)
+                self.seq.append(s)
                 if s == self.end:
                     break
+        if debug >= DEBUG_SEQUENCE:
+            sys.stderr.write("selection: %s, branchwise is %s\n" % (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.revision))
 
 class CommentContext:
     def __init__(self, legend, args):