VCP-Dest-p4.stml #27

  • //
  • guest/
  • perforce_software/
  • revml/
  • ui_machines/
  • VCP-Dest-p4.stml
  • View
  • Commits
  • Open Download .zip Download (7 KB)
<!DOCTYPE author [
  <!ENTITY yes_re "qr/\Ay(es)?\z/i" >
  <!ENTITY no_re "qr/\Ano?\z/i" >
  <!ENTITY non_empty_re "qr/./" >
]>

<machine id="VCP::Dest::p4" xmlns="http://slaysys.com/StateML/1.0">

  <!-- ================ TRANSITIONS =================== -->

  <state id="dest_p4_run_p4d_prompt" class-ids="prompt_class">
    <name>Launch a p4d for the destination</name>
    <description>
    
If you would like to insert into an offline repository in a
local directory, vcp can launch a 'p4d' daemon for you in that
directory.  It will use a random high numbered TCP port.

    </description>

    <entry-handler>
      if ( $ui->in_edit_mode ) {
        $default = $ui->dest->{P4_RUN_P4D} ? "yes" : "no" ;
        $is_current_value = 1;
      }
      else {
        $default = "no";
      }
    </entry-handler>

    <arc from="dest_type_prompt" guard="'p4'">
      <description>p4</description>
      <handler>
        $ui->new_dest( $answer );
      </handler>
    </arc>

    <arc to="dest_p4_p4d_dir_prompt" guard="'yes'">
      <description>yes</description>
      <handler>
        my $old = $ui->dest->{P4_RUN_P4D} ? 1 : 0;
        $answer = 1;
        $ui->dest->repo_server( undef )
          if $ui->in_edit_mode and $old != $answer;

        $ui->dest->{P4_RUN_P4D} = $answer;
      </handler>
    </arc>

    <arc to="dest_p4_host_prompt" guard="'no'">
      <description>no</description>
      <handler>
        my $old = $ui->dest->{P4_RUN_P4D} ? 1 : 0;
        $answer = 0 ;
        $ui->dest->repo_server( undef )
          if $ui->in_edit_mode and $old != $answer;
          
          $ui->dest->{P4_RUN_P4D} = $answer;
      </handler>
    </arc>
    
  </state>


  <state id="dest_p4_p4d_dir_prompt" class-ids="prompt_class">
    <name>Destination P4ROOT</name>
    <description>

The directory of the destination repository, p4d will be
launched here.
    
    </description>

    <entry-handler>
      if ( $ui->in_edit_mode ) {
        $default = $ui->dest->repo_server ;
        $is_current_value = 1;
      }
    </entry-handler>
    
    <arc to="dest_p4_user_prompt" guard="&non_empty_re;">
      <handler>
        # will set repo_server
        $ui->dest->ui_set_p4d_dir( $answer );
      </handler>
    </arc>
    
  </state>


  <state id="dest_p4_host_prompt" class-ids="prompt_class">
    <name>Destination P4PORT</name>
    <description>

Specify the hostname/IP address and TCP port of the destination
Perforce server (p4d).  The default value is the current P4PORT
environment variable as reported by 'p4 set', or "perforce:1666"
if P4PORT is unset.

    </description>
    <entry-handler>
      my $h = $ui->dest->p4_get_settings;
      if ($ui->in_edit_mode) {
        $default = $ui->dest->repo_server ;
        $is_current_value = 1;
      }
      else {
        $default = empty ( $h->{P4HOST} ) ?  "perforce:1666" : $h->{P4HOST} ;
      }
    </entry-handler>

    <arc to="dest_p4_user_prompt" guard="&non_empty_re;">
      <description>perforce:1666</description>
      <handler>
        $ui->dest->repo_server( $answer )
            unless empty $answer;
      </handler>
    </arc>
  </state>


  <state id="dest_p4_user_prompt" class-ids="prompt_class">
    <name>Destination P4USER</name>
    <description>

Specify the username with which to connect to the destination
Perforce server (p4d).

If you are connecting to an existing Perforce server (p4d),
you must specify a P4USER with administrative or superuser
privileges.

If you are launching a new p4d for the destination repository,
you may specify any name for P4USER, and this user will be
created for you on the destination repository.

The default value is the current P4USER environment variable
as reported by 'p4 set', or the current USER variable if P4USER
is unset.

    </description>
    <entry-handler>
      if ( $ui->in_edit_mode ) {
        $default = $ui->dest->repo_user;
        $is_current_value = 1;
      }
      else {
        my $h = $ui->dest->p4_get_settings;
        $default =  empty ( $h->{P4USER} ) 
                 ? ( empty $ENV{USER} ? undef : $ENV{USER})
                 : $h->{P4USER} ;
      }
    </entry-handler>

    <arc to="dest_p4_password_prompt" guard="&non_empty_re;">
      <handler>
        $ui->dest->repo_user( $answer )
            unless empty $answer;
      </handler>
    </arc>
  </state>


  <state id="dest_p4_password_prompt" class-ids="prompt_class">
    <name>Destination P4PASSWD</name>
    <description>

