[p4] SCCS to perforce Migration
Raju Subbanna X4832
hemantharaju.t.subbanna at nsc.com
Wed Jan 16 11:26:36 PST 2002
Thank You Eric,
By the way you are (un) officially the first person who has tried this.
Congrats!!
Now about me. I will wait a little longer before I actully spend any time on
this.
I am asking the group here to validate the efforts before I start on it.
Thank You once again for responding and sharing
--Raju
Eric Dew wrote:
> Actually, I just completed this (still doing it, actually, since SCCS
> seems to propagate itself
> with many copies of the SCCS/s.<filename> all over the place).
>
> Here's one question for you: do you want to keep the comments for each
> file checked in in
> SCCS? If not, there's an easy way. Otherwise, it could be quite difficult.
>
> Second question: do you have files in SCCS checked in on branches?
> That is, are any files
> checked in with a rev number resembling 1.2.4.2 (as opposed to 1.2)? If
> so, that's also a pain
> in the ass.
>
> So, assume you have the following situation: revisions of all files are
> linearly checked in.
> That is, they are numbered, 1.1, 1.2, 1.3, 1.4, etc. (with the top
> revision possibly different
> for different files, of course).
>
> Second, assume you don't really care too much about the comments. (In
> my case, the comments
> were basically non-existent.)
>
> Then, what I did was created a perl script which basically did the
> following:
>
> %files = get_all_files();
> &create_submit_template;
> &check_in_revision_1;
> &loop_through_all_revisions;
>
> sub get_all_files
> {
> local(%file_info);
> find('.');
> wanted
> {
> <usual stuff>
> }
> &exec("$name");
>
> sub exec
> {
> if ($name =~ m|^\./(.*)/SCCS/s\.(.*)$|) #gets all files which
> has an associated SCCS/s.file
> {
> $filename = "$1/$2";
> }
> `get the top revision of said file using sccs prs <filename> and
> awking for rev number`;
> $file_info{"$filename"} = $top_rev_number;
> }
> return(%file_info);
> }
>
> sub create_submit_template
> {
> open(TEMPLATE,"/tmp/main_template");
> print TEMPLATE "Change:\tnew\n\n";
> print TEMPLATE "Client:\t$clientname\n\n";
> # etc... all boilerplate text for a p4 submit form, except for the
> actual files
> close(TEMPLATE);
> }
>
> sub check_in_revision_1
> {
> foreach $key (keys (%files))
> {
> rename("$key","${key}_new"); # don't want to blow away a
> working version...
> # rename it back after you're done.
> `sccs get -r1.1 $key`; # you may need to chdir to proper place
> and get the basename($key)
> # but, you get the idea. If you just
> do the above, you will
> # check the file out to your pwd, not
> in the correct location
> `p4 add $key`; # again, actually p4 add basename($key)
> open(SUBMIT_TEMPLATE, "/tmp/submitform_1");
> print SUBMIT_TEMPLATE "\t//depot/<directory path>/<filename> add\n";
> close(SUBMIT_TEMPLATE);
> }
> `p4 submit -i < /tmp/submitform_1`;
> }
>
> sub loop_through_all_revisions
> {
> for($i = 2; ;$i++)
> {
> if ($number_of_files_checked_in == 0)
> {
> last;
> {
> $number_of_files_checked_in = p4checkin_and_submit_files($i);
> }
> }
>
> sub p4checkin_and_submit_files
> {
> my($count);
> $rev = $_[0];
> $count = 0;
> `cp /tmp/main_template /tmp/submitform.$rev`;
> foreach $key (keys (%files))
> {
> if ($files{$key} < $rev)
> {
> delete $files{$key};
> next;
> }
> else
> {
> $count++;
> $sccs_rev = "1.$rev";
> #change directory to proper location
> `p4 edit basename($key)`;
> `sccs get -r$sccs_rev basename($key)`;
> open(SUBFORM ">>/tmp/submitform.$rev");
> print SUBFORM "\t//depot/<something>/$key edit\n";
> close(SUBFORM);
> }
> }
> `p4 submit -i < /tmp/submitform.$rev`;
> return($count); # if $count is still zero, then there are no
> # more files with top revision greater than
> # greater than or equal to $rev, so we're done!
> }
>
> This way, we check in all #1 revisions of the files, then #2, then #3, and
> so on until we check in the highest revision from SCCS. There's one more
> thing, which is to check in the working version, if you want to do that.
>
> Hope that helps!
>
> EDEW
>
> Raju Subbanna X4832 wrote:
>
> >Hi,
> >Anyone who has done SCCS to Perforce migration, please share your
> >experience.
> >Thank You
> >Raju
> >
> >
> >_______________________________________________
> >perforce-user mailing list - perforce-user at perforce.com
> >http://maillist.perforce.com/mailman/listinfo/perforce-user
> >
More information about the perforce-user
mailing list