cfv [global_options] {command} [command_options] [command_arguments]
cfv [--version
]
cfv [--help
]
This manual page documents briefly the cfv command, version 0.5.4.
cfvers is a version control system designed for the management of configuration files in Unix-like operating systems..
cfv is the command-line client used to register files into cfvers, restore them, display information about the contents of the repositories, etc.
cfv provides several command for working with files and repositories, each of them having their options. The most used of them are:
add
item...Registers new items into the repsository. This signals the intent to track a file for changes.
store
item...Stores a new version of item into the repsository.
retrieve
item...Retrieves an item from the repository. If it denotes a directory, all items registered in the repository underneath it are restored.
These options follow the usual GNU command line syntax, with long options starting with two dashes (`-'). cfv has two classes of options: global options and command options.
These are the global options to cfv
-h
, --help
Show summary of options.
--version
Show the version of the program and copyright information.
--local
Connect directly to the repository, in contrast to connecting through the cfversd server. When selecting this option, you can specify the repository through:
--rtype
Selects the repository type: either sqlite or postgresql.
--rdata
The connection info for the repository; this is repository-dependent. For sqlite it is a file name; for postgresql, a string of the form "dbname=mydb user=myuser password=mypw host=...".
--remote
Connects through a cfversd server. When selecting this option, you can also give the connection details directly in the command line:
-s, --server
HOSTNAMEThe name or address of the server.
-p, --port
PORTThe port on which the server is listening.
-u, --username
USERThe username used for authentication to the server
-aAREA
, --area=AREA
Selects the area to be used. By default, the area used is the one called 'default'.
Here are the brief descriptions of the cfv commands:
Registers a file for tracking.
Registers new files in the directories already tracked by the repository.
Shows the contents of a item from the repository. For regular files, this will be the contents of the file, while for other type of items this will be a textual representation of the item.
Shows differences between the contents of the repository and the filesystem, or between versions in the repository for the arguments. The items are checked in differences in both data and metadata.
Exports the contents of the repository either in "tar" or "sha1sum" format.
Searches the entries in the repository by their attributes.
Lists the items in the repository.
Show the changelog of the revision(s) selected. By default, show the full changelog of all versions.
Registers a virtual file for tracking.
Retrieve some or all items from the repository.
Show information about the metadata of selected items, like the stat command-line utility from GNU coreutils.
Stores new versions of files to the repository.
This section describes the command_options that are available across several cfv commands. Not all commands support all of these options; each option is only supported for commands where it makes sense. However, when a command has one of these options you can count on the same meaning for the option as in other commands. (Other command options, which are listed with the individual commands, may have different meanings from one command to another.)
-r REVSPEC
, --revision=REVSPEC
Selects the revision(s) to operate on. When a revision number is needed, a single number should be given. When two revisions are needed, they should be given separated by a colon (:).
This section describes the command options that are available for selecting entries. These options are common to the find and export commands.
--all-areas
Entries from all areas will be included in the search, not only from the current area
--all-entries
Return all matching entries for a file, not only latest. For example, when selecting revisions lower than 15, by default only the greatest revision lower than 15 would be selected. With this option, all revisions lower than 15 will be taken into consideration
--logmsg
REGEX PATTERNThe revisions with the log message matching the regular expression pattern given will be selected.
--revno
COMPARISON_OPERATOR REVNOCheck for matching revision numbers using the given comparison operator and revision number.
--empty
Select empty regular files and empty directories.
--gid
COMPARISON_OPERATOR NUMERIC_GIDSelect files having the group ID match the given comparison operator and numeric value.
--group
TEXT_OPERATOR GROUP_NAMESelect files having the group name match the given text operator and string value.
--uid
COMPARISON_OPERATOR NUMERIC_UIDSelect files having the user ID match the given comparison operator and numeric value.
--user
TEXT_OPERATOR USER_NAMESelect files having the user name match the given text operator and string value.
--regex
PATTERNSelect files having names matching regular expression PATTERN; this is a match on the whole path, not a search.
--iregex
PATTERNLike --regex
, but the match is case insensitive.
--size
COMPARISON_OPERATOR SIZEFile size matches the given comparison operator and size. size can be specified with suffix K, M, G, meaning units of kibi, mebi or gibibytes. By default, it is given in bytes.
--type
BOOLEAN_OPERATOR TYPEFile type is/is not the given argument. Type can be one of:
d for directories |
f for regular files |
l for symbolic links |
b for block devices |
c for character devices |
p for pipes |
s for sockets |
v for virtual files |
--nouser
No user corresponded to file's numeric user ID at store time.
--nogroup
No group corresponded to file's numeric group ID at store time.
--name
GLOBBase of file name (the path with the leading directories removed) matches the given shell pattern.
--iname
GLOBLike --name
, but the match is case insensitive.
--path
GLOBFile name (including path) matches the given shell pattern.
--ipath
GLOBLike --path
, but the match is case insensitive.
--lname
GLOBFile is a symbolic link whose target matches the given shell pattern.
--ilname
GLOBLike --lname
, but the match is case insensitive.
--links
COMPARISON_OPERATOR VALUEFile's number of links match the given comparison operator and numeric value.
--inum
COMPARISON_OPERATOR NFile's inode number match the given comparison operator and numeric value.
--perm
EQ | LT | GT MODEThe file's permission bits are equal to, contain any bits in, or contain all bits in the given MODE (octal value).
Here (finally) are details on all the cfv commands and the options each accepts.
add [-m MESSAGE
] [-c COMMITER
] [-n] [-q | -v] [--store=LEVEL] {-i FILE | ITEMS}
Register new files to be tracked in cfvers. The files can be given as arguments to the command or in a file denoted by the -i
option. The options mean:
The revision will have MESSAGE as the log message. If not given and standard input is a tty, it will be read (using $EDITOR or $VISUAL); otherwise the operation will abort.
Information about the commiter can be given using the -c
option. This should be used with something like 'cron-autocommit', or 'pre-upgrade-autocommit', since cfvers is designed to also run in automated mode; here the uid/gid would be 0 always, so we wouldn't get useful information from there. By default, the commiter string is equal to the login name of the user.
For directories, don't also add the files they contain.
Show only errors; the usual statistics are not shown.
Show additional information about all item being added.
For each item, cfvers can store a variable amount of information, determined at its registration time. The LEVEL argument can take the values:
metadata, meaning only the metadata of the files is stored and no information about their contents; this means that at most a stat(2) system call is made on the file;
checksum, meaning that in addition to the metadata, a checksum of the file (SHA1) is computed and stored;
full, meaning that metadata, checksum and file contents are stored;
The contents of the FILE (separated by newfiles) are added as additional file names to register. The FILE can also be -
, in which case standard input is used.
cat [-r REVNO
] {ITEM}
Show the data contents of the specified ITEM. By default, the latest version of the items is given; a different version can be selected by using the -r
option, with a single revision number.
The data contents is defined as:
The contents of the file.
The contents of the directory, formatted as in ls -1A.
The target of the symlink.
N/A
diff [-r REVNO
] [-l] {ITEM...}
Shows the difference between two versions of the arguments given. By default, the diff is made between the latest revision in the repository and the current version (in the filesystem).
The diff command can also be used to check which items have been modified, by using the -l
. In this case, the output will just contain the names of the items which are different between the revisions selected, one item per line.
For each item, the diff output has two parts, each optional. If the item's version differ in data contents, an unified diff over the two versions will be shows. If the versions differ in metadata, an unified diff over a textual representation of the metadata will be shown.
export [-F FORMAT
] [-o FILENAME
]
Exports the content of the repository. The export format can be "tar" or "sha1sum" (the default).
The entries to be exported can be filtered using the options under the Finding entries section.
The output destination can be specified with the -o
option. The default is standard output, which cand also be specifically denoted using "-" as the destination.
If the search options specify all revisions, then the file names will be prefixed with the path r=REVNO/.
find [-l] [-d]
The find command searches the contents of the repository.
The tests available are those described under the Find entries options section.
Output control: by default, the listing format is one item name per line, but it can be changed using the options -l
and -d
.
The -d
show an expanded format with informations like:
File /etc Registered at: 2003-10-13 21:33:17 Has revisions: 1-3, 4, 6, 8-10 File /etc/.pwd.lock Created at: 2003-10-13 21:33:18 Has revisions: 8-10
The -l
option shows an 'ls -l' like format, with the following fields:
mode representation (e.g. -rwxrwxrwx)
number of revisions in the repository
owner registered in last version
group registered in last version
size of item's last version
time, in ISO format: YYYY-MM-DD HH:MM:SS
name
list [--regexp REGEXP
] [--name GLOB
] [--format FORMAT
]
The list command lists all the items which are being tracked by the repository. Note that being tracked does not necesarily mean there is data in the repository about them, except their name. An item could have no entries, or it could exist in the repository just to let the software know it must not store any information about it.
The --regexp
and --name
options restrict the output to names matching (not anchored) the regexp, respectively the shell globbing pattern.
The --format
option changes the output. Its argument is a string (used by Python interpolation mechanism), which can contain:
normal characters except %
a '%%' sequence to denote an % in the actual output
a % character, followed by the name of a property of the item in paranthesis, followed by a C printf format specifier.. The allowed properties are:
The id of the item, of type integer. You can use either the 'i', 'd', 'x' or 's' conversion specifiers.
The time when the item has been added to the repository. It is of type string.
The name of the item, type string.
A single character expressing the desired storage level of an item. Currently defined values:
No information will ever be stored about this file.
A regular file with only metadata stored (the information collected by a stat(2) call.
A regular file with metadata and checksum stored. This means that differences in file contents will be detected by the diff command (hopefully, as long as there are no SHA1 collisions), but the repository is kept small.
A regular will with all attributes stored: metadata, checksum and contents.
A virtual file.
Unknown status. Probably a desynchronisation between cfv and the cfvers library.
log [-r REVNO[:REVNO]
] {ITEM...}
The log command shows the log messages of the repository. By default, the full log is shown, however you can restrict the log to a revision or a range of revisions using the -r
option with one or two arguments. The one argument form will restrict the output to only one revision, while the two-argument form will restrict the output to all revisions between those given (inclusive).
You can also restrict the log messages to some items by giving them as arguments to the command.
The final set of the revisions show is the intersection of the set of selected revisions (using -r
) and the set computed as the union of the revisions numbers of the items given.
register [-m MESSAGE
] [-c COMMITER
] [-q] {NAME} {CMDLINE...}
Register a virtual file to be tracked in cfvers. The file look like a normal file, except that its contents is taken from the output of a command, not from an actual file. Beside that, it does not have the usual metadata (owner, permissions, etc.) but it has an additional attribute: the exit code. The options mean:
The revision will have MESSAGE as the log message. If not given and standard input is a tty, it will be read (using $EDITOR or $VISUAL); otherwise the operation will abort.
Information about the commiter can be given using the -c
option. This should be used with something like 'cron-autocommit', or 'pre-upgrade-autocommit', since cfvers is designed to also run in automated mode; here the uid/gid would be 0 always, so we wouldn't get useful information from there. By default, the commiter string is equal to the login name of the user.
Show only errors; the usual statistics are not shown.
retrieve [-r REVNO
] [-d DIRECTORY
] [-n] [-s] [-q] {ITEM...}
The retrieve command restores the given items to the filesystem. By default, the latest version in the repository is restored; use -r
REVNUM to restore another version.
A message is shown for each item restored; this can be disabled using the -q
option.
By default, the items are restored to their original location; this behavior can be modified using the -d
and -s
switches.
Also by default, any items given which are directories will be processed recursively, restoring all items which can be reached starting with them. To disable this behavior, use the -n
option.
The -d
DIRECTORY option can be used to change to top directory of the restore process: for example, the item /etc/passwd can be restored under /tmp/etc/passwd by giving the option -d/tmp
.
The -s
option can be used to disable the restoration of paths from the filenames. With the above example, to restore the file /etc/passwd to /tmp/passwd you can use the command line cfv retrieve
-d/tmp
-s
/etc/passwd. Note that using just -s
alone, all files will be restored under /.
Note that the restoration process will not be able to restore the ctime of any items. This is by design in the POSIX filesystem layer: the ctime is for metadata modifications, and the mtime/atime pair for data write/read accesses. Thus a ctime modification would trigger a ctime modification, since the ctime itself is part of metadata, rendering useless the ctime modification :). A read attribute for the metadata would be innapropriate, IMHO, because such reads are made in a great amount. The list of other restrictions in the restore process follows:
These files will have almost all attributes restored. Of course, devices files restoration won't restore your devices :-)
The restoration of directories is special, since they are non-leaf items. All other types currently supported by cfvers are leaf items and thus can be restored fully by themselves. However, the content of directories cannot be restored if it hasn't been stored in the repository.
Also, the mtime attribute of directories is not currently restored correctly, since the order of restoration is important: it should be depth first, but the parent directories need to be created first. To fix this, we need to make a double pass - currently all restores are one-shot.
The problem with simbolic links is that POSIX doesn't specify functions to set some attributes of the symbolic links themselves: for example, utime(2)
or utimes(2)
always act on the symbolic link target. Also, the chown(2)
doesn't work on symbolic links. The owner/group can be changed, though, using the lchown
function.
These are not restored, as they don't contain any payload, and they are usually created by the application at startup time.
stat [-r REVNO
] [ITEM...]
The 'stat' command displays information about the metadata of the given items (or all items in the repository), as recorded when they were stored in the repository.
By default, information about the latest revision is given, however you can select a certain revision by passing the -r
REVNO option.
The output is formatted to look like the output of the command line utility stat from GNU coreutils.
store [-n] [-m MESSAGE
] [-c COMMITER
] [-q] {ITEM...}
This command stores new version of the items, if they have been modified. Note that if no items can't be read, the operation will abort; with at least one item successfully read, the operation will continue, generating warnings for items with problems.
A log message is shown for each item being stored; to disable this, use the -q
option.
The log message must be given using the -m
option.
Information about the commiter can be given using the -c
option. This should be used with something like 'cron-autocommit', or 'pre-upgrade-autocommit', since cfvers is designed to also run in automated mode; here the uid/gid would be 0 always, so we wouldn't get useful information from there. By default, the commiter string is equal to the login name of the user.
This manual page was written by Iustin Pop <iusty@k1024.org>
The manual pages cvs(1) and svn(1) were used as sources of inspiration (and copy-paste in some cases), since these are real versioning programs :-), with proper man pages.