# the workfile read-only except when it's explicitly checked out, SRC wants to
# leave it writeable all the time. Thus, the checkin sequence is "release
# lock; check in; assert lock". If this seems confusing, it's because in
-# RCS rerminology, locked is writeable and unlocked is read-only.
+# RCS terminology, locked is writeable and unlocked is read-only.
#
# The "src status" command needs to be fast so that Emacs VC won't be sluggish.
# It's written to only have to access the inodes of each master and workfile,
self.revlist = []
self.symbols = {}
self.branch = "trunk"
- self.delimiter = None
if not os.path.exists(backend.master(self.name)):
croak("%s is not registered" % self.name)
backend.parse(self)
croak("%s -f requires a following filename argument" % legend)
except OSError:
croak("couldn't open %s." % args[1])
- def edit(self, metadata):
+ def edit(self):
"Interactively edit a comment if required, then prepare for handoff."
if self.comment is None or self.force_edit:
editor = os.getenv("EDITOR") or "emacsclient"
commentfile = "/tmp/src%dtmp" % os.getpid()
do_or_die(editor + " " + commentfile, loud=True)
self.comment = open(commentfile).read()
- # Delimiter won't be set just after add
- if metadata.delimiter and metadata.delimiter in self.comment:
- croak("malformed comment")
+ # Can be removed if we every parse RC files directly
+ for badnews in backend.delimiters:
+ if badnews in self.comment:
+ croak("malformed comment")
if not self.comment.endswith("\n"):
self.comment += "\n"
# Because it's going to be handed back as a shell argument
croak("I see no '%s' here." % arg)
elif not os.path.exists(backend.master(arg)):
croak("%s is not registered." % arg)
- else:
- metadata = History(arg)
- comment.edit(metadata)
- with backend.lifter(arg):
- backend.checkin(arg, comment.content())
- if not quiet and len(args) > 1:
- announce("%s -> %d" % (arg, len(metadata)))
+ comment.edit()
+ for arg in ctx.args:
+ with backend.lifter(arg):
+ backend.checkin(arg, comment.content())
+ if not quiet and len(args) > 1:
+ announce("%s -> %d" % (arg, len(History(arg))))
def amend_method(*args):
"Amend coments in stored revisions."
croak("I see no '%s' here." % arg)
elif not os.path.exists(backend.master(arg)):
croak("%s is not registered." % arg)
- else:
- metadata = History(arg)
- ctx.resolve(metadata)
- if ctx.is_empty():
- ctx.start = metadata.tip().revno
- comment.edit(metadata)
- with backend.lifter(arg):
- backend.amend(arg,
- metadata.revno_to_rcs(ctx.start),
- comment.content())
- if not quiet and len(args) > 1:
- announce("%s : %d" % (arg, len(metadata)))
+ comment.edit()
+ for arg in ctx.args:
+ metadata = History(arg)
+ ctx.resolve(metadata)
+ if ctx.is_empty():
+ ctx.start = metadata.tip().revno
+ with backend.lifter(arg):
+ backend.amend(arg,
+ metadata.revno_to_rcs(ctx.start),
+ comment.content())
+ if not quiet and len(args) > 1:
+ announce("%s : %d" % (arg, len(metadata)))
def list_method(*args):
"Generate a summary listing of commits, one line per commit."
class RCS:
"Encapsulate RCS back end methods."
+ delimiters = ('----------------------------'
+ '=============================================================================')
class RCSLifter:
"Temporarily lift a master to the working directory."
def __init__(self, name):
sys.stderr.write("\t-> logheader\n")
state = "logheader"
metadata.revlist.append(RCSRevisionItem(metadata, maxrevno))
- metadata.delimiter = line
maxrevno += 1
elif state == "locks":
if not line[0].isspace():