www.delorie.com/gnu/docs/diffutils/diff_74.html   search  
Buy GNU books!

Comparing and Merging Files

[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

10.9 Backup File Names

Normally, patch renames an original input file into a backup file by appending to its name the extension `.orig', or `~' if using `.orig' would make the backup file name too long.(1) The `-z backup-suffix' or `--suffix=backup-suffix' option causes patch to use backup-suffix as the backup extension instead.

Alternately, you can specify the extension for backup files with the SIMPLE_BACKUP_SUFFIX environment variable, which the options override.

patch can also create numbered backup files the way GNU Emacs does. With this method, instead of having a single backup of each file, patch makes a new backup file name each time it patches a file. For example, the backups of a file named `sink' would be called, successively, `sink.~1~', `sink.~2~', `sink.~3~', etc.

The `-V backup-style' or `--version-control=backup-style' option takes as an argument a method for creating backup file names. You can alternately control the type of backups that patch makes with the PATCH_VERSION_CONTROL environment variable, which the `-V' option overrides. If PATCH_VERSION_CONTROL is not set, the VERSION_CONTROL environment variable is used instead. Please note that these options and variables control backup file names; they do not affect the choice of revision control system (see section 10.2 Revision Control).

The values of these environment variables and the argument to the `-V' option are like the GNU Emacs version-control variable (see section `Backup Names' in The GNU Emacs Manual, for more information on backup versions in Emacs). They also recognize synonyms that are more descriptive. The valid values are listed below; unique abbreviations are acceptable.

Always make numbered backups.

Make numbered backups of files that already have them, simple backups of the others. This is the default.

Always make simple backups.

You can also tell patch to prepend a prefix, such as a directory name, to produce backup file names. The `-B prefix' or `--prefix=prefix' option makes backup files by prepending prefix to them. The `-Y prefix' or `--basename-prefix=prefix' prepends prefix to the last file name component of backup file names instead; for example, `-Y ~' causes the backup name for `dir/file.c' to be `dir/~file.c'. If you use either of these prefix options, the suffix-based options are ignored.

If you specify the output file with the `-o' option, that file is the one that is backed up, not the input file.

Options that affect the names of backup files do not affect whether backups are made. For example, if you specify the `--no-backup-if-mismatch' option, none of the options described in this section have any affect, because no backups are made.

[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

  webmaster   donations   bookstore     delorie software   privacy  
  Copyright 2003   by The Free Software Foundation     Updated Jun 2003