"Consume a revision specification or range from an argument list"
def __init__(self, cmd, args,
require_empty=False,
- default_to=None):
+ default_to=None,
+ parse_revspec=True):
if not os.path.exists(repodir):
croak("repository subdirectory %s does not exist" % repodir)
self.start = self.end = None
if self.args:
if self.args[0] == "--":
self.args.pop(0)
- elif parse_as_revspec(args[0]):
+ elif parse_revspec and parse_as_revspec(args[0]):
revspec = self.args.pop(0)
if revspec.startswith("@"):
revspec = revspec[1:]
self.leader = ""
self.comment = None
self.force_edit = False
+ self.parse_revspec = True
if args:
if args[0] == '--':
+ self.parse_revspec = False
args.pop(0)
elif args[0] == "-":
self.leader = sys.stdin.read()
croak(" %s creation failed, check directory permissions." % repodir)
args = list(args)
comment = CommentContext("commit", args)
- ctx = CommandContext("commit", args, require_empty=True)
+ ctx = CommandContext("commit", args,
+ require_empty=True,
+ parse_revspec=comment.parse_revspec)
for arg in ctx.args:
if not os.path.exists(arg):
croak("I see no '%s' here." % arg)
croak("repository subdirectory %s does not exist" % repodir)
args = list(args)
comment = CommentContext("amend", args)
- ctx = CommandContext("amend", args)
+ ctx = CommandContext("amend", args, parse_revspec=comment.parse_revspec)
if ctx.is_range():
croak("amend cannot take a range")
for arg in ctx.args:
args = list(args)
custom = None
limit = None
+ parse_revspec = True
if args:
if args[0] == '--':
+ parse_revspec = False
args.pop(0)
elif args[0] == "-f":
args.pop(0)
croak("list -f requires a following string")
except ValueError:
croak("%s is not an integer" % limit)
- ctx = CommandContext("list", args, default_to="branch_reversed")
+ ctx = CommandContext("list", args,
+ default_to="branch_reversed",
+ parse_revspec=parse_revspec)
for arg in ctx.args:
if ignore(arg) or not registered(arg):
continue
"Report revision logs"
limit = None
args = list(args)
+ parse_revspec = True
if args:
if args[0] == '--':
+ parse_revspec = False
args.pop(0)
elif args[0] == "-l":
args.pop(0)
croak("list -f requires a following string")
except ValueError:
croak("%s is not an integer" % limit)
- ctx = CommandContext("log", args, default_to="branch_reversed")
+ ctx = CommandContext("log", args,
+ default_to="branch_reversed",
+ parse_revspec=parse_revspec)
for arg in ctx.args:
if ignore(arg) or not registered(arg):
continue
src $TESTOPTS branch -l sample >tryit
diff -u newlist tryit
-check "branch list check after delete" delete
+check "branch list check after delete"
cat >newlog <<EOF
= sample ===============================================================
diff -u newlog tryit
check "content after branch deletion"
+echo "Random content for numeric file" >23
+src $TESTOPTS commit -m "I don't know why you say goodbye" -- 23 >/dev/null
+check "commit of file with numeric name"
+
+cat >randomcontent <<EOF
+Random content for numeric file
+EOF
+
+src $TESTOPTS cat -- 23 >tryit
+diff -u randomcontent tryit
+check "cat of file with numeric name"
+
echo "srctest: all tests succeeded"
rm -fr $SANDBOX