From de507d1c7b98e6937dcf803d003712e767779c55 Mon Sep 17 00:00:00 2001 From: "Eric S. Raymond" Date: Sat, 13 Nov 2010 09:54:09 -0500 Subject: [PATCH] Now seems to do deletes correctly. --- rcs-fast-import | 22 +++++++++++++--------- 1 file changed, 13 insertions(+), 9 deletions(-) diff --git a/rcs-fast-import b/rcs-fast-import index 68343f7..7d390f7 100755 --- a/rcs-fast-import +++ b/rcs-fast-import @@ -621,20 +621,22 @@ class RCS: fp.write(path) fp.write("\n") @staticmethod - def instantiate(path, copyfile): + def instantiate(path, copyfile=None): rcsdir = os.path.join(os.path.dirname(path), "RCS") if not os.path.exists(rcsdir): try: os.makedirs(rcsdir) except OSError: raise FatalException("can't create %s." % rcsdir) - if verbose >= DEBUG_SHUFFLE: - announce("linking %s to %s" % (os.path.relpath(copyfile), path)) - if not dryrun: - try: - os.link(copyfile, path) - except OSError, e: - raise FatalException("refusing to step on %s: %s." % (path, `e`)) + if copyfile: + if verbose >= DEBUG_SHUFFLE: + announce("linking %s to %s" % (os.path.relpath(copyfile), path)) + if not dryrun: + try: + os.link(copyfile, path) + except OSError, e: + raise FatalException("refusing to step on %s: %s." % (path, `e`)) + return rcsdir def normal_checkin(self, commit, path, legend, state=None): if self.roundtrip: comment = event.email_out() @@ -661,7 +663,8 @@ class RCS: RCS.record("M", path) def delete(self, commit, path, legend="delete"): "Mark a path deleted, but don't actually remove the master." - RCS.instantiate(path, "/dev/null") + RCS.instantiate(path) + open(path, "w").close() self.normal_checkin(commit, path, legend="delete", state="Deleted") RCS.record("D", path) def copy(self, commit, source, target, legend="Copy"): @@ -669,6 +672,7 @@ class RCS: if os.path.exists(RCS.master(target)): raise FatalException("copy to existing file") do_or_die("co %s" % RCS.master(source), legend) + RCS.instantiate(target) loud_rename(source, target) self.normal_checkin(commit, target, legend="copy") RCS.record("C", source) -- 2.43.0