[p4] Storing versioned builds and getting at old versions of the build in other branches...

Taylor Brown tbrown at ncsoft.com
Tue Jul 18 13:45:13 PDT 2006

I'm working on a project for which I am making builds that I would like
to keep around indefinitely.  In addition, I need to be able to get at
previous versions of these builds so that I can build patches between
the old builds and the current build.  I want to use Perforce store
these builds, and I see two ways to go about this:

1. Check in each version of the build to the same spot over the previous

2. Check in each build to its own directory in perforce:

At first glance, #1 seems to be the obvious best solution.  Any time I
need a previous version I simply sync
//depot/myproj/CurrentBuild at ProperLabelOrRevision

It would be easy to see with revision history what had changed between
each build, etc.  More importantly, when I want to have all versions on
my computer, side by side, I can just do this for each version: 
	1. Sync the CurrentBuild directory to the proper revision
	2. copy the CurrentBuild directory to a local directory
(c:\AllBuilds\Build1.0, c:\AllBuilds\Build2.0, etc) 
and now I've got every version locally on my machine at once, ready to
have patches built.

In fact, I've got a handy-dandy msbuild script to do this very thing.  I
just run "//depot/MyProj/SyncAllVersions.bat" and I get every build
version side by side.

So far so good!

Let's say I work this way for a while, and now I want to start working
out of another branch (//depot/MyProj2).  I integrate //depot/MyProj/...
into //depot/MyProj2, and now I want to begin performing builds and
building patches again just like I used to.  But wait!  I can't sync
//depot/MyProj2/current to a previous version.  Although p4 filelog will
show me the previous revisions of the file in my MyProj branch, I can't
actually sync them because those previous versions never existed in the
MyProj2 branch.

I want to be able to sync all previous good versions of my "current"
build when working in ANY branch, regardless of whether or not I did an
integration for every build into my current branch.  Since I can't use
sync to get previous versions of "current", it has occurred to me that I
can use "p4 print -o" to write a particular previous version to a local
file.  Through clever automation, I could look through the filelog,
determine which versions of the files I wanted to grab, and use p4 print
to get them to a local directory on my machine.  

     This could work, and it does seem pretty automatable, but now I'm
thinking that either 1) my requirements are insane, or 2) there is a
better way to do this in the depot.  Are either of those statements
true?  Does anyone else a) ever need to do this, and if so, is there a
best practices or a better way?

Many thanks for any help,


More information about the perforce-user mailing list