p4status works like git status
(or svn status
), but works in Perforce.
It will list changelist files and locally modified files that haven’t been added to any changelist (including unadded files) in a readable format.
Note
The 2012 version of Perforce has an official p4 status command. However this command is only available if your corporate Perforce server has been upgraded to 2012. If your company, like mine, has not upgraded their server, this script will make your life easier.
[dfoster ~/dev/p4/mybranch/path/to/myproject]$ p4status
# On changelist 154055
#
# Changes to be committed in changelist default:
# (use "p4 revert <file>..." to discard changes in working directory)
#
# deleted: server/apps/setupfx/splunkd/default/extract.conf
#
# Changes to be committed in changelist 154076:
# (use "p4 revert <file>..." to discard changes in working directory)
#
# new file: server/apps/setupfx/splunkd/default/inputs-NEW.conf
# modified: server/apps/setupfx/splunkd/default/inputs.conf
#
# Changes not staged for commit:
# (use "p4 add/edit/delete <file>..." to update what will be committed)
# (use "p4 sync -f <file>..." to discard changes in working directory)
#
# new file: server/apps/setupfx/splunkd/default/inputs-NEW2.conf
#
bin
directory:
https://github.com/davidfstr/dotfiles/blob/master/bin/p4statuschmod a+x p4status
cd
to the primary directory that you’ll be working under.p4status
.Only detects unstaged files under the directory in which the command is run. Therefore it is best to reserve a terminal window that is cd
-ed to the correct place where this command can be run safely.
This command is too slow to run from the root of very large branches.
git status
command.