From: Eric S. Raymond Date: Sat, 13 Nov 2010 07:34:58 +0000 (-0500) Subject: OK, successful creation of copy with no history. X-Git-Tag: 0.1~34 X-Git-Url: http://thyrsus.com/gitweb/?a=commitdiff_plain;h=c3e56c22c22aeaa0854ac5b27aa7cbdfb0a419e9;p=rcs-fast-import.git OK, successful creation of copy with no history. --- diff --git a/rcs-fast-import b/rcs-fast-import index 0c0ec2b..5e7b9f9 100755 --- a/rcs-fast-import +++ b/rcs-fast-import @@ -565,6 +565,7 @@ class RCS: "Class encapsulating RCS version-control operations." historyfile = ".HISTORY" def __init__(self): + self.roundtrip = False if verbose: if not os.path.exists("RCS"): try: @@ -611,7 +612,7 @@ class RCS: 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) @@ -629,7 +630,7 @@ class RCS: 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 @@ -670,10 +671,15 @@ class RCS: 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) @@ -714,6 +720,7 @@ if __name__ == '__main__': 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: @@ -723,7 +730,7 @@ if __name__ == '__main__': 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))