![]() |
![]() |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Introduction The BitKeeper User's Guide explains both basic and more advanced usage of BitKeeper, including useful examples of commands, combining command options, and explanations of why things work the way they do. The following topics are covered:
If you are viewing this on the website, the chapter headings appear at the left of the window. Section and sub-sections within each chapter are listed in the column under the chapter when the chapter is selected. You can click on any chapter or section heading from any point in the website. The Site Map is very useful because it gives the option of viewing the manual as one very long html page, or to view each section as one long html page. Other available on-line documentation includes:
Administration of BitKeeper, what little may be necessary, is documented in Appendix B. BitKeeper Concepts Assuming a basic knowledge of software configuration management (SCM), the first section of this manual describes what concepts are unique to BitKeeper and how they may effect your method of source management. The following topics are covered:
BitKeeper BitKeeper is a source management system that enables developers to work concurrently on the same project. Unlike most other source management tools, BitKeeper was designed to be a scalable system that supports globally distributed development, disconnected operation, change sets, and excellent merging facilities. Repository A BitKeeper repository is a collection of revision files, sometimes called a "tree" or a "repo". Each repository is a self-consistent unit, meaning everything necessary to do work is contained in each copy of a repository. A developer can make a copy, called a clone, of a repository, or delete repositories as needed with no ill effect on the shared repository or other developer's repositories. With BitKeeper each developer has his or her own repository. If the project is a one developer project, there is only one repository. For multiple developers, each developer will have his or her own local copy of the repository. BitKeeper moves changes between repositories using the local filesystem, rsh, ssh, SMTP, HTTP, or bkd - the BitKeeper network daemon. There exists a relationship between a repository and a clone of that repository that is called a parent-child relationship. When you clone a repository, to creat a place where you may work, BitKeeper remembers the place from which you cloned as the "parent". A clone of a repository is the child. The repository cloned from is the parent. Generally, there is some sort of structured hierarchy of repositories (see Usage Models). Changes typically propagate between parent and child, but changes may just as easily move ``sideways'' from one child to another as long as there is a common ancestor. ChangeSets In the documentation there are references to changesets and the ChangeSet file. A changeset is a grouping of related changes, and the medium for the exchange of data between BitKeeper repositories. The ChangeSet file is BitKeeper's metadata and is a record of all changesets which are in this repository. BitKeeper is unique in that the BitKeeper metadata is itself a revision controlled file, i.e., the metadata is versioned just like your data is versioned. A changeset is created by a developer to group related changes. In this way changes for a bugfix or feature addition can have some meaning by being grouped together. This method of grouping changes allows the notion of tasked-based entities rather than just file-based entities. By recording things that do change and things that don't change, BitKeeper can roll back to any changeset. In other systems, the tree must be tagged (or labelled) to roll back to that point. Unfortunately, it is often in hindsight that people want to do a tag. In BitKeeper, this is not a problem since it can roll back to any revision of the source tree at any time. What is Revision Controlled? BitKeeper revision controls
Any combination of changes to file type, file name, file permissions, file flags, and/or file contents can be merged because they are tracked in each revision. OpenLogging Open Logging is the sending of metadata information to a centralized, public web server, where it is sorted by project, date, and domain name. If you are a commercial user, Open Logging does not apply to you. Open Logging is an easy way for all developers to follow each other's progress. Because BitKeeper is a truly distributed system, without Open Logging there would be no centralized place to track the progress of a particular project. Open Logging is a requirement for non-paying customers that have multi-user repositories. It is optional for commercial customers. What is sent?
What is not sent?
People frequently think that Open Logging means their source code is published, but that isn't the case. 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:
Advanced Operations After getting started you can get into more advanced operations. Resolving Conflicts A conflict is when two or more people have changed information in different repositories and then try to update. Conflicts need to be resolved before the repositories can be synchronized. In some cases, conflicts that occur during a pull can be auto-merged. In other cases, manual merging must be done. This chapter outlines the manual merge process.
When is a Resolve is Needed?
Upon a Conflicts can occur because:
When possible, these changes are auto-merged. If BitKeeper could not merge all conflicts, you will have to do a manual resolution. Resolve
When a
You will be prompted for each type of conflict for each file. For each type of conflict there are available actions you can take, to see a list of available actions hit:
For file content conflicts use the file merge tool by hitting:
Resolve all the conflicts in the file merge tool and save. You will be back at the resolver prompt. If there are more files to merge, do those. If there aren't any more files to merge, commit the merges to a changeset by hitting:
While it is OK to quit out of resolve without finishing, the repository will be locked and remain locked until you return to resolve and finish up the merge process. Merging Content Conflicts In the file merge tool, the upper windows are the files to be merged. The lower left window is the merged file and the lower right window contains helpful hints. Whatever can be auto-merged will be auto-merged and displayed in the merge window. Unmerged conflicts will be indicated in the merge window and also will be indicated by a red bar above the hints window. You may scroll through unresolved conflicts with the "{" and "}" keys, previous unresolved conflict and next unresolved conflict, respectively. Scroll through all conflicts using "[" and "]", previous unresolved conflict and next unresolved conflict, respectively. Specifying Older Revisions One of the advantages of BitKeeper is the ability to ``go backward'' to any previous version of a file or release. There are many ways to do this and it's possible to specify a previous version of a file, a changeset, or a tagged release. This section explains how to specify older revisions at all of these levels. File level Sometimes it is necessary to resurrect an old version of a file. To do this it is necessary to
ChangeSet level To revert a repository to a state as of a previous changeset, it is necessary to
Tag level Resurrecting the repository as of the state of a tag is similar to that for ChangeSets in that it is necessary to
Note that if a repository is tagged by the same name more than once, the most recent instantiation of that tag name will be will be assumed to be the wanted tag. Tags A tag is a symbolic marker that provides a way to save the state of a repository as it was at time T and continue development in that repository while maintaining the ability to go back to how it was as of time T if the need arises. One of BitKeeper's strengths is ease of reproducibility, and tags, while not necessary for reproducibility, make it even easier. Tags are useful when saving stages of stability or when releasing beta versions when development is still occurring in the repositories. People tend to find it much easier to identify a release when it has a name that can be used to refer to it. This chapter will cover why tags are useful, how to create and delete tags, and how to use tags to re-create a tree as of a certain moment in time. Creating a Tag A tag may be created at any time. NOTE: Make sure that the repository has no modified or pending files; use bk status to verify. In the following examples, ``Done'' is the name used when tagging the repository. Any name will do, though using a name that holds meaning is recommended, such as Alpha, Beta, 1.0-release, etc. If the repository is ready to be tagged with the name ``Done'', type:
If it is discovered that a changeset should have been tagged after more changesets have been added to the repository, the -r option may be used to select the proper changeset. If the rev to tag is unknown, run bk changes to list all ChangeSets with comments, look through this list to find the revision to tag. Once the revision to tag has been found, type:
At Commit Time A tag may be set when committing a changeset using bk commit:
At this time citool does not permit tagging upon commit. This is a bug and will be fixed. Updating a Tag A frequent problem is that a changeset will be tagged with "Done" and then it is discovered that it isn't done. The tag may be updated to the later changeset by running the
command again. If there are multiple tags with the same name, BitKeeper assumes the most recently applied tag is the "real" tag. When browsing through a repository's history, you may notice two identical tags. To ensure proper reproducibility, tags are never removed, but rather are updated. To see all tagged changesets, type a ``t'' while in the bottom window of revtool. Use the text search window to find multiple instances of a tag. Revert to a tree as of Tag It is frequently helpful to look at a repository as of the state of a tag. To recover the repository as of a tag, use:
Branching Branching is a means for continuing separate development of one body of code in two or more trees. In BitKeeper, this is accomplished by cloning a new repository. This chapter will explain when to create a clone, how to create the branch, or clone, and work flow between clones. When to Create a Clone Branching, should be done when development in a tree starts diverging. Suppose, for example, there is a main line repository called stable. When stable reaches a frozen state near release, only proven code that fixes bugs may be incorporated to that tree, but development must be allowed to continue for both the required bug fixes and for development of the next version of the software. The solution is to create three different repositories for work:
Work Flow
How to Enforce Work Flow Branching is accomplished in BitKeeper by cloning a repository to another repository and using ``levels''. Levels are arbitrary numbers assigned to the repository that are used to control the flow of changesets between repositories.
To enforce the flow of work, the If the level of repository A is lower than the level of repository B, work may flow from A into B, but not from B into A. If the level of repository A is equal to the level of repository B, work may flow in both directions from A to B and B to A. In the example above, the level for stable-1.0 is N. The stable-1.0 repository was cloned to bugfixes-1.0 which takes on the level of its parent which is N. The level of dev-1.1, however, should be manually set to N+1 after it has been cloned from stable-1.0 to prevent new development work back flowing to stable-1.0 or bugfixes-1.0. To check the level of a repository:
To set the level of a repository:
Branching and Merging Once the repository levels are set appropriately, to propagate changes, use the the bk pull command. For example, to incorporate work from stable-1.0 to dev-1.1:
NOTE: It will most likely be necessary to merge files when propagating changes between branches. See the section on Resolving Conflicts. Revision Ranges Many commands can take ranges of deltas as an argument. A range is a continuous sequence of deltas, such as 1.1, 1.2, 1.3, and 1.4. Deltas may be specified by their revision number (1.2), or a symbol (alpha1), or a date (99/07/25). Specifying by Revisions
Some BitKeeper commands have options that allow the user to
specify a revision or range of revisions by revision number
(generally, the -r option).
To specify most recent revision: -r+ To specify a single revision: -r1.10 To specify a range of revisions: -r1.2..1.5 Specifying by Dates
Some BitKeeper commands have options that allow the user to
specify a date, rather than a revision, as the range.
Typically, the -c option is that which allows the date to be
specified.
If there is only one date specified, without a revision, then a
very useful form of the date is to specify a recent period of
time.
In the last year: -c-1Y (or -1y) In the last month: -c-1M In the last week: -c-1W (or -1w) In the last day: -c-1D (or -1d) In the last hour: -c-1h In the last minute: -c-1m In the last second: -c-1sIf you leave off the multiplier, 1 is assumed.
Revision and Date If there are two dates, or there is a date and a revision, then the date format is [+\-]YYMMDDHHMMSS with missing fields either rounded up or rounded down. Rounding is explicit if there is a "+" (rounds up) or a "-" (rounds down) prefix on the date. If there is no prefix, then the rounding is context sensitive. If the date is the first date i.e., the starting point, then the date is rounded down. If it is the second date in the range, then it is rounded up. So 98..98 is the same as 980101000000 .. 981231235959. Remote repositories Since BitKeeper is designed as a distributed system, there are multiple ways to exchange data between remote repositories. There is a BitKeeper daemon, bkd, which can be used via rsh, ssh, or as a stand-alone daemon, all described below. It is also possible to send and receive BitKeeper repository information via email, which is useful for people with low bandwidth connections or working from a disconnected laptop. bkd The BitKeeper daemon, bkd, is used to get information about a repository from a remote machine. A new instance of the daemon is created each time a remote repository is accessed. It is created in one of several ways:
BitMover recommends using ssh, since ssh provides a secure channel. The stand-alone daemon method has no security, other than the ability to run in read-only mode. If security is a requirement, use ssh to get to the daemon. The method used is determined by how the remote repository is referenced, as follows:
Anonymous Access The most common use of the stand-alone daemon is for anonymous access to a repository. To provide read-only, anonymous access, you can run:
This will allow anyone to read (but not write) all repositories on the system running the daemon. If you want to export a single repository, pick a port number, and do this:
This says to run in daemon mode, bind to port 5555, and disallow the "cd" and "push" commands. By disallowing the "cd" command, the daemon at port 5555 is tied to the repository in the current working directory (bkd needs to be run at the root of the repository). By disallowing the "push" command, the repository is protected from updates. Clients would then get to this repository by using the BitKeeper URL of:
i.e.,
If you want to have a repository which allows the world to read it, but restricts write access to a select few, you would use bkd to give out read only access, and tell people the BitKeeper URL for the foo project is:
For both read and write access that you want to give to a few
trusted people, you would give them ssh access to a machine with a
clone into which you allow pushes.
Suppose your
When they then push back to that location, they will be prompted for an ssh password that allows them to push. Please see bk helptool bkd and bk helptool Howto-bkd for more information and bkd examples. Sending Changes via Email The bk send command is used in lieu of bk push when the only connection to a remote machine is through email. To send a complete repository, use:
BitKeeper then generates a very large patch and mails it to user@host.com. To keep the size of the patch to a minimum, if you know a specific change you want to send (and you know that the other repository has the changes leading up to the change you want to send), you can do this:
or
Send remembers the changesets it has sent in
BitKeeper/log/sendlog-address
where
address
is like user@host.com.
When you don't specify a list of changesets to send,
If you lose the log file and you want to send it with the changes you know have been sent, the command to do that is:
You can wrap patches so that they do not get corrupted by mailers. BitKeeper currently supports wrapping with uuencode. The following (contrived) command sends a wrapped patch and applies it in /tmp/foo (which must exist):
Receiving Changes via Email
The
Headers and footers are automatically stripped from the message. Note that if you don't yet have a repository created for this patch, you must use the -i option to bk receive in order to create a new repository. Specifying the repository is optional; if it is unspecified, receive tries to use the current working directory. Advanced Topics This chapter provides information on how and why things work the way they do with BitKeeper, rather than how to accomplish specific tasks. The following topics are covered:
Repository Structure When a BitKeeper repository is setup, a number of directories are created for the storing of metadata associated with the revision history. All the directories live beneath the ``BitKeeper'' directory in the repository. The subdirectories are as follows:
In addition to the directories that get created, there are a number of files associated with each file kept under revision control, as follows:
Note that these files are for BitKeeper's use only and may be placed in a different location in the future. File Types BitKeeper can be used to track history on source code, documentation files, web pages, etc. The BitKeeper file types are
It is not possible to switch the type of a file from binary to text or vice versa at this time.
Some of the tools, such as A common recommended practice is to not include any kind of generated output files under any kind of revision control. If you have the input files and the process itself stored in a source management system such as BitKeeper, then you have what you need to reproduce the generated output. Repository Interactions
Repositories have a notion of ``parent/child'' relationships,
established at the time of the clone.
When the
Moving data between BitKeeper repositories is generally done using
It's important to note that because BitKeeper has a star topology and its possible to share data with any repository, it's not necessarily recommended. The parent pointer shorthand was designed to guide the user to a defined structure for repository interactions. BitKeeper allows data to flow any direction, but in practice you don't necessarily want it that way. It's good practice to think about how the data should flow. BitMover provides consulting on this for commerical customers who have purchased 25 or more seats. Deleting a Repository
Before deleting a repository, make sure you do not want it
anymore.
A repository is a master repository if it has no parent. To check:
If this is a master repository, the message
will be displayed. If you do not know whether a repository is a master repository or not, please consult the person in charge. To find pending changes or modified files:
Review the output. If there are any:
you should verify you will never need that work. If there's any chance the work may be needed, make sure it's in a safe repository somewhere before deleting this copy of the repository. Deleting a repository in bk is just like removing any other directory:
If the repository that is being deleted has children, be sure to reset those repositories' parents:
Name and String Limitations BitKeeper has the following limitations for file names and contents:
Reporting and Data Mining BitKeeper is essentially a database of everything that has ever happened with your source base. Your source base becomes an invaluable resource of information about what was done when and by whom. There are many ways to go about mining for this data. This chapter explains how to get at that information, whether it be by a quick one-time command or a regularly-run generated report that shows a particular group's activities for a period of time. File Level File State Information File State Information is general information about how many files are in a particular state. This includes information such as how many files are checked out; how many files are not under BitKeeper control; and how many files have checked-in deltas, but have not been committed to a changeset. To find out the number of files in a repository that are under revision control, not under revision control, modified (not checked in), checked in (not committed) use:
To find which files are modified, but not yet checked in:
To find which files are pending (checked in, but not yet committed):
To find all files the are not under revision control:
There are many options to bk sfiles that will give specific file information in the output. To see a more detailed list please look at the help page
File revision history File revision history is all the information collected about a file as it changes over time. GUI-tools File revision history is probably best viewed graphically by bk revtool. Upon startup, the bottom window displays the last month's revision history for the file or project. To view the comments for just one revision, left click once on that revision in the graph. To see the differences between two revisions, left click the older revision and right click on the newer revision. The differences will be displayed in the lower text window. Right click on another revision to diff with another revision. The default diff format is -u (unified diffs). To see the contents of a file, double click the left mouse button on the revision node in the graph. The text shown for the file is annotated with the user name and the latest revision that modified the line. Once the annotated file listing is shown, you can then click on the text to view the checkin comments associated with the chosen line. Double clicking on an annotated line brings up csettool and shows all of the other files that were modified in the same changeset as the selected line. To get a side-by-side view of the differences, select the two revisions and click on the "Diff tool" button. Command Line Interface BitKeeper has commands that will do the equivalent of bk revtool described above. The information must be extracted by various bk commands, as follows: To get a list of revisions of a file with revision comments:
The above could also be done with:
prs is a superset of sccslog, and used with options, is a powerful reporting tool for scripting. For more information on prs and scripting reports, see Reporting with Scripting. To display a line-by-line listing of a file showing who modified each line and in what version number of the file it was modified, use:
There are useful options to bk annotate to give more detailed information in the annotations including prefixing each line with the date it was modified, line number, and filename. Please see Command Summary for details. To restrict the set of lines displayed to those lines added in a specified revision or date range use:
or
In this case, the whole file is not displayed, instead, only the lines which were added in that range of changes are displayed. To display all lines in all versions of a file use:
This is useful for determining when a particular feature was added.
File Contents Contents of a single revision To view contents of a single revision of a file you may use bk get to get any revision of a file. If the revision wanted is not known, bk prs may be used to get a listing of each file revision with revision comments.
File content comparisons (one file) There are two methods to do file content comparisons: via the GUI tools or via the command line. To do file content comparisons via the GUI tools, use bk difftool. Differences between any two revisions of a file can be viewed, including the latest modified but not yet checked in version. It's also possible to compare files in different repositories with difftool. To see the differences between the latest modified version of a file and the latest checked in version of the file, use:
To see the differences between the modified version of a file and another revision:
To see the differences between any two specific revisions of a file:
To see the differences between a file in one repository and a file in a different repository:
To do file content comparisons via the command line, use bk diffs. Differences between the modified version of a file with the last checked in revision of that file, between any two revisions of a file in a repository, or between a specific revision and its preceding revision can be displayed. There is also the ability to do side-by-side diffs as well as author, date, and/or revision annotations if desired. To view the differences between a modified file and the last checked in version of that file, use:
To view the differences between a modified file and any previous version of that file:
To view the differences between any two revisions of a file:
To view the differences between a specific revision and its preceding revision:
There is also the ability to do side-by-side diffs as well as author, date, and/or revision annotations if desired. To do that use the options shown below individually or in combination to produce the desired output. To do side-by-side diffs:
To prefix lines with author annotations:
To prefix lines with the revision date annotations:
To prefix files with revision numbers:
As an example, suppose a side-by-side view of differences of revision 1.5 and 1.14 of file foo.c with author and date annotations is desired. To accomplish this the following command could be issued:
File content comparisons (all files in a directory or repository) Sometimes it is desired to see all the file changes made in a directory or repository since the last time the files were checked out. To view all differences of all modified files in one directory with the corresponding last checked in files (sometimes this output is very long so piping to more or less may be useful), use:
To view all differences of all modified files in a repository with the corresponding last checked in files (sometimes this output is very long so piping to more or less may be useful):
Project Level At the project, or repository, level there are many items which are tracked and can be used to get an overall view of the evolution of the project. You can:
All of which can help get the high level picture of what is going on in a project. Viewing Project History To see an overall picture of what's been happening in a repository, you would view the history of the ChangeSets in that repository as follows:
When launched the tool shows all ChangeSets for the repository. To view a specific ChangeSet, click on that ChangeSet box in the graph that's displayed in the upper window. To find which files are associated with a ChangeSet, double click on the ChangeSet box. To view changes made over a range of ChangeSets, left click on the ChangeSet with the lower revision number then right click on the ChangeSet with the higher revision number, and the cumulative list will be displayed in the lower window. Viewing ChangeSet Contents To get a detailed view of the last applied ChangeSet's contents, use
Csettool will show:
Csettool can also be launched from revtool by selecting a ChangeSet or range of ChangeSets and clicking on the View ChangeSets button in the top of the window. Viewing Tagged ChangeSets To get a list of all changesets which have been tagged use
If finding this information is done as part of a script, using prs may be more useful:
Command History Each BitKeeper repository keeps logs of the commands run in that repository. To get a history of the repository level commands, which are clone, commit, export, pull, and push use:
To get a history of all commands run in a repository use:
Debugging with BitKeeper BitKeeper makes debugging a faster process than can be found in other systems due to the differing levels of information gathered by the tool at the file level, changeset level, and repository level. There are a couple of different types of bugs that will be explained and then a process for debugging each kind of bug will be demonstrated. Build Bugs Build bugs are failures that occur during the build of a product. These can be anything from a missing semi-colon at the end of a line of c-code to a missing include file. Most often, the information needed is what file broke the build and who made the change in the file that broke the build. If the offending file is known, use bk revtool to find all the changes made to the file between the last build and the present build. Revtool shows the differences between any two versions of the file by left clicking on the last known good version of the file and right clicking on the buggy version of the file. Scanning the differences may make clear the line that broke the build. The differences are annotated with the user who last changed the line so if the line that introduced the bug is found, so is the author. Functionality Bugs Functionality bugs are unwanted and unexpected behavioral problems with the software as its running. Most often the process of tracking down a bug is: first find what file and what revision the problem is in, second is finding the changeset containing that revision of the file, and then have the engineer who caused the bug fix it. If a particular string is known, an error message for example, bk grep can help find the file and revision of the file that contains the particular string (and hopefully, the bug). The default output is annotated with file name and revision number. If you have a general idea in which directory to check, use:
if not, it is possible to do the search on all files in a repository by doing:
If the file has already been found (this can sometimes be accomplished by an assertion or core file) run revtool on the file.
Using revtool on the file, information about what was introduced in various revisions of the file can be found. When the revision that caused the bug is found, click on the View Changesets button, to see all the files associated with the one that caused the bug. This will give a picture of what happened at a particular point in time to help illuminate the problem. When All Else Fails - Binary Search BitKeeper employs the concept of binary search when trying to track down elusive bugs. A range of time of when the bug was introduced is needed. This can be sometime between the first changeset and the last changeset, or it can be sometime between the last known good version and the first known bad version. The range can be anything as long as the lower bound does not have the bug and the upper bound does have the bug. The lower bound is the earlier cset (without the bug) and the upper bound is the later cset (with the bug). Choose the changeset that occurs in the middle of the upper and lower bound. Clone the repository as of that changeset to a new repository and build the product.
Check if the resulting product has the bug. If so, the middle changeset is now the new upper bound. If not, the middle changeset is now the lower bound. Repeat. Code Reviews Code reviews are the checking of a developer's code by one or more reviewers to determine whether or not that code is suitable for integration with the main source base. Code reviews can be done using the Request To Integrate (RTI) process. This is done by "queuing" changes against a "gate". Queue A gate is the integration tree, it has what is believed to be good changesets. Things normally don't go into the gate unless they have passed peer review and regression tests on all platforms.
Have a gate for each active release.
For example, for BitKeeper we have 3.2.x and 3.3.x plus other
shorter lived gates coming and going as needed.
For each gate there is a gate queue.
You can do this all on a file server like so
/home/bk bk-3.2.x - 3.2.x gate bk-3.2.x-queue - changes which are ready, done, rejected bk-3.3.x - 3.3.x gate bk-3.3.x-queue - changes which are ready, done, rejected etc.In each release -queue there are directories called ready/ done/ rejected/The ready directory is where most of the activity is concentrated. In the ready directory there are three entries for each feature or bugfix: ready/feature - symlink to the repository containing the change ready/feature.RTI - text file containing the reason why this is needed ready/feature.REVIEWED - text file containing review comments Process The process to go through is:
Reporting with Scripting
Information about files or sets of files can be found using bk
prs, a command used to extract revision history and or metadata
from a file or set of files.
There are many options to prs, making it a powerful query language
for the BitKeeper database which is your source base.
The default behavior is to print a summary of each revision to
each of the specified files.
There are options to restrict the set if revisions to print, a
very commonly used one is
With no options specified, prs output defaults to giving
information on all revisions of all files under BitKeeper control
in the present directory.
The filename and range of revisions is listed first, offset by
Output Format
To specify a TAB character in the output, use \t; to specify a NEWLINE in the output, use \n; An example dspec which prints the file name (s.file) and the revision number is
In almost all cases, a trailing newline is not provided by any of the variables and one should be provided as needed. The list of variables which currently provide one are: COMMENTS, PATH, DEFAULT, SYMBOLS. If a multi-line variable is printed as one line, i.e., without $each() (see below) providing a prefix and/or a suffix, then the lines are separated by spaces. The list of variables with this behavior is: C, GB, FD.
Conditional Output
Conditional Statements BK/Web BK/Web is an interface for browsing repositories using the web. A project's ChangeSets, user statistics, the source tree and the tags in a tree can all be browsed using the BK/Web interface.
Appendix A: Installation This appendix explains how to install BitKeeper, including:
Installing The Software This section describes how to install BitKeeper. There are four steps to installing and verifying the BitKeeper installation:
Once the four steps are accomplished, BitKeeper will be ready for use. Supported Platforms
The download area contains a a number of images for different
platforms.
If you are wondering which one is the right image for your
platform, the table below may help.
The release number portion of the image name may be different as
we release new releases but the architecture portion should always
be the same.
Downloading Software Go to www.bitkeeper.com, click on downloads in the left column, and then click on "Go here to download BitKeeper". You will be asked for your name and email address. Once you submit your request for downloading instructions an email will be sent to the address you entered. Follow the download instructions sent, noting the login and password. Read the license. At the end of the license there are directories of BitKeeper releases. Click on the directory of the latest version of BitKeeper. There will be a list of BitKeeper binaries. The binary names are in the form
Click on the one that corresponds to the system upon which BitKeeper will be installed. Specify the destination directory and file name and click the "okay" button. Installing on Unix Once downloaded, change the permissions and execute the binary. For example, if the x86-glibc21-linux.bin binary was downloaded,
Enter the directory to install, /usr/libexec is recommended, and hit return. At this point BitKeeper should be installed and the BitKeeper regression tests should be run to verify the installation. Please see the Trouble Shooting section or contact support@bitmover.com if there are problems regarding the installation. Installing on Windows Once downloaded, double-click on the executable file to launch the BitKeeper installer. The installer will take a series of steps. The default installation is recommended for new users and can be accomplished by simply clicking on the Next, Okay, or yes buttons as they appear. The following is a more detailed look at the windows installation. Once the installer is running, you may click Cancel at any time to abort the installation. In the first installation window, if you are in agreement with the license and copyright and are ready to proceed, click the Next button. The default destination folder is C:\Program Files\BitKeeper. If you would like to change the destination folder you may do that via the Browse... button. Once the destination folder is chosen, click on the Next button. In the next window, choose the Program Manager group, the default is BitKeeper. Once you choose the Program Manager group click the Next button. In the next window, you may choose Back to change a setting, Cancel to abort the installation, or Next to install the BitKeeper software. BitKeeper requires cygwin and will attempt to install version 1.1.5 if it is not detected on the computer. Click Yes to install 1.1.5 or No to abort the installation. Read the message box with "Important Instruction" and click OK button when finished. To begin installation click Next. Choose Install From Local Directory and click Next. In the local package directory window click Next. Select the install root directory via Browse... button if the default is not correct. Make sure the "DOS text file type" and the correct "Install for" option are chosen and click Next. At this point BitKeeper and cygwin should be installed and the BitKeeper regression tests should be run to verify the installation. Please contact support@bitmover.com if there are problems regarding the installation. Verifying the installation BitKeeper should now be installed. To verify, run the bk regression tests on the system as follows:
At this point you should have downloaded BitKeeper, installed it, and run the regression tests on your system. If the regression tests did not pass please send mail to support@bitmover.com. Getting a License BitKeeper has three licensing models that are implemented depending on the user's preferences:
The use of BitKeeper with the Single User License is free. Please read the BitKeeper License for terms. If this model is appropriate for you, add lines to the BitKeeper/etc/config file as follows:
The use of BitKeeper for multiple users with Open Logging is also free. Please read the BitKeeper License for terms. If this model is appropriate for you, add lines to the BitKeeper/etc/config file as follows:
The use of BitKeeper for multiple users without Open Logging enabled requires a commercial license key. You can get a temporary license by sending an email request to bk_license@bitmover.com. The system is automated so responses should be almost immediate. Once you have the license key add a line to BitKeeper/etc/config file:
Please see Repository Configuration for further explanation of configuring BitKeeper. Appendix B: Administration BitKeeper is designed to work ``out of the box'' but it was also designed with flexibility in mind. It is possible to change the default configuration of the look and feel, to set up a list of files to be ignored by BitKeeper, and to enforce a software development policy you have in mind. This section describes how to do those things, plus gives you instructions on what to do if something ``goes wrong''. Backups One way to back up a repository is to have a trigger to push to a mirror repository every time an incoming push to the master repository occurs. So, if a developer pushes into Master, master pushes to the mirror. And the mirror only accepts pushes from Master, no one else. For more information see
Another way to do this is with traditional backup tools. BitKeeper repositories with no pending files can be safely backed up with any backup tool, such as tar or dump, etc. To see if there are any pending files, run
No output indicates no pending files.
WARNING
Why is it a problem? Because the two commits both created a changeset, and the changesets are different. This means that the same delta to foo.c now belongs to two different changesets. It is not fatal when this happens, but it may make it difficult to roll backwards to this point.
Suggestion
|