VCP-Dest-p4.stml #26

  • //
  • guest/
  • perforce_software/
  • revml/
  • ui_machines/
  • VCP-Dest-p4.stml
  • View
  • Commits
  • Open Download .zip Download (6 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>

The hostname/IP address and port of the p4d to write to,
separated by a colon.  Defaults to the default P4PORT variable
as reported by the 'p4 set' command (with a final default to
"perforce:1666" if the p4 set command does not return anything).

    </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>

The username to connect to the destination p4d with.  Defaults
to the user reported by the 'p4 set' command (with a final
default to the USER environment variable if the p4 set command
does not return anything).

    </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>

The P4PASSWD needed to access the server.  Leave blank to use
the default reported by P4PASSWD.

WARNING: entering a password will cause it 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>

Where to place the transferred revisions.  This is a perforce
repository spec and must begin with "//" and a depot name
("//depot"), not a local filesystem spec or a "//client" or
"//label" spec.

    </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