From 867f83ad5ec10c6657c73effeb911ba17aa4f4e9 Mon Sep 17 00:00:00 2001 From: "Eric S. Raymond" Date: Thu, 11 Nov 2010 10:57:34 -0500 Subject: [PATCH] Safety measure. --- rcs-fast-import | 7 +++++-- rcs-fast-import.xml | 4 ++++ 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/rcs-fast-import b/rcs-fast-import index 408d119..74154fb 100755 --- a/rcs-fast-import +++ b/rcs-fast-import @@ -578,9 +578,12 @@ class RCS: except OSError: raise FatalException("can't create %s." % rcsdir) if verbose >= DEBUG_SHUFFLE: - announce("copying %s to %s" % (os.path.relpath(copyfile), path)) + announce("linking %s to %s" % (os.path.relpath(copyfile), path)) if not dryrun: - shutil.copy(copyfile, path) + try: + os.link(copyfile, path) + except OSError: + raise FatalException("refusing to step on %s." % path) responsible = event.authors[0] or event.committer command = "ci -q -l" # If we were going to try to match committer or author diff --git a/rcs-fast-import.xml b/rcs-fast-import.xml index d41777c..9bd4729 100644 --- a/rcs-fast-import.xml +++ b/rcs-fast-import.xml @@ -34,6 +34,10 @@ stdin into individual RCS master files in RCS subdirectories of the corresponding directory structure. +It is recommended that you run this in an empty directory, as it +will terminate with error rather than stepping on files that already +exist in the current directory. + With the -v option, emit a twirling-baton prompt during stream read, and more progress messages during RCS writes. -- 2.43.0