Deleting a changelist with shelved files

来源:互联网 发布:win7恢复网络设置 编辑:程序博客网 时间:2024/04/30 22:33


Information

 
Problem

A changelist cannot be deleted if it contains shelved files. For example:

p4 change -d 523Change 523 has shelved files associated with it and can't be deleted.

How can I delete a changelist with shelved files?

Solution

A changelist containing shelved files cannot be deleted; you must first delete those shelved files. This is also referred to as 'deleting the shelved change'.

Deleting files you shelved in your workspace

To find out which files are shelved in a given change, you can use 'p4 describe -s -S change_number' . The upper-case '-S' shows files that are shelved in this changelist. For example:

> p4 describe -s -S 7033Change 7033 by norman@graze on 2014/04/08 20:40:01 *pending*        shelving a fileShelved files ...... //depot/source/file0.txt#4 edit

To delete the shelved files, use 'p4 shelve -d', followed by the change number:

> p4 shelve -d -c 7033Shelved change 7033 deleted.

Having removed the shelved files (deleting the shelved change), you can remove the change itself:

> p4 change -d 7033Change 7033 deleted.

Deleting files shelved by another user or workspace

The changelist containing shelved files can be associated with a different user or client workspace. Deleting such files requires impersonating that user or workspace. Alternatively, deleting files shelved by another user can be done by a user with 'super' or 'admin' permissions.

You can determine the user and client by inspecting the change using 'p4 describe -s -S changenumber' (as above), and the Perforce Server will tell you if it's the wrong user/client - for example:

> p4 shelve -d -c 7202Change 7202 belongs to client min-graze.

I am not working in client 'min-graze', but I can impersonate the client by adding it to my command:

> p4 -c min-graze shelve -d -c 7202Client 'min-graze' can only be used from host 'min'.

This client, min-graze, is tied to a specific host; adding the client's host name to my command:

> p4 -c min-graze -H min shelve -d -c 7202Change 7202 belongs to user norman.

The change is owned by a different user; adding the username too:

> p4 -c min-graze -H min -u norman shelve -d -c 7202Shelved change 7202 deleted.

Note that you may need a valid login ticket for this user (more about impersonating users can be found in  "Reverting Another User's Files").

Alternatively, a user with 'admin' access can delete shelved files by including the -f flag to force the operation:

> p4 -u admin shelve -d -c 7202 -fShelved change 7202 deleted.

Change has shelved files, but the owner cannot see them.

Sometimes, a change in protections means a user is no longer allowed to access a file they have shelved. To unshelve these files requires either a change in the protections table (needing a super user) or, more conveniently, an admin user to run the 'p4 shelve -d' command. For example, user 'norman' shelves a file:

> p4 -u norman shelve -c 7202 //depot/source/file0.txtShelving files for change 7202.edit //depot/source/file0.txt#5Change 7202 files shelved.

The protections table is updated. The pending change containing those shelved files still exists...

> p4 -u norman changes -s pending -c min-grazeChange 7202 on 2014/06/16 by norman@min-graze *pending* 'Shelving a file in this change '

... but the owner of that change cannot delete the change nor view the shelved files in that change:

> p4 -u norman change -d 7202Change 7202 has shelved files associated with it and can't be deleted.> p4 -u norman describe -s -S 7202Change 7202 by norman@min-graze on 2014/06/16 11:12:23 *pending*    Shelving a file in this changeShelved files ...[ no files listed ]

An admin user can view and delete the shelved files...

> p4 -u admin describe -s -S 7202Change 7202 by norman@min-graze on 2014/06/16 11:12:23 *pending*    Shelving a file in this changeShelved files ...... //depot/source/file0.txt#5 edit> p4 -u admin shelve -d -f -c 7202Shelved change 7202 deleted.

... which allows 'norman' to delete his pending change.

> p4 -u norman change -d 7202Change 7202 deleted.

Viewing or saving a shelved file

Use the p4 print command if you want to save off shelved files before deleting shelves.
 
p4 print -q //depot/source/file0.txt@=7202 > shelve_7202_file0.txt
 
Related Links
Perforce User's Guide: Deleting Changelists

Opened Files Missing in Default Changelist

Reverting Another User's Files

http://answers.perforce.com/articles/KB/3452/?l=en_US&fs=RelatedArticle
0 0
原创粉丝点击