Добавил:
Upload Опубликованный материал нарушает ваши авторские права? Сообщите нам.
Вуз: Предмет: Файл:
Linux Timesaving Techniques For Dummies.pdf
Скачиваний:
59
Добавлен:
15.03.2015
Размер:
15.98 Mб
Скачать

Simplifying CVS with cervisia 395

Simplifying CVS with cervisia

Life at the command line is great, if you’re used to living there. But sometimes a great tool can help speed up the process and, at the same time, be friendly and easy to use. Numerous graphical interfaces for CVS are available, but one that works great with KDE is included in most Linux distributions. It’s called cervisia.

Use the command line to create your initial repository. You can use cervisia to check out files or add files to an existing repository quickly, but it’s not the right tool for creating repositories.

cervisia is a CVS client that works with local or remote repositories and provides a user friendly and intuitive work atmosphere, as shown in Figure 52-1.

Figure 52-1: cervisia in action.

For more information about using cervisia across the Web, you can find the full documentation at cervisia.sourceforge. net/documentation/index.html.

Installing cervisia

cervisia is installed with KDE if you chose to include the KDE Software Development package when you first installed Linux.

If cervisia isn’t installed and you want to add it, use your distribution’s installer to install the KDE Software Development package (sometimes known as kdesdk).

Putting files in your sandbox

To start cervisia, click the Start Here icon on your desktop to open Konqueror. Navigate to your work directory (your sandbox), and click the brick wall icon at the far right of your toolbar.

Or, to create a new sandbox with cervisia, follow these steps:

1. Open the Konqueror browser and navigate to your work directory.

2. Choose Repository Checkout from the menu bar.

The CVS Checkout dialog opens, as shown in Figure 52-2.

Figure 52-2: The cervisia CVS Checkout dialog.

396 Technique 52: Archiving Changes with CVS

3. In the Repository field, enter the location of your repository (/cvs if you’ve been following along from the beginning of this technique).

4. Enter a . (dot) in the Module field.

5. Enter the pathname of your working directory in the Working Directory field.

6. Click OK.

cervisia checks out the contents of your CVS repository into your work directory.

This is either a bug or an undocumented feature, but we need to exit cervisia and restart it before the files show up in the browser window. These things happen.

The contents of your sandbox are displayed in your browser window and organized in the following columns:

File Name

Status

Revision Number

Tag/Date

Timestamp

To edit a file, double-click it, and the file opens in your favorite editor, ready to edit.

See Technique 3 to set up the MIME mappings for your editor. Between cervisia and MIME, you can edit and update your files in no time!

Adding more files to your repository

Often, you have to add files to your CVS repository — especially if you’re using it for tracking your system configuration files. To add a new file to your repository, follow these steps:

1. Enter the file location in the Location line of your browser.

2. Right-click the file you want to add, and from the pop-up menu that appears, choose Add to Repository.

cervisia’s View menu contains an option to Hide Non-CVS Files. If you can’t see a file that you know is there, make sure that you don’t have that option checked.

3. When the CVS Add dialog opens, verify that the file you’ve selected is listed and then click OK.

At this point, the file you’ve chosen has been earmarked for inclusion, but it isn’t actually in the repository.

4. Commit your addition by right-clicking the filename and choosing Commit.

5. Enter a log message (the more meaningful, the better) and click OK.

Your file is added to the repository.

Go work on the file in your sandbox!

Committing your changes

When you’ve finished editing a file, follow these steps to commit your changes to the CVS repository:

1. Right-click the filename and choose Commit.

A CVS Commit dialog opens (see Figure 52-3). It shows the name of the file (or files) you’re committing and supplies a field in which you can enter a log message.

2. Enter a log message and click OK.

cervisia checks in your changes.

Simplifying CVS with cervisia 397

cervisia has a handy problem solver built-in: the CVS Resolve feature. If a file is highlighted in red and the status is listed as Conflict, right-click the filename and choose Resolve from the pop-up menu. The CVS Resolve dialog opens (see Figure 52-4).

• Figure 52-3: The cervisia CVS Commit dialog.

The next time you (or another user) check out the file, you get a fresh copy that includes your most recent updates.

Diplomacy 101 — resolving conflicts

At some point in time, despite the best efforts of system administrators, two users will edit the same file, and a conflict will arise. If Freddie and Georgette both check out a file, both change it, and then both check it in, CVS will catch the problem and try to resolve it.

If Freddie and Georgette changed different parts of the same file, CVS graciously merges the changes. If they both change the same part of the file, human intervention is called for.

If Freddie checks in his changes and then Georgette tries to check in hers, Georgette sees an error message stating that her copy of the file is not current.

If Georgette then updates her files, the files’ status is changed to Conflict (assuming that CVS could not resolve the differences by itself).

• Figure 52-4: The CVS Resolve dialog.

The merged version in the lower half of the screen presents four possible merge options (A, B, A+B, and B+A) and the option to edit the merged results. Click the >> button to highlight the next conflict, and then click the button for the merge option that is the best solution to the conflict. If the combinations offered aren’t correct, click the Edit button to edit the text.

Browsing your log files

cervisia includes a nice log file display tool that shows graphical representations of all the changes in a development tree. The browser enables you to quickly determine where your project is and has been recently.

To use the log browser, right-click the filename, and choose Browse Log. The CVS Log dialog opens (see Figure 52-5).

398 Technique 52: Archiving Changes with CVS

The Diff view can be your best friend in times of trouble. If things get really off course, you can use Diff to help you quickly find the point in the revisions that took you off course.

The Annotate button shows you a line-by-line view of the changes made to reach revision A (we call the Annotate tool the blame button because you can see who made a given modification). Hovering over the screen entries shows revision information about that line, as shown in Figure 52-7.

Figure 52-5: The cervisia CVS Log dialog.

Choose a revision from the tree, and the information is transferred to the bottom half of the screen and shown in Revision A.

Now, if you middle-mouse click another revision, the information is transferred into Revision B. (Left-click selects a revision into the Revision A fields; middleclick selects a revision into the Revision B field.)

If you don’t have a middle mouse button, move to the List view, and use the arrow keys and Ctrl-A and Ctrl-B to select your revisions.

From the CVS Log dialog, you can use the Diff button to display the differences between revisions, as shown in Figure 52-6.

Figure 52-6: The cervisia CVS Diff dialog.

• Figure 52-7: The cervisia CVS Annotate dialog.

Marking milestones with tags

The typical CVS repository holds many (sometimes thousands) of files. It’s unlikely that you’ll modify every file in the repository whenever you change one file in the repository. Instead, troublesome files are modified frequently, and stable files tend to remain unchanged. That means that at any point in time, you’ll have some files at revision number 1.5, some files at revision 1.200, and a few at revision 4.2. At certain points, you’ll want to tag all the files in the repository so that you can get back to that point in time without having to look up all the revision numbers yourself. A tag marks a point in time. The tag (usually) includes all the files in the repository as of a given date and time.

It’s a good idea to tag the repository whenever you reach a point where the collective revisions make up a release or a working version of whatever it is that you’re tracking.

Simple tagging is quick and easy with cervisia. To tag a version, follow these steps:

Соседние файлы в предмете Операционные системы