"Class encapsulating RCS version-control operations."
historyfile = ".HISTORY"
def __init__(self):
+ self.roundtrip = False
if verbose:
if not os.path.exists("RCS"):
try:
def precommit(self, event):
if verbose:
RCS.record("commit")
- def modify(self, event, path, mode, copyfile, roundtrip):
+ def modify(self, event, path, mode, copyfile):
"Perform RCS file checkins and modifications,"
if mode == "160000":
raise FatalException("ignoring a submodule link %s", path)
os.link(copyfile, path)
except OSError:
raise FatalException("refusing to step on %s." % path)
- if roundtrip:
+ if self.roundtrip:
comment = event.email_out()
else:
comment = event.comment
uphere = os.path.basename(target)
do_or_die("co %s" % RCS.master(source), legend)
os.rename(source, uphere)
- do_or_die("ci -i -m'%s of %s' -l %s %s"
- % (legend, source, uphere, RCS.master(target)),
- legend.lower())
- # FIXME: Must hack the date on the copty so RCS won't barf.
+ if self.roundtrip:
+ comment = event.email_out()
+ else:
+ comment = event.comment
+ command = "ci -l"
+ command += " -d'%s'" % event.committer.date.rfc822()
+ command += ' -m"%s"' % comment.replace('"', '\\"')
+ command += " " + uphere + " " + RCS.master(uphere)
+ do_or_die(command, legend.lower())
RCS.record("C", source)
RCS.record("T", target)
os.remove(uphere)
try:
with Repository() as repo:
repo.fast_import(sys.stdin, progress=verbose>0)
+ repo.roundtrip = roundtrip
for event in repo.commits():
vcs.precommit(event)
for op in event.fileops:
if op.mode == "160000":
complain("cannot represent a submodule link in RCS")
else:
- vcs.modify(event, op.path, op.mode, op.copyname, roundtrip)
+ vcs.modify(event, op.path, op.mode, op.copyname)
elif op.op in ("D", "deleteall"):
if verbose:
announce("%5s D %s" % (event.mark, op.path))