integer revision. A revision range is a single revision, or a pair of
revisions M-N (all revisions numerically from M to N) or M..N (all
revisions that are branch ancestots of N and branch successors of M).
+If src complains that your revision spec looks like a nonexistent
+filename, you can prefix it with @ (this is always allowed).
Unless otherwise noted under individual commands, the default revision
is the tip revision on the current branch and the default range is all
The omission of 'src remove' is a deliberate speed bump.
""")
+
+def parse_as_revspec(token):
+ "Does this look like something that should be parsed aas a revision spec?"
+ if "-" in token or ".." in token:
+ return True
+ elif token.isdigit():
+ return True
+ elif token.startswith("@"): # Escape clause for tags that look like files
+ return True
+ else:
+ return False
+
class CommandContext:
"Consume a revision specification or range from an argument list"
def __init__(self, cmd, args,
if self.args:
if self.args[0] == "--":
self.args.pop(0)
- elif self.args[0][0].isdigit():
+ elif parse_as_revspec(args[0]):
revspec = self.args.pop(0)
+ if revspec.startswith("@"):
+ revspec = revspec[1:]
try:
if "-" in revspec or ".." in revspec:
self.branchwise = ".." in revspec
pass
else:
try:
- self.start = int(revspec)
+ self.end = self.start = int(revspec)
except ValueError:
- pass
- self.end = self.start
+ self.end = self.start = revspec
except ValueError:
croak("malformed revision spec: %s" % revspec)
if require_empty and not self.is_empty():
return i in self.seq
def resolve(self, metadata, reversed=True):
"Resolve a revision spec that may contain tags into revnos."
+ if debug >= DEBUG_SEQUENCE:
+ sys.stderr.write("Entering do_resolve with start=%s, end=%s\n" % (self.start, self.end))
if self.is_empty():
if self.default_to == "branch":
self.seq = metadata.current_branch(reversed=False)
try:
dispatch[commandline[0]](*commandline[1:])
except KeyError:
- sys.stderr.write("src: no such commandline as '%s'. Try 'src help'\n" \
+ sys.stderr.write("src: no such command as '%s'. Try 'src help'\n" \
% commandline[0])
except KeyboardInterrupt:
pass
integer revision. A revision range is a single revision, or a pair of
revisions M-N (all revisions numerically from M to N) or M..N (all
revisions that are branch ancestors of N and branch successors of M).
+If src complains that your revision spec looks like a nonexistent
+filename, you can prefix it with @ (this is always allowed).
Unless otherwise noted under individual commands, the default revision
is the tip revision on the current branch and the default range is all