VCP.stml #18

  • //
  • guest/
  • perforce_software/
  • revml/
  • ui_machines/
  • VCP.stml
  • View
  • Commits
  • Open Download .zip Download (6 KB)
<machine
  id="VCP"
  xmlns="http://slaysys.com/StateML/1.0"
  xmlns:graphviz="http://slaysys.com/StateML/1.0"
>

  <!--
  
      BASE CLASSES
      ============

      See the README for details.  Short version: these control
      both appearance (in the generated graph) and behavior
      (the .tt2 template looks for exit_class, for instance).

      Prompts should be named with a trailing _prompt.

  -->

  <class id="prompt_class"     graphviz:shape="record"/>
  <class id="entry_class"      graphviz:shape="ellipse"/>
  <class id="exit_class"       graphviz:shape="ellipse"/>

  <!-- ============= EVENT DEFINITIONS =============== -->

  <event id="#DEFAULT" name="">
  </event>

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

  <state id="init" class-ids="entry_class">
    <description>Initialize the machine</description>
    <arc goto="source_id_prompt"/>
  </state>

  <state id="source_id_prompt" class-ids="prompt_class">
    <name>Source id</name>
    <description>

A symbolic name for the source repository.  This is used to
organize the VCP databases and to refer to the source
repository in other places.

Must consist of a leading letter then letters, numbers,
underscores and dashes only.
    
    </description>

    <entry-handler><![CDATA[
      $default = $ui->source_repo_id && $ui->source_repo_id;
      $is_current_value = $ui->{EditMode} = 1 unless empty $default;
    ]]></entry-handler>

    <arc goto="source_type_prompt" guard="qr{\A[a-z][a-z0-9-]*\z}i" >
      <handler>
        ## Set the UI's source_repo_id.  This will write-through to
        ## the underlying source if it's been loaded already,
        ## otherwise the call to new_source() will do the write-through
        ## when it is loaded later.
        $ui->source_repo_id( $answer )
            unless ! empty $ui->source_repo_id and empty $answer;
      </handler>
    </arc>

  </state>


  <state id="source_type_prompt" class-ids="prompt_class">
    <name>Source type</name>
    <description>

The kind of repository to copy data from.
    
    </description>

    <entry-handler><![CDATA[
      $default = $ui->source && $ui->source->repo_scheme;
      $is_current_value = $ui->{EditMode} = 1 unless empty $default;
    ]]></entry-handler>
    <!-- no arcs here; see the arc from="source_type_prompt"
         in each of the subsidiary VCP-*-*.stml files.
    -->

  </state>


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

A symbolic name for the destination repository.  This is used to
organize the VCP databases and to refer to the destination
repository in other places.

Must consist of a leading letter then letters, numbers,
underscores and dashes only.
    
    </description>

    <entry-handler><![CDATA[
      $default = $ui->dest_repo_id && $ui->dest_repo_id;
      $is_current_value = $ui->{EditMode} = 1 unless empty $default;
    ]]></entry-handler>

    <arc goto="dest_type_prompt" guard="qr{\A[a-z][a-z0-9-]*\z}i" >
      <handler>
        ## Set the UI's dest_repo_id.  This will write-through to
        ## the underlying destination if it's been loaded already,
        ## otherwise the call to new_dest() will do the write-through
        ## when it is loaded later.
        $ui->dest_repo_id( $answer )
            unless ! empty $ui->dest_repo_id and empty $answer;
      </handler>
    </arc>

  </state>


  <state id="dest_type_prompt" class-ids="prompt_class">
    <name>Destination SCM type</name>
    <description>

The kind of repository to copy data to.
    
    </description>

    <entry-handler><![CDATA[
      $default = $ui->dest && $ui->dest->repo_scheme;
      $is_current_value = $ui->{EditMode} = 1 unless empty $default;
    ]]></entry-handler>

    <!-- no arcs here; see the final state(s) in each of the
         subsidiary VCP-*-*.stml files.
    -->
  </state>

  <state id="wrapup" class-ids="prompt_class">
    <name>Next step</name>

    <description>

What to do with all of the entered options.

    </description>

    <entry-handler>
      $default = "Save config file and run";
    </entry-handler>

    <arc to="save_config_file" guard="'Save config file and run'">
      <description>Save config file and run</description>
      <handler>
        $ui->{Run} = 1;
      </handler>
    </arc>

    <arc to="save_config_file" guard="'Save config file and exit'">
      <description>Save config file and exit</description>
    </arc>

    <arc to="convert" guard="'Run without saving config file'">
      <description>Run without saving config file</description>
      <handler>
        $ui->{Run} = 1;
      </handler>
    </arc>
  </state>

  <state id="save_config_file" class-ids="prompt_class">

    <name>Config file name</name>

    <description>
    
What filename to write the configuration file to.

    </description>

    <entry-handler>
      if ( ! empty $ui->{Filename} ) {
        $default = $ui->{Filename};
	$is_current_value = 1;
      }
      else {
	$default = $ui->source->repo_id . "_to_" . $ui->dest->repo_id . ".vcp";
      }
    </entry-handler>

    <arc to="convert" guard="qr/./">
      <description>Config filename</description>
      <handler>
        $ui->{SaveAsConfigFileName} = $answer;
        if ( -e $answer ) {
            die "Warning: '$answer' exists but is a directory!\n"
                if -d $answer;
            die "Warning: '$answer' exists but is not a regular file!\n"
                unless -f $answer;
            die "Warning: '$answer' exists but is not writable!\n"
                unless -w $answer;
            die "Warning: '$answer' already exists!\n";
        }
      </handler>
    </arc>
  </state>

  <state id="convert" class-ids="exit_class">
    <description>Run VCP with the options entered</description>
    <entry-handler></entry-handler>
  </state>

</machine>
# Change User Description Committed
#21 5399 Barrie Slaymaker - Allow underscores after first chars in source and
         dest IDs.
#20 4581 Barrie Slaymaker - user prompts have been improved, but not tested
#19 4502 Barrie Slaymaker - "Run without saving" option removed
#18 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
#17 3859 Barrie Slaymaker - New UI files
#16 3666 Barrie Slaymaker - vcp can now edit existing .vcp files, for VSS sources and revml dests
#15 3647 Barrie Slaymaker - All UI prompts & descriptions rewritten.
- Minor tweak to VCP::Dest::p4 P4USER defaulting
#14 3644 Barrie Slaymaker - Add Save & Run options to end of UI
#13 3640 Barrie Slaymaker - xmllint no longer require to build UI
- UI now offers multiple choices where appropriate
#12 3481 John Fetkovich intro text moved out of state machine to bin/vcp.
       no longer requires user interaction to move on.
#11 3403 John Fetkovich options given on all multiple choice prompts,
       and most free-form prompts where it makes sense
#10 3395 John Fetkovich various ui refinements
#9 3306 Barrie Slaymaker Add StateML namespace support
#8 3254 Barrie Slaymaker Redo machine naminf convention.
#7 3251 John Fetkovich remove arc to 'convert' state
#6 3244 Barrie Slaymaker Integrate VCP::UI with bin/vcp.
       Type 'vcp' to run the UI.
#5 3240 Barrie Slaymaker UI definition cleanup
#4 3235 John Fetkovich small fixes
#3 3231 Barrie Slaymaker work on STML->source code conventions
#2 3229 Barrie Slaymaker Add more .stml files
#1 3220 Barrie Slaymaker Rename script_machines/ to ui_machines/