/p4u

A lighter approach to command line perforce (p4)

Primary LanguageShell

p4u

A lighter approach to command line perforce (p4)

Shows the current status of the relevant client, the current pending & shelved changelists as well as the default changelist.

image

It can also show historical information of the current p4 client, and highlight reviewboard links and fixes.

image

Note that this script works a lot faster if gnu-parallel is installed. Moreover, Since this script is usually used daily - several times a day (at least by me), it is recommended to alias it to a shorter phrase (p4p, pp or even just p). Aliasing is also recommended for personalizing the script's configuration. (Helps permanently removing the colors, printing briefly always or printing verbosely always).

Allows switching the current changelist you're working on by shelving everything arround and unshelving the requested changelist/s.

Say this is your current p4 state:

image

And you want to work on changelist #1237177

image

After running p4-switch-context you're there:

image

Run p4-switch-context without passing a changelist number when you want to start fresh and save all your current work. Everything will be shelved, and all pending work will be reverted.

You can also sync & resolve automatically after the switch is done (run with -h to see all the options).

Improving 'p4 annotate' to annotate a specific line of a certain file.

It's helpful the most when combined with an editor.

For example, if you use vim you can add this command to your vimrc:

command! Blame execute '!p4-annotate -o ' . expand('%:p') . ' ' . line('.') . ' | less -XFr'

Solves the following:

Deletes a certain changelist overcoming a lot of p4 obstacles.

Automatically Deletes shelve, Reverts files, removes fixes (also fixes hostname in case changelist was created on a different host than it's deleted).

Solves the following:

Deletes current p4 client completely - deletes the client on the p4 server as well as the local files.

  • Deletes all changeslists (reverts pending & deletes shelved).
  • Fixes hostname (if differs from the one the client was created on)
  • Unlocks client (if locked)

Solves the following:

Find untracked (unadded) files in p4 directories.

Solves the following:

Just as it sounds - reshelves a shelved changelist by the current pending files (old shelve is deleted - similar to -r option of shelve).

Solves the following:

Unshelves a changelist to itself by default (instead of p4 default unshelve to the 'Default changelist').

Just as it sounds - Did a lot stuff you regret? revert everything (doesn't harm shelves).

Pretty prints a changelist. It is used in p4-show & p4-annotate.

It's more of a scaffold script, but you can use it to automate pretty changelist printing yourself.

This is an unrunnable file containting helper functions for other p4 scripts to source.