Specify the password with which to connect to the destination
Perforce server (p4d).

If you are connecting to an existing Perforce server (p4d), you
must specify the correct password for the P4USER you are using
to connect to the server.  (If the P4USER you are using has no
password, enter any non-null P4PASSWD.)

If you are launching a new p4d for the destination repository,
enter any non-null password here.)

WARNING: Entering a password here causes the password to be echoed
in plain text to the terminal.

    </description>

    <entry-handler>

      if ($ui->in_edit_mode ) {
        unless ( empty $ui->dest->repo_password ) {
          $default = "** current password **";
          $is_current_value = 1;
        }
      }
      else {
        my $h = $ui->dest->p4_get_settings;
        $default = "** current P4PASSWD **"
          unless empty $h->{P4PASSWD} ;
      }    
    </entry-handler>

    <arc to="dest_p4_filespec_prompt" guard="&non_empty_re;">
      <handler>
        if ( $ui->in_edit_mode ) {
            $answer = $ui->dest->repo_password
                if $answer eq "** current password **";
        }
        else {
          my $h = $ui->dest->p4_get_settings ;
          $answer = $h->{P4PASSWD}
              if $answer eq "** current P4PASSWD **";
        }
        $ui->dest->repo_password( $answer )
            unless empty $answer;
      </handler>
    </arc>
  </state>


  <state id="dest_p4_filespec_prompt" class-ids="prompt_class">
    <name>Destination File Specification</name>
    <description>

For Perforce destination servers, specify the path in Perforce
depot syntax.  Paths in Perforce depot syntax begin with "//",
and are followed by a depot name (by default, "depot").  Do not
use local filesystem specifications, client specifications, or
label specifications.

Specify the location on the destination server to place the
converted file revisions.

    </description>
    <entry-handler>  
      if ( $ui->in_edit_mode ) {
        $default = $ui->dest->repo_filespec;
        $is_current_value = 1;
      }
    </entry-handler>


    <arc to="wrapup" guard="qr#\A//#">
    <description>//depot/directory-path/...</description>
    <handler>
      $ui->dest->repo_filespec( $answer );
    </handler>
  </arc>
  </state>


</machine>
# Change User Description Committed
#28 5397 Barrie Slaymaker - Update P4PASSWD prompts to allow for not setting P4PASSWD
#27 4581 Barrie Slaymaker - user prompts have been improved, but not tested
#26 4064 Barrie Slaymaker - RevML is no longer offered in the UI
- Sources and dests are given an id in the UI
- The .vcp file name defaulting now works
#25 3859 Barrie Slaymaker - New UI files
#24 3647 Barrie Slaymaker - All UI prompts & descriptions rewritten.
- Minor tweak to VCP::Dest::p4 P4USER defaulting
#23 3644 Barrie Slaymaker - Add Save & Run options to end of UI
#22 3640 Barrie Slaymaker - xmllint no longer require to build UI
- UI now offers multiple choices where appropriate
#21 3572 John Fetkovich added y/n question to accept default of user_id
#20 3547 John Fetkovich Added defaults to yes/no questions (no in all cases)
#19 3538 John Fetkovich bug fix P4PASSWD defaulting
#18 3518 John Fetkovich more interactive ui improvements
#17 3502 John Fetkovich removed obsolete commented out (source,dest)->init calls in stml files
#16 3486 John Fetkovich moved (source or dest)->init calls to bin/vcp
#15 3455 John Fetkovich remove "change branch rev #1" yes/no option from interactive interface
#14 3403 John Fetkovich options given on all multiple choice prompts,
       and most free-form prompts where it makes sense
#13 3397 John Fetkovich prompt language improvement
#12 3396 John Fetkovich prompt language improvements
#11 3395 John Fetkovich various ui refinements
#10 3389 John Fetkovich made change_branch_rev prompt have both yes & no exit arcs
#9 3383 John Fetkovich removed setting of repo_id, it's now done in 'sub init'
       in the sources and dests
#8 3375 John Fetkovich more ui changes
#7 3374 John Fetkovich set repo_id in branch running in local directory also
#6 3306 Barrie Slaymaker Add StateML namespace support
#5 3305 John Fetkovich added calls to set fields in p4 source and dest
       state machines, and then call to init
#4 3289 John Fetkovich
#3 3260 John Fetkovich Improve some help texts
#2 3254 Barrie Slaymaker Redo machine naminf convention.
#1 3252 John Fetkovich added state machine parts for these destinations