From 13461fb9f0947817f202985aafc45940fcb2aab0 Mon Sep 17 00:00:00 2001 From: "Eric S. Raymond" Date: Thu, 11 Nov 2010 15:16:42 -0500 Subject: [PATCH] Storte deleted files ans empty with a Deleted state. --- rcs-fast-import | 36 +++++++++++++++++++----------------- rcs-fast-import.xml | 27 ++++++++++++--------------- 2 files changed, 31 insertions(+), 32 deletions(-) diff --git a/rcs-fast-import b/rcs-fast-import index fb9c716..e470926 100755 --- a/rcs-fast-import +++ b/rcs-fast-import @@ -7,7 +7,7 @@ # Requires Python 2.5 or newer and RCS 5.7 or newer. # """ -Usage: rcs-fast-import [-v] [-p] [-u] [-l] [-d] [-n] [-V] +Usage: rcs-fast-import [-v] [-p] [-u] [-l] [-n] [-V] Break the content of a git-fast-import stream on stdin into individual RCS master files in RCS subdirectories of the corresponding directory structure. @@ -25,10 +25,6 @@ revisions; with the -u option, check out but do not lock. The -V option displays the program version number and exits. -? displays this help and exits. -The -d option enables delete operations in the the input -stream. Normally, delete operations in the input stream are ignored so -as to maximize access to the unpacked history. - The -n option sets dry-run mode; parse the import stream, then go through all logic other than actually creating files. Useful for debugging in combination with -v. @@ -611,6 +607,19 @@ class RCS: # FIXME: Someday, do real branch structure here. if event.is_tip(): do_or_die("rcs -n'%s': %s" % (event.branch, " ".join(RCS.rcsfiles()))) + def delete(self, commit, path): + "Mark a path deleted." + file(path, "w").close() + if roundtrip: + comment = event.email_out() + else: + comment = event.comment + command = "ci -l" + command += " -sDeleted" + command += " -d'%s'" % event.committer.date.rfc822() + command += ' -m"%s"' % comment.replace('"', '\\"') + command += " " + path + " " + RCS.master(path) + os.remove(path) def rename(self, source, target): "Perform RCS renames." # Dodgy, but since user is more likely to be @@ -633,7 +642,7 @@ class RCS: do_or_die("co -u %s" % (" ".join(RCS.rcsfiles()),)) if __name__ == '__main__': - (options, arguments) = getopt.getopt(sys.argv[1:], "dlnpuvV?") + (options, arguments) = getopt.getopt(sys.argv[1:], "lnpuvV?") do_unlocked_checkouts = False checkout_mode = None roundtrip = True @@ -641,8 +650,6 @@ if __name__ == '__main__': if (switch == '-?'): print __doc__ raise SystemExit, 0 - elif switch == '-d': - do_deletes = True elif switch == '-p': roundtrip = False elif switch in ('-l', '-u'): @@ -669,15 +676,10 @@ if __name__ == '__main__': else: committables.append((op.path, op.mode, op.copyname)) elif op.op in ("D", "deleteall"): - # If we delete masters, we lose ability to - # retrieve old versions. - if do_deletes: - if verbose: - announce("%5s D %s" % (event.mark, op.path)) - if not dryrun: - vcs.remove(op.path) - elif verbose: - announce("%5s D %s ignored" % (event.mark, op.path)) + if verbose: + announce("%5s D %s" % (event.mark, op.path)) + if not dryrun: + vcs.remove(op.path) elif op.op == "R": if verbose: announce("%5s R '%s' '%s'" % (event.mark, op.source, op.target)) diff --git a/rcs-fast-import.xml b/rcs-fast-import.xml index 5119825..b1664f3 100644 --- a/rcs-fast-import.xml +++ b/rcs-fast-import.xml @@ -2,23 +2,23 @@ - + -rcs-fast-export +rcs-fast-import 1 Nov 11 2010 -rcs-fast-export -rcs-fast-export +rcs-fast-import +rcs-fast-import Development Tools -rcs-fast-export -surgical operations on repositories +rcs-fast-import +unpack a fast-import stream into an RCS repository tree - rcs-fast-export + rcs-fast-import -v -u -l @@ -60,9 +60,11 @@ as to maximize access to the unpacked history. all logic other than actually creating files. Useful for debugging in combination with -v. -R file operations rename corresponding RCS master files; C operations +In order to preserve history, D file operations do not delete +previously-created master files; instead, an empty file is checked +in as the content and the file's RCS state tag is set to "Deleted". +R file operations rename corresponding RCS master files. C operations initialize a new file. - BUGS @@ -73,11 +75,6 @@ to RCS. This tool deposits them as tagged revisions of a file named ANNOTATED-TAGS in the toplevel RCS directory. -If D or R operations are present in the import stream, the -conversion will not round-trip properly (that is the file structure -after rcs-fast-export | rcs-fast-import won't be an exact copy) with -differences near deleted and renamed files. - In each commit, the committer date entered in RCS metadata will be the committer date from the import stream, but the committer identity will be lost; all commits are checked in as if by the @@ -110,6 +107,6 @@ stream was not linear. AUTHOR Eric S. Raymond esr@thyrsus.com; project page at http://www.catb.org/~esr/rcs-fast-export. +url='http://www.catb.org/~esr/rcs-fast-import'>http://www.catb.org/~esr/rcs-fast-import. -- 2.43.0