Deleting a changelist with shelved files



Information

 
Problem

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

p4 change -d 523
Change 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 7033
Change 7033 by norman@graze on 2014/04/08 20:40:01 *pending*

        shelving a file

Shelved 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 7033
Shelved change 7033 deleted.

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

> p4 change -d 7033
Change 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 7202
Change 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 7202
Client '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 7202
Change 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 7202
Shelved 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 -f
Shelved 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.txt
Shelving files for change 7202.
edit //depot/source/file0.txt#5
Change 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-graze
Change 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 7202
Change 7202 has shelved files associated with it and can't be deleted.

> p4 -u norman describe -s -S 7202
Change 7202 by norman@min-graze on 2014/06/16 11:12:23 *pending*

    Shelving a file in this change

Shelved files ...

[ no files listed ]

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

> p4 -u admin describe -s -S 7202
Change 7202 by norman@min-graze on 2014/06/16 11:12:23 *pending*

    Shelving a file in this change

Shelved files ...

... //depot/source/file0.txt#5 edit

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

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

> p4 -u norman change -d 7202
Change 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
 
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值