self.lockrevs = []
maxrevno = 0
if debug >= DEBUG_PARSE:
- sys.stdout.write("\t-> init\n")
+ sys.stderr.write("\t-> init\n")
state = "init"
for line in fp:
if debug >= DEBUG_PARSE:
- sys.stdout.write("in: %s\n" % repr(line))
+ sys.stderr.write("in: %s\n" % repr(line))
if state == "init":
if line.startswith("locks:"):
if debug >= DEBUG_PARSE:
- sys.stdout.write("\t-> locks\n")
+ sys.stderr.write("\t-> locks\n")
state = "locks"
elif line.startswith("symbolic names:"):
if debug >= DEBUG_PARSE:
- sys.stdout.write("\t-> symbols\n")
+ sys.stderr.write("\t-> symbols\n")
state = "symbols"
elif line.startswith("----------------------------"):
if debug >= DEBUG_PARSE:
- sys.stdout.write("\t-> logheader\n")
+ sys.stderr.write("\t-> logheader\n")
state = "logheader"
self.revlist.append(RCSRevisionItem(self, maxrevno))
+ self.delimiter = line
maxrevno += 1
elif state == "locks":
if not line[0].isspace():
if debug >= DEBUG_PARSE:
- sys.stdout.write("\t-> init\n")
+ sys.stderr.write("\t-> init\n")
state = "init"
else:
fields = line.strip().split()
elif state == "symbols":
if not line[0].isspace():
if debug >= DEBUG_PARSE:
- sys.stdout.write("\t-> init\n")
+ sys.stderr.write("\t-> init\n")
state = "init"
else:
fields = line.strip().split()
self.revlist[-1].log += "\n"
break
elif self.revlist:
- self.revlist[-1].log += line[1:]
+ self.revlist[-1].log += line
for item in self.revlist:
item.revno = maxrevno - item.revno
if debug >= DEBUG_PARSE:
croak("repository subdirectory %s does not exist" % repodir)
args = list(args)
comment = None
- if args[0] == '--':
- args.pop(0)
- elif args[0] == "-":
- comment = sys.stdin.read()
- args.pop(0)
- elif args[0] == "-m":
- args.pop(0)
- try:
- comment = args[0]
+ if args:
+ if args[0] == '--':
args.pop(0)
- except IndexError:
- croak("commit -m requires a following string.")
- elif args[0] == "-f":
- args.pop(0)
- try:
- comment = open(args[0]).read()
+ elif args[0] == "-":
+ comment = sys.stdin.read()
args.pop(0)
- except IndexError:
- croak("commit -f requires a following filename argument.")
- except OSError:
- croak("couldn't open %s." % args[1])
+ elif args[0] == "-m":
+ args.pop(0)
+ try:
+ comment = args[0]
+ args.pop(0)
+ except IndexError:
+ croak("commit -m requires a following string.")
+ elif args[0] == "-f":
+ args.pop(0)
+ try:
+ comment = open(args[0]).read()
+ args.pop(0)
+ except IndexError:
+ croak("commit -f requires a following filename argument.")
+ except OSError:
+ croak("couldn't open %s." % args[1])
(revspec, args) = preamble("commit", args)
if revspec is not None:
croak("commit doesn't take a revision spec")