![]() |
![]() |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Getting Started This chapter explains how to get started with BitKeeper and documents commonly used BitKeeper commands. This chapter will teach how to:
This guide assumes the BitKeeper software has been installed for
you.
To verify it has been installed, try the
Before You Begin... First, if you are a developer and there already exists a Shared Repository that you will be working with, please skip to the Working With A BitKeeper Repository section. If you are the project lead and have not set up a BitKeeper project there are some things that you will need to think about to tailor BitKeeper to your development processes. Please review all the sections in Getting Started as well as the chapter on Usage Models and Access Control to help you start thinking about your development processes. Setting Up a Repository For every team using BitKeeper, there should be at least one person, maybe a project lead, who understands how to set up the first copy of a repository. This is done once per project and the only thing other team members do is clone the repository to make an individual workspace, or repository. This section explains how to set up a new BitKeeper repository. This section assumes an environment where there are no permissions restrictions. General Setup
When setting up a new project, the first instantiation of a
repository for the project must be done.
This is done once per project.
A project key is generated for each new project's first
repository.
This project key is propagated to all clones of this repository.
If project keys do not match when trying to do updates between
repositories the updates will fail.
Because of this, use You can setup a repository using the command line or graphical setup tool. For the command line:
For the graphical tool:
Repository Configuration BitKeeper repositories have a configuration file in BitKeeper/etc/config. This file contains information about the project, licensing methods, owner contact information, and user preferences. When setting up a repository, a config file must be filled out. The required fields are:
The rest of the fields are optional. Required Fields
The description: project description goes here
There also needs to be a contact person for the repository
following the email: user@domain
To tell BitKeeper which mode to run in, the logging specifications
must be outlined in the config file.
If you are a commercial client set the following:
logging: none license: your_license_keyIf you are an openlogging client set the following: logging: logging@openlogging.orgIf you are using the repository in single user mode set the following: logging: none single_user: your_login single_host: your_machine_name User Preferences
With BitKeeper, once files are checked in, by default the clear
text version does not exist.
It is possible to change that default to check out files in
read-only mode (set ``checkout:'' to ``get'') or edit mode (set
``checkout:'' to ``edit'').
If checkout: is left blank, the default behavior will occur.
checkout: The checkout preference can be set per user, per host, or per repository via these filters:
Owner Information
To specify contact information, so that someone from BitMover can
contact you if a problem with BitKeeper is discovered, add the
appropriate information:
contact: phone: You may create a global config file and use that upon every setup:
Populating a BitKeeper Repository Initially populating a repository will usually include an import of existing data. There are a couple of ways to get those files under revision control:
This section will teach:
For new BitKeeper users it's important to note that after files
are checked in, they no longer appear in your directory.
The process of checking in files removes the files from the
directory and places them in SCCS sub-directories.
Once in the SCCS sub-directory, the file can be retrieved with the
Importing Files If you have many existing files to move into a BitKeeper repository, you probably want to ``import'' them all at once. If you were starting a BitKeeper repository with a very small number of new files, the import step is probably unnecessary, and you could skip to the section on Adding Individual Files. Files that are not yet checked into a BitKeeper repository are what is imported. This would include plain text, RCS, CVS, SCCS, and patch files. To import:
where
type
is any of the types of non-BitKeeper files:
plain plain text file patch patch file (diffs) RCS RCS file CVS CVS file SCCS SCCS file Including and Excluding Files There may be times when it is necessary to import parts of a tree rather than the tree in its entirety. In these cases, there are options to import that may be used.
For more information on importing files, please see
Adding Individual Files
If you have just a small number of files with which to populate a
new BitKeeper repository, then the
If you have a large number of files to add to an existing package, an alternative to import is to generate a list of the files, edit the list to make sure there are no unwanted files (such as object files), and then check in the files from the list. For example:
Working with Repositories After the initial project repository is setup, developers can start working. First an individual workspace or repository must be created for the developer. Once this is done, the developer can make changes, share changes, and, if necessary, back out changes. This section describes how to do all of these operations. Cloning A Repository
If the previous mentioned
setup
example happened to be a single-developer project, that might be
the only repository necessary.
The developer would simply work in the master repository.
Most projects, however, are multi-developer projects and therefore
the master repository would be cloned for each developer on the
team.
After the first repository is created, subsequent copies of that
repository are created using
The Making Changes There are a number of things you may want to do with files in a BitKeeper repository, including:
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,
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
To check out files for editing, you can either use
It's also possible to use a shortcut to check out a locked version
of a file and edit it by doing something like:
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:
Again, this will work for any editor, vi is used as an example. Miscellaneous File Operations
If you wish to obliterate all traces of a file use the
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. Checking In Changes After you are done making changes, you will need to check in those changes and create a changeset. Checking In Files There are several ways to check in new and modified files. We suggest using the graphical checkin tool because it tends to generate better comments. There are also command line commands that you can use as well. To run citool, do
To use the command line to check in a new file use:
or
To use the command line to check in modified files use:
or
At some point, either when a logical unit of work is done, or when a team member is ready to share work with the team, the work in the repository should be committed to a changeset. A changeset is a grouping of changes and the smallest thing that can be propagated between repositories. Changesets have their own comments and their own revision numbers, separate and independent of the revision numbers and comments of the file changes it is grouping together. For example:
The above changeset (revision 1.1036) shows the description of changes to four files plus the comments.
The best way to commit changes to a changeset is to use the
For those who would prefer to use a command line interface, a
combination of the Sharing Changes With BitKeeper, because everyone has their own local copy of a repository, it's not immediately obvious to other team members when you have made a change. You must take action to share your changes. When you are ready to do so, you create a changeset by running bk citool or bk commit as described in the previous section Making Changes. After you've created the changeset, you will take the following steps to share your changes:
The details of these steps are as follows: Updating Your Work Area
After your work has been committed to a changeset as described in
the last section, the next step is to pull the latest work from
the rest of the team into your repository and resolve any
differences.
First use the Merging Conflicts
Assuming there are no overlapping changes, the If there are conflicts that need to be resolved manually, BitKeeper will output a message about the conflict and save the pulled tree in the RESYNC directory. See Resolving Conflicts for more detailed information. Sharing the Merged Work
After the the conflicts are resolved, or assuming there were no
conflicts to resolve and you're ready to share your work, use the
Backing Out Changes There are several ways to see and get back to an earlier version of a file or repository. File Level To see version history of a file:
Sometimes you will want to remove a version of a file. If it is not a part of a changeset you may strip the delta(s) from the revision history by doing:
Repository Level Like the File Level, you may browse the revision history of the repository using
If you have just pulled updates into your repository browse the incoming changes by using:
If you find that you do not want those updates, you can remove them from your repository by doing:
If you find a changeset that really should not be in the
repository you may use
If you don't want to remove a changeset, but would like to safely exclude its effects on your tree (you can change your mind later) use:
|