[p4] Perfarce [sic] experiences

Robert Cowham robert at vizim.com
Mon Jun 28 03:24:51 PDT 2010


I'd suggest playing with it - it uses a special "offline broker":

Here's the contents of one of the special "P4CONFIG" files created:

P4PORT=rsh:"C:/Program Files/Perforce\P4VResources\p4ob.exe" -d "C:/Program
Files/Perforce\P4VResources\p4d.exe" -fir "C:/Documents and
Settings/robert\.p4ob" -o localhost:1666 -R "C:/Documents and
Settings/robert\.p4ob\0003Clients\A001\p4root"
P4CLIENT=bruno_ws
P4USER=bruno
P4CHARSET=none

C:\Program Files\Perforce\P4VResources>p4ob -h

Usage: p4ob [options]
  -p port    set listen port (default 1667)
  -o port    set main/online server port (default $P4PORT)

  -i         run for inetd (socket on stdin/stdout)
  -f         run as single-threaded broker
  -r dir     set p4ob root directory (default $P4OBROOT,
             ~/.p4ob or similar directory)
  -d path    path to p4d executable (default searches $PATH)
  -v level   set debug modes (default $P4DEBUG, 0)
  -L log     set error log (default $P4OBLOG, stderr)

  -R dir     set offline server root, ignore Root specified in
             offline configuration (default $P4OFFROOT, blank)
  -y port    set offline server port, ignore Root specified in
             offline configuration (default $P4OFFPORT, blank)

             Cannot specify both -R and -y. Offline precedence:
             -R, -y, $P4OFFPORT, $P4OFFROOT.

  -h -?      print this message and exit
  -q         suppress startup messages
  -V         print p4ob version then exit


Command line usage should work if you set your P4CONFIG appropriately...

However, the setting up (take offline/online) is obviously best done within
p4v itself.

Other comments below:

> -----Original Message-----
> From: perforce-user-bounces at perforce.com 
> [mailto:perforce-user-bounces at perforce.com] On Behalf Of Johan Nilsson
> Sent: 28 June 2010 10:49
> To: perforce-user at perforce.com
> Subject: Re: [p4] Perfarce [sic] experiences
> 
> Robert Cowham wrote:
> 
> > Love the "Freudian slip" in naming :)
> >
> > Just curious - have you tried the "Take workspace offline" option 
> > within recent versions of P4V?
> 
> Briefly - no. Haven't even heard about it (I'm normally 
> lagging a few releases behind, especially on the server 
> side), which makes me a bit surprised as I'm one of many 
> (IIUC) that have their contact details added to
> ticket(s) regarding offline support for Perforce.
> 
> I would personally really, really prefer to have the support 
> for offline work added to the "core" architecture so that I 
> could work offline from the command prompt (where I spend at 
> least 50% of my time) and also in the various IDE 
> integrations (where I spend most of my remaining time). I 
> rarely use P4V except when browsing through the depots to 
> take a look at some single file. Offline support might be the 
> one feature making me actually use P4V.
> 
> I've inlined some comments/questions below. Be aware that I 
> still haven't tried it out though, so these might be based on 
> incorrect understanding of the feature.
> 
> >
> >> From P4V help:
> >
> > Working Offline
> >
> > To take a workspace offline, perform the following steps:
> >
> > Choose Connection > Take Workspace Offline.
> > The first time you take a workspace offline, you are prompted to
> > choose the files you plan to work on. Check Enable working offline
> > and select the files. (To change the files configured for using your
> > workspace offline, choose Connections > Offline Settings...) Select
> > only the files you know you need to change, to minimize disk space
> > consumption.
> > Close the connection when prompted. P4V retrieves the 
> specified files
> > and launches a local server that tracks your changes.
> 
> Switching to a local server for offline work sounds just like a hobby 
> project I've been dreaming to have time for since years, but 
> never got 
> around to actually doing it. Feels good to know I didn't 
> waste my time on 
> that ... I think :)
> 
> There's still the limit of actually _knowing_ that you'll be offline 
> beforehand though. Is there a possibility to force the 
> offline mode without 
> having a server connection? I realize the potential problems 
> with this, but 
> under certain circumstances and for certain people it might be a 
> "lifesaver".

Theoretically possible - given above info, but I suspect a hobby project to
get it reliable...

> And, what happens if one kills P4V either explicitly, by 
> logging out the 
> current user, or by shutting down the system? How do you get 
> the offline 
> server up and running again - do you just start P4V again and it 
> automatically detects that it was running a local server in 
> offline mode? 
> What's the scenario here?

It uses the "rsh" trick (inetd) - so no server running all the time - a p4d
is run for every command executed.

I spotted this trick arising in the test harnesses for various scripting
options - its really useful for such scenarios - doesn't use a port etc. Use
it all the time now in my test harnesses.

> > Work normally. (Perforce operations are tracked by the local server
> > so they can be reconciled when you resume working online. Do not
> > change file permissions manually.)
> 
> Does offline work support branching /integrating / renaming / moving?

Don't see why not - it's a normal server - haven't tested though.

> > To bring your workspace online: choose Connection > Bring Workspace
> > Online. To minimize conflicts that can occur when you resume working
> > online and submit files that others have changed, create a personal
> > development branch (often called a sandbox) to isolate your changes.
> 
> Would be nice if this was given as an option when going offline.

Indeed.

> > After you bring your workspace online, P4V prompts you to 
> submit your
> > offline work. You can autosubmit, which submits a single changelist
> > containing all your work, or review your offline work. Reviewing
> > offline work enables you to organize your changes into multiple
> > changelists, grouping related changes to ensure that you obtain a
> > meaningful file history that best reflects your work.
> 
> Is there no way to "simply" replicate the local changelists 
> submitted when 
> going online again, perhaps with a review option? Or is this what the 
> paragraph says, just somewhat inexplicitly?

Well it replays them all in sequence automatically - no reviews - in my
testing.

> > IMPORTANT: To ensure data integrity, you must take the workspace
> > offline while you still have access to the server. If you 
> do not have
> > network access to the server, do not take your workspace offline.
> 
> As above - is this more like "here be dragons" or is it "you 
> can't do this"?

Try it :)

Robert



More information about the perforce-user mailing list