From db5b85b74652b62bf8e29f2cdd15f905d66e926d Mon Sep 17 00:00:00 2001 From: "Eric S. Raymond" Date: Wed, 12 Nov 2014 13:01:26 -0500 Subject: [PATCH] Improved debugging. Correctly recognize numeric ranges. Regression test passes. --- src | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/src b/src index 61c7f20..289bd65 100755 --- 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): -- 2.43.0