People ask from time to time how to browse a Perforce repository, and the easiest answer is to use p4web.
Some advantages:
- It’s free, and in browse-only mode doesn’t consume extra licenses – which means that you can “publish” changes via your Perforce server to managers and other people who may not normally have a Perforce license.
- It will “serve up” things like Word documents such that they are typically opened in Word by your browser
- It can give “canoical” or fixed URLs for documents or other configuration items stored in Perforce, so that fixed references always get the latest versions (as opposed to a file share where it is often unclear which is the latest and if there are any other versions etc)
- The default URL to get the head revision is very simple:
- <p4web-base-url>/<document path within perforce without double slash at start>, e.g.
- http://p4web-machine/depot/some/path/to/document.doc
Example of Accessing a Document
A test document has been setup in the Perforce Public Depot.
The direct URL to load the document is http://public.perforce.com/guest/robert_cowham/test/testdoc.doc
Alternatively it can be accessed for example with the history via p4web as:
http://public.perforce.com:8080/guest/robert_cowham/test/testdoc.doc?ac=22
Bear Security in Mind
If you setup in browse only mode as a user with access to the whole repository, you may be bypassing other security requirements and protections.
Consider setting up different p4web instances with different access permissions. Putting a separate layer on top of p4web with usernames and passwords, while possible, is likely to lead to maintenance problems.
DNS Alias to keep the URL fixed
If you start referring to a Canonical URL which then becomes used inside documents, make sure that the machine where p4web is running is accessed via a DNS alias so that it can be moved easily without breaking the references.
Also consider having a setup (e.g. via Apache or IIS virtual server settings) where the default web port of 80 is used to avoid ugly port components of the path such as :8080 or some other port being required.
Parameters
The following were culled from personal experience and postings on perforce-user (by Noah Salzman and Nick Levine )
Action Codes
10 Changelist Detail http://p4web.example.com:8080/12345?ac=10 14 Branch Specification http://p4web.example.com:8080/foo_branch?ac=14 16 Label Spec http://p4web.example.com:8080/build_tag_123?ac=16 22 Revision History http://p4web.example.com:8080//depot/main/foo.c?ac=22 64 View Head Revision http://p4web.example.com:8080//depot/main/rel1/foo.c?ac=64 69 Submitted Changelists http://p4web.example.com:8080//depot/main/rel1/foo.c?ac=69 http://p4web.example.com:8080//depot/main/rel1/...@build_tag_123?ac=69 142 View Annotated http://p4web.example.com:8080//depot/main/rel1/foo.c?ac=142 143 View Fully Annotated http://p4web.example.com:8080//depot/main/rel1/foo.c?ac=143 Note: the single forward slash (versus a double forward slash) is important in URLs that do not include depot paths.
107 List Jobs (p4 jobs) http://clrfi.alu.org:8080/?ac=107 http://clrfi.alu.org:8080/?ac=107&jsf=Job&jsf=Status&jsf=Date&jsf=Title&jsf=Area&jsf=Priority&ft=status%3Dopen 111 Describe Job (p4 job) http://clrfi.alu.org:8080/job000005?ac=111
URLEncode the "@" (%40) or "#" (%23), for example, show contents of head rev //public/jam/src/Build.com#2 is http://public.perforce.com:8080/public/jam/src/Build.com%232?ac=64 For #1 http://public.perforce.com:8080/public/jam/src/Build.com%231?ac=64 For label @jam2-2-0 it is: http://public.perforce.com:8080/public/jam/src/Build.com%40jam2-2-0?ac=64



