Perforce 2004.2 User's Guide | ||
<< Previous Chapter Perforce Basics: Miscellaneous Topics |
Table of Contents Index Perforce on the Web |
Next Chapter >> Labels |
When you submit a changelist to the depot, the depot is updated atomically: either all of the files in the changelist are updated in the depot, or none of them are. This grouping of files as a single unit guarantees that all files grouped together in a changelist are updated simultaneously. A Perforce changelist is an atomic change transaction.
Perforce attempts to make working with changelists as transparent as possible. Perforce commands such as p4 edit add the affected files to the default changelist, and p4 submit sends the default changelist to the server for processing. Sometimes, the default changelist is not sufficient, and you must use a numbered changelist. Use numbered changelist when:
Each file in a changelist is said to be open in the client workspace and in the changelist: the first file in the example is open for edit, and the second file is open for deletion.
The depot is updated with the files in the changelist when you call p4 submit to send your changes to the Perforce server.
The commands that add or remove files from changelists are:
By default, these commands, and p4 submit, operate on the default changelist. For example, if you type p4 add filename, this file is added to the default changelist.
When you type p4 submit, a change form is displayed, showing the files in the default changelist. In order to submit a changelist, you must also supply a description of the changes being made. When you save the p4 submit form, the files shown in the form are submitted to the server and the server attempts to update the files in the depot.
If there are no problems with the submission, the changelist is assigned a sequential number, and its status changes from new or pending to submitted. Any files you removed from the default changelist by editing the p4 submit form reappear in a new default changelist. After a changelist has been submitted, it becomes a permanent part of the depot's metadata, and is unchangeable except by Perforce administrators.
All files in the default changelist are included in the new changelist. When you exit the form, the new changelist is assigned the next changelist number in sequence, and the changelist must be subsequently referred to by this change number. You can delete files from the changelist by editing the p4 change form; files deleted from the new changelist reappear in the default changelist. The status for a changelist created by the p4 change command is pending until you submit the changelist.
Files in your workspace may appear in only one pending changelist at a time.
You can move files from one changelist to another with p4 reopen -c changenum filename, where changenum is the number of the moving-to changelist. To move a file from a numbered changelist to the default changelist, use p4 reopen -c default filename.
Ed is working on two bug fixes simultaneously. One of the bugs involves mail filtering and
requires updates of files in the filter subdirectory; the other problem is in the aliasing
system, and requires an update of utils/elmalias.c.
Ed wants to fix each bug in its own changelist; doing so enables him to refer to one bug fix by
one change number and the other bug fix by another change number. He's already started
fixing both bugs, and has opened some of the affected files for edit. He types p4 change, and
sees
Ed wants to use this changelist to submit only the fix to the filter problems. He changes the
form, deleting the last file revision from the file list. When he's done, the form looks like this:
Change: new |
When he quits from the editor, he's told
Change 29 created with 2 open file(s).
The file that he removed from the list, utils/elmalias.c, is now found in the default
changelist. He could include that file in another numbered changelist, but decides to leave it
where it is.
He fixes both bugs, and realizes that the filter problem requires updates to another file:
filter/lock.c. He opens this file for edit with p4 edit -c 29 filter/lock.c;
opening the file with the -c 29 flag puts the file in changelist 29, which he created above. (If
the file had already been open for edit in the default changelist, he could have moved it to
changelist 29 with p4 reopen -c 29 filter/lock.c).
Ed finishes fixing the aliasing bug, and because the affected files are in the default changelist,
he submits the default changelist with p4 submit and no arguments. When Ed finishes
fixing the filtering bug, he submits that changelist with p4 submit -c 29.
If a submit fails because your revision of the file is not the head revision, this is called a file conflict. You must resolve the conflict before the changelist can be accepted. (For details, see Chapter 5, Perforce Basics: Resolving File Conflicts).
Ed has finished fixing the filtering bug that he's been working on in numbered changelist 29.
After Ed created that changelist, he submitted another changelist (change 30), and two other
users have also submitted changelists. Ed submits change 29 with p4 submit -c 29, and is
informed of a changelist renumbering as follows:
Change 29 renamed change 33 and submitted.
Changelists that have already been submitted can be deleted by a Perforce administrator only under very specific circumstances. Please see the Perforce System Administrator's Guide for more information.
Perforce 2004.2 User's Guide | ||
<< Previous Chapter Perforce Basics: Miscellaneous Topics |
Table of Contents Index Perforce on the Web |
Next Chapter >> Labels |