[p4] restoring DVCS and classic Depots

tswalker <[email protected]>
Newsgroups gmane.comp.version-control.perforce
Message-ID <[email protected]>
Posted on behalf of forum user 'tswalker'.

I had an unfortunate situation recently and thought I would write down my
experience here along with my personal notes.  Just incase, so that in
the future (cause shtuff happens) I may be able to find this as a
reference.  Perhaps someone else will find it useful.

I had a DVCS that was only local to my workstation, had no remotes, nothing on
the server.  It was more or less a playground for me, that was lost
due to a drive failure.  However, I had a backup of my workstation in
which the p4root DVCS was stored.  Unfortunately, I was not able to
just restore it and get back to work.  When I tried to access it
(either command line or with P4V) I would get a "no client" access
error because the client specification had been lost.

I found that by re-creating the text file "p4config.txt" and put these
contents into it: (your settings for P4IGNORE may be different)

P4IGNORE=D:\Workspace\.p4ignore;p4ignore.txt
P4CHARSET=none
P4INITROOT=$configdir
P4USER=TW
P4PORT=rsh:p4d.exe -i -J off -r "$configdir\.p4root"
P4CLIENT=TW-dvcs-1234567890

After restoring the files I had to correct their attributes.  The
.p4root directory needed to be set to hidden, and it along with all sub
files/folders need to have the read only flag disabled.

I then proceeded to re-create (or verify) the client specification, by entering
the project directory and executing: 

p4 client TW-dvcs-1234567890

(note: this may not have been the original client name generated by p4 init, you
can double check this by using P4V personal server option to browse to the
project folder and trying to open the connection.)

Make sure that in the client specification that the options for DVCS are
configured accordingly. (I left out a few)

Here are example entries:

Client: TW-dvcs-1234567890
Root: D:\Workspace\Sample
Options: allwrite noclobber nocompress unlocked nomodtime rmdir
SubmitOptions: revertunchanged
LineEnd: local
Stream: //stream/main
View:
//stream/main/... //TW-dvcs-1234567890/...

After this, you should be able to open a connection with P4V personal server on
the DVCS.

Verify any rogue client specifications by executing "p4 clients" on
the command line in the project folder. Remove any that p4 may have regenerated
(it seems that it picked up the original from p4 init)

I was able to use things normally at that point with DVCS.

To use the admin tool with the local DVCS, I found a post somewhere that helped
provide a command line which can be run to allow you to use the administration
tools against it to deal with streams.  I created a CMD file for the
command which contains the following:

p4d -r D:\Workspace\Project\.p4root -p 1666

I just run this command, then run P4Admin to manage the
streams.  (incase I want to obliterate something)

So, due to all this, I found that I can use "classic" perforce server
to store my DVCS... which probably isn't something most people will do and
is probably not recommended by the experts here, but it works.  So
I'll be able to maintain a full store of my local DVCS outside of the normal
perforce streams and remotes.

To do this, I create a depot on perforce helix (?) in the classic way (simple
flat file depot) and setup a workspace with it on my workstation with P4V
(remote server connection).  For example, if I called it
"MyProject" depot on the server and with P4V named workspace
"MyPersonalProject".  The View would be something like:

//MyProject/... //MyPersonalProject/...

With the Root pointing to D:\Workspace\Project

The DVCS is normally ignored by default, so you can not use P4V to push anything
other than the "main" stream contents up to the
server...  To force the DVCS push, you will need to open a command
line (not in the Project folder, use D:\Workspace path for example to avoid the
DVCS environment) and execute the following:

p4 -c MyProject reconcile -f -I D:\Workspace\Project\.p4root\...

This will now update the default changelist for the MyProject workspace and
include the DVCS files.  I then open P4V connect to MyProject and
submit. done.

When necessary to update the data stored on the server, I will reconcile in P4V,
submit, execute the DVCS forced reconcile (command line above), and submit again
in P4V.

Its' a few steps, but that's how I working with it.  I should
(in theory, have not done this), but could probably also work with remotes in
the DVCS to a different workspace stream on helix too...  I know that
seems like a lot of redundant data, but shtuff happens and I don't like
losing work.   :)





--
Please click here to see the post in its original format:
  http://forums.perforce.com/index.php?/topic/5490-restoring-dvcs-and-classic-depots
_______________________________________________
perforce-user mailing list  -  [email protected]
http://maillist.perforce.com/mailman/listinfo/perforce-user
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.