Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do you quickly find/delete all empty changelists in Perforce?

I was wondering what could be the point in trying to delete committed changelists, because a committed changelist is not supposed to be empty.

But then I am playing with the tutorial depot, and using the obliterate command on a whole branch, I can see there are situation where you can end up with empty committed changelists (that need deletion with the -f flag).

However, I don't know how to find them with the command line, as I don't know how to look for changelists with no files associated with.

Is there an easy way to do that ?

Thanks,

Thomas

like image 986
Thomas Corriol Avatar asked Oct 16 '09 08:10

Thomas Corriol


2 Answers

Ah !

I should have browse more documentation before asking this...

http://public.perforce.com/wiki/Perforce_Command_Line_Recipes

Description: Delete all empty submitted changelists.
Shell command: p4 changes -s submitted | cut -d " " -f 2 | xargs -n1 p4 change -d -f
Powershell: p4 changes -s submitted | %{p4 change -d -f $_.split()[1]}
px: px -F %change% changes -s submitted | px -X- change -d -f
Contributors: Sam Stafford, Philip Kania, Shawn Hladky

Duh.

Thomas

like image 200
Thomas Corriol Avatar answered Sep 21 '22 06:09

Thomas Corriol


To simply find all empty submitted changelists without deleting them, you can compare the output of these two commands:

  • p4 changes -s submitted - all changelists
  • p4 changes -s submitted //... - all changelists with associated files

In Windows PowerShell, for example, run

diff -ReferenceObject (p4 changes -s submitted) -DifferenceObject (p4 changes -s submitted //...)
like image 35
Michael Liu Avatar answered Sep 21 '22 06:09

Michael Liu