From 02c45276e7ba78bfe88dd52a5f4291edc26478e7 Mon Sep 17 00:00:00 2001 From: "Eric S. Raymond" Date: Sat, 13 Nov 2010 16:15:00 -0500 Subject: [PATCH] Shove yet more stuff to parent class. --- rcs-fast-import | 31 ++++++++++++++++--------------- 1 file changed, 16 insertions(+), 15 deletions(-) diff --git a/rcs-fast-import b/rcs-fast-import index 65334ef..16f1bdc 100755 --- a/rcs-fast-import +++ b/rcs-fast-import @@ -618,35 +618,35 @@ class Generic: def precommit(self, event): #self.record("commit") pass - def supercheckin(self, commit, path, legend, state=None): + def supercheckin(self, commit, op, path, legend): "You knew the job was dangerous when you took it." if self.roundtrip: comment = event.email_out() else: comment = event.comment - self.checkin(commit, comment, path, legend, state=None) + do_or_die(self.checkin(commit, comment, op, path), legend) loud_remove(path) def modify(self, event, path, mode, copyfile): - "Perform RCS file checkins and modifications," + "Perform file checkins and modifications," self.sanecheck(event, path, mode, copyfile) self.instantiate(path, copyfile) - self.supercheckin(event, path, "modify") + self.supercheckin(event, "M", path, "modify") #self.record("M", path) def copy(self, commit, source, target, legend="Copy"): - "Perform RCS copies. Start the copy with no history." + "Perform copies. Start the copy with no history." if os.path.exists(self.master(target)): raise FatalException("copy to existing file") - self.checkout(commit, source, legend) + do_or_die(self.checkout(source, commit.branch), legend) self.instantiate(target) loud_rename(source, target) - self.supercheckin(commit, target, legend="copy") + self.supercheckin(commit, legend[0], target, "copy") #self.record("C", source) #self.record("T", target) def delete(self, commit, path, legend="delete"): "Mark a path deleted, but don't actually remove the master." self.instantiate(path) open(path, "w").close() - self.supercheckin(commit, path, legend="delete", state="Deleted") + self.supercheckin(commit, "D", path, "delete") #self.record("D", path) class RCS(Generic): @@ -665,18 +665,19 @@ class RCS(Generic): def sanecheck(self, event, path, mode, copyfile): if mode == "160000": raise FatalException("ignoring a submodule link %s", path) - def checkin(self, commit, comment, path, legend, state=None): + def checkin(self, commit, comment, op, path): "Check in a new revision - also used to create new masters." command = "ci -l" - if state: - command += " -s" + state + if op == "D": + command += " -sDeleted" command += " -d'%s'" % event.committer.date.rfc822() command += ' -m"%s"' % comment.replace('"', '\\"') command += " " + path + " " + self.master(path) - do_or_die(command, legend) - def checkout(self, commit, source, legend): + return command + def checkout(self, source, branch): + "Check out the latest revision correspinding to path and branch" # FIXME: not presently adjusted for commit's branch - do_or_die("co %s" % self.master(source), legend) + return "co %s" % self.master(source) def postcommit(self, event): # Save annotated tags for round-tripping for tag in event.taglist: @@ -754,7 +755,7 @@ if __name__ == '__main__': else: raise FatalException("unknown op type %s" % op.op) vcs.postcommit(event) - loud_rename("RCS", os.path.join(here, "RCS")) + loud_rename(vcs.repodir, os.path.join(here, vcs.repodir)) os.chdir(here) finally: nuke(tempdir, "cleaning up") -- 2.43.0