VCP-Dest-p4.stml #22

  • //
  • guest/
  • perforce_software/
  • revml/
  • ui_machines/
  • VCP-Dest-p4.stml
  • View
  • Commits
  • Open Download .zip Download (5 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 private p4d in a local directory</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>
      $default = "no";
    </entry-handler>

    <arc from="dest_prompt" guard="'p4'">
      <description>p4</description>

      <handler>
        require VCP::Dest::p4;
        $ui->{Dest} = VCP::Dest::p4->new;
        $ui->{Dest}->repo_scheme( 'p4' );
      </handler>
    </arc>

    <arc to="dest_p4_p4d_dir_prompt" guard="'yes'">
      <description>yes</description>
      <handler>$ui->{Dest}->{P4_RUN_P4D} = 1;</handler>
    </arc>

    <arc to="dest_p4_host_prompt" guard="'no'">
      <description>no</description>
    </arc>
  </state>


  <state id="dest_p4_p4d_dir_prompt" class-ids="prompt_class">
    <name>Directory to run p4d in</name>
    <description>

Enter the directory to launch the p4d in.  VCP will then check that
this is a valid directory.
    
    </description>

    <arc to="dest_p4_user_default_prompt" guard="sub { !empty $_ and !empty $ui->{Dest}->p4_default_user }">
      <handler>
        # will set repo_server
        $ui->{Dest}->ui_set_p4d_dir( $answer );
      </handler>
    </arc>
    <arc to="dest_p4_user_prompt" guard="sub { !empty $_ and empty $ui->{Dest}->p4_default_user }">
      <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>P4 Host name, including port</name>
    <description>

Enter the name and port of the p4d to read from, separated by a colon.
Defaults to the P4HOST environment variable if set or "perforce:1666"
if not.

    </description>
    <entry-handler>
      $default = empty $ui->{Dest}->{P4_SET_OUTPUT}->{P4HOST} 
                 ? "perforce:1666" 
                 : $ui->{Dest}->{P4_SET_OUTPUT}->{P4HOST} ;
    </entry-handler>

    <arc to="dest_p4_user_default_prompt" guard="sub { !empty $_ and !empty $ui->{Dest}->p4_default_user }">
      <description>perforce:1666</description>
      <handler>
        $ui->{Dest}->repo_server( $answer )
            unless empty $answer;
      </handler>
    </arc>
    <arc to="dest_p4_user_prompt" guard="sub { !empty $_ and empty $ui->{Dest}->p4_default_user }">
      <description>perforce:1666</description>
      <handler>
        $ui->{Dest}->repo_server( $answer )
            unless empty $answer;
      </handler>
    </arc>
  </state>


  <state id="dest_p4_user_default_prompt" class-ids="prompt_class">
    <name>Use default P4USER value </name>
    <description>

Use the default for the p4 user, which is the P4USER environment
variable, if present; or the login user if not.

    </description>
    <entry-handler>
      $prompt .= "(" . $ui->{Dest}->p4_default_user . ")";
    </entry-handler>

    <arc to="dest_p4_password_prompt" guard="'yes'">
      <description>yes</description>
      <handler>
        $ui->{Dest}->repo_user( $ui->{Dest}->p4_default_user );
      </handler>
    </arc>
    <arc to="dest_p4_user_prompt" guard="'no'">
      <description>no</description>
    </arc>
  </state>


  <state id="dest_p4_user_prompt" class-ids="prompt_class">
    <name>P4 user id</name>
    <description>

Enter the p4 user id value needed to access the server, or leave blank
if none needed.

    </description>

    <arc to="dest_p4_password_prompt">
      <handler>
        $ui->{Dest}->repo_user( $answer )
            unless empty $answer;
      </handler>
    </arc>
  </state>


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

If a password (P4PASSWD) is needed to access the server, enter it here.

WARNING: password will be echoed in plain text to the terminal.

    </description>
    <entry-handler>
      $default = "Use value of P4PASSWD environment variable"
          unless empty $ui->{Dest}->{P4_SET_OUTPUT}->{P4PASSWD};
    </entry-handler>

    <arc to="dest_p4_filespec_prompt" guard="&non_empty_re;">
      <handler>
        $answer = $ui->{Dest}->{P4_SET_OUTPUT}->{P4PASSWD}
            if defined $answer and $answer eq "Use value of P4PASSWD environment variable";
        $ui->{Dest}->repo_password( $answer )
            unless empty $answer;
      </handler>
    </arc>
  </state>


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

The destination spec is a perforce repository spec and must begin with
// and a depot name ("//depot"), not a local filesystem spec or a
client spec.

    </description>

    <arc to="convert" 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