There are a number of things you may want to do with files in a
BitKeeper repository, including:
-
editing
-
checking in
-
changing file permissions
-
renaming files
-
removing files
-
changing file permissions
This section explains how to do these common BitKeeper operations.
Checking Out And Editing Files
By default BitKeeper repositories do not automatically check-out
files.
Your directories may appear empty because of this default, to
check out (not lock) the files in your current directory,
 |
bk get
|
You may override this default with the ``checkout'' preference in
the config file.
See bk help config-etc or the
repository cofiguration section.
To check out read only versions of files, use the bk get
command.
To check out files for editing, you can either use bk get
-e or use the bk edit command.
With no arguments, the above commands will check out all the files
in the directory.
Use file names as arguments to checkout specific files, for
example,
 |
bk edit foo.c
|
It's also possible to use a shortcut to check out a locked version
of a file and edit it by doing something like:
bk vi file or bk emacs file
(any editor can be used.)
It is also possible to set the environment such that
editor file
for example, vi
file
will check out the file for editing and open the file in vi.
To do this:
 |
set EDITOR=vi
alias vi=`bk vi`
|
Again, this will work for any editor, vi is used as an example.
Miscellaneous File Operations
-
Changing File Permissions
BitKeeper stores revision history of file permissions just as it
does the file contents.
To change file permissions, use
 |
bk chmod file
The command respects whatever syntax your native chmod
command uses. It does this by running chmod on the file and then
copying the resulting modes into the revision history.
|
-
Renaming Files
An advantage BitKeeper has over many other configuration
management systems is that it keeps track of file names so
renaming is easy.
To rename a file, do
 |
bk mv file new_file
|
Directories can be renamed in a similar manner with the command:
 |
bk mvdir dir new_dir
|
-
Removing Files
There are two ways to remove files from the source tree.
The first, and safest, is
 |
bk rm file
|
and the second, and irreversible, is
 |
bk gone file
|
Using bk rm will move the file from your tree into the
BitKeeper/deleted directory.
All future operations will ignore the file unless you name it
explicitly.
In the event that you need to resurrect it, you may do that with
 |
bk unrm file
|
If you wish to obliterate all traces of a file use the bk
gone command as follows:
 |
bk gone `bk prs -hr+ -d:KEY: file`
rm file SCCS/s.file
|
The gone command records the fact that the file is really gone and
tells BitKeeper to not complain when it can't find it.
Note that these commands must be run in each repository where you
want the file removed.
BitKeeper does not propagate removed files since that could be
used maliciously as a virus.