Perforce: How can I delete a changelist that p4v refuses to delete?

…衆ロ難τιáo~ 提交于 2019-12-22 09:30:24

问题


After a while of working with perforce I was left with a lot of still open change lists. To clean up I want to get rid of a subset of them. So here is what makes this complicate:

  • For a subset of the changes the host of the client has changed.
  • Some changes contain shelved files.
  • Files from the change list may be deleted or moved.

When one or more of above points are true for a change list, p4v (the visual client) will not allow you to delete the change list.

So what is an effective way of deleting these change lists?


回答1:


First of all, perforce refuses to work on any change lists if the host differs in their workspace. So step one is to change the host of the workspace to the current one. This can easily be done with the visual client p4v. Open the properties of a workspace, choose edit and change the host.

Then you can use the command line to get rid of the pesky change list(s):

# to delete a changelist
CLIENT="name_of_your_client"
CHANGE="number_of_the_changelist_to_delete"
p4 -c $CLIENT shelve -c $CHANGE -d //... # Delete all shelved files from it.
p4 -c $CLIENT revert -k -c $CHANGE //... # Revert all files from changelist (only metadata).
p4 -c $CLIENT change -d $CHANGE # Finally delete the changelist.

After the last command the change list will be gone forever.




回答2:


Fixing the hostname can be done from the command line like this:

client_hostname="$(p4 client -o ${CLIENT} | grep "^Host" | awk '{print $2}')"
p4 client -o ${CLIENT} | sed "/^Host:/ s=${client_hostname}=${HOSTNAME}=" | p4 client -i


Had the same problem some time ago and wrote a script (p4-delete-changelist) that overcomes all of these problems (and another one - deleting p4 fixes).

Note that the script depends on another file in the repository.



来源:https://stackoverflow.com/questions/24905002/perforce-how-can-i-delete-a-changelist-that-p4v-refuses-to-delete

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!