From: Eric S. Raymond Date: Thu, 11 Nov 2010 15:57:34 +0000 (-0500) Subject: Safety measure. X-Git-Tag: 0.1~56 X-Git-Url: http://thyrsus.com/gitweb/?a=commitdiff_plain;h=867f83ad5ec10c6657c73effeb911ba17aa4f4e9;p=rcs-fast-import.git Safety measure. --- 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.