[p4] How to delete changelists

David Weintraub qazwart at gmail.com
Thu Nov 23 07:14:06 PST 2006

On 11/23/06, Ritchie Gillam <gillamr at halifax.ca> wrote:
> Hi all
> First let me say that I am new to Perforce so please take it easy on
> me.

This is a pretty helpful group here. However, you should read the
Perforce User's Guide and the Perforce Systems Administrator's Guide
which are both available on
<http://perforce.com/perforce/technical.html#usermanuals>. These
manuals will answer a lot of your questions.

Also remember that Perforce has an extensive "help" system. Simply
type "p4 help" to get the initial information. Typing in "p4 help
commands" will get you a list of all the commands. Typing in "p4 help
<command>" will give you detail help on that particular command.
Sometimes showing you information that is not 100% clear in the
manual. Also, typing "p4 help undoc" will give you information about
the "undocumented" parts of Perforce. That's where you find out about
the "-ztag" parameter.

Laura Wingerd wrote a book called Practical Perforce, and I wish it
was out when I setup my Perforce server! I highly recommend you get a
copy and memorize each and every page. It will contain a lot of
helpful information on how to use Perforce way beyond what the various
manuals will tell you.

The third great source of information are the on line Perforce
technical notes <http://perforce.com/perforce/technotes/index.html>.
For example, what is the best way to had a whole directory structure
to your Perforce depot? How can you find files in your Perforce client
that aren't in the Perforce depot? Take a look around there.

> There are a couple things I want to do:
> 1)  Since I am new at this I have things in the depot which I no longer
> want in there.   How do I get rid of it?  For example I have a folder
> called TestPerforce.

Perforce tracks files and not folders, so if you have to delete all
the files in the folder and the folders will disappear. You can do
that by simply using the "p4 delete" command:

    $ p4 delete //depot/TestPerforce/...
    $ p4 submit

That will remove the folder from the most recent revision of your
archive. If you REALLY want to delete something, and eliminate all of
its history (which may be what you want to do with the TestPerforce
folder), use the "p4 obliterate" command:

   $ p4 obliterate //depot/TestPerforce/...
   $ p4 obliterate -y //depot/TestPerforce/...

The first form of the command shows you what you will be obliterating.
The second form actually obliterates the information. You rarely, if
ever, want to use obliterate. It should only be used to remove items
that were accidently put into the source depot, or for items (like
your test folder).

By the way, I recommend that you set up a backup Perforce server, and
get a backup Perforce license (which Perforce will give you for free).
That way, if your Perforce server goes down, you have a backup server
already to be up and running. As a bonus, since both servers have a
Perforce license, you can use the backup server as a test bed. That
way, you don't put things in your Perforce depot that you really don't

> 2)  I have change lists that are not empty and that are not on the same
> client.  I was trying to learn how to setup up clients properly and
> since then have deleted the clients where the changelists were
> originally created.   How do I get rid of these changelists?

Remember that all commands have associated help text. For example,
here's what I found by typing "p4 help change":

        The -f flag can force the update or deletion of other users' pending
        changelists.  -f can also force the deletion of submitted changelists
        once they have been emptied of files via 'p4 obliterate'.  Normally,
        submitted changelists are immutable.  The -f flag requires 'admin'
        access granted by 'p4 protect'.

So, you can remove a pending changelist by typing:

    $ p4 change -fd <changeListNum>

David Weintraub
qazwart at gmail.com

More information about the perforce-user mailing list