<?xml version="1.0" encoding="UTF-8"?>
<commit>
  <added type="array"/>
  <modified type="array">
    <modified>
      <diff>@@ -1,35 +1,36 @@
-TODO
-init.rb
-rake_helper.rb
 Manifest
-README.txt
-test/event.spec
-test/error.spec
-test/red_steak.spec
-test/synch_async.spec
-test/copier.spec
-test/example.spec
-test/pending_transition.spec
 Rakefile
+TODO
+init.rb
 install.rb
-example/loan_officer.zuml
-example/ex1.rb
-lib/red_steak/pseudostate.rb
+lib/red_steak.rb
 lib/red_steak/base.rb
-lib/red_steak/transition.rb
-lib/red_steak/final_state.rb
+lib/red_steak/builder.rb
 lib/red_steak/copier.rb
-lib/red_steak/namespace.rb
 lib/red_steak/dot.rb
-lib/red_steak/vertex.rb
-lib/red_steak/builder.rb
-lib/red_steak/state_machine.rb
 lib/red_steak/error.rb
-lib/red_steak/state.rb
-lib/red_steak/named_element.rb
-lib/red_steak/named_array.rb
+lib/red_steak/final_state.rb
 lib/red_steak/machine.rb
-lib/red_steak.rb
-lib/tasks/p4_svn.rb
-lib/tasks/p4_git.rb
+lib/red_steak/named_array.rb
+lib/red_steak/named_element.rb
+lib/red_steak/namespace.rb
+lib/red_steak/pseudostate.rb
+lib/red_steak/state.rb
+lib/red_steak/state_machine.rb
+lib/red_steak/transition.rb
+lib/red_steak/vertex.rb
 lib/tasks/p4.rb
+lib/tasks/p4_git.rb
+lib/tasks/p4_svn.rb
+test/example.spec
+test/pending_transition.spec
+test/red_steak.spec
+test/synch_async.spec
+test/copier.spec
+test/error.spec
+test/event.spec
+example/ex1.rb
+example/loan_officer.zuml
+spec/builder_spec.rb
+README.txt
+rake_helper.rb</diff>
      <filename>Manifest</filename>
    </modified>
    <modified>
      <diff>@@ -23,7 +23,7 @@ end
 begin
   require 'spec/rake/spectask'
  
-  SPEC_FILES = FileList['test/**/*.spec']
+  SPEC_FILES = FileList['test/**/*.spec'] + FileList['spec/**/*_spec.rb']
   SPEC_OPTS = ['--color', '--backtrace']
 
   Spec::Rake::SpecTask.new(&quot;spec&quot;) do |t|</diff>
      <filename>Rakefile</filename>
    </modified>
    <modified>
      <diff>@@ -22,7 +22,7 @@ module RedSteak
       # If some options are already set, merge them.
       if @options
         return @options if opts.empty?
-        @options.merge(_dup_opts(opts))
+        @options.update(_dup_opts(opts))
       else
         @options = _dup_opts opts
       end</diff>
      <filename>lib/red_steak/base.rb</filename>
    </modified>
    <modified>
      <diff>@@ -259,18 +259,30 @@ module RedSteak
       raise ArgumentError, &quot;target state not given&quot; unless opts[:target]
       
       opts[:statemachine] = @context[:statemachine]
-      @transitions &lt;&lt; {
+
+      x = {
         :block =&gt; blk,
         :owner =&gt; _owner,
         :opts =&gt; opts,
+        :caller =&gt; caller(1).first,
       }
       
+      if (xn = x[:opts][:name]) &amp;&amp; @transitions.any? { | x2 | (x2n = x2[:opts][:name]) &amp;&amp; x2n == xn }
+        raise Error, 
+          :message =&gt; 'Ambigous Transition Name',
+          :data =&gt; x,
+          :others =&gt; @transitions
+      end
+
+      @transitions &lt;&lt; x
+      
       self
     end
     
 
     private
 
+
     def _with_context name, val
       current_save = @current
  
@@ -406,7 +418,7 @@ module RedSteak
 
       _log { &quot;  #{opts.inspect}&quot; }
        
-      t = _find_transition opts
+      t = _find_transition opts, owner
 
       _with_context :transition, t do        
         instance_eval &amp;blk if blk
@@ -415,26 +427,40 @@ module RedSteak
 
 
     # Locates a transition by name or creates a new object.
-    def _find_transition opts
+    def _find_transition opts, owner
       raise ArgumentError, &quot;opts expected Hash&quot; unless Hash === opts
 
       opts[:source] = _find_state opts[:source]
       opts[:target] = _find_state opts[:target]
-      opts[:name] ||= &quot;#{opts[:source].to_s}-&gt;#{opts[:target].to_s}&quot;.to_sym
 
+      # Attempt to construct a unique Transition name.
+      unless opts[:name] 
+        name = &quot;#{opts[:source].to_s}-&gt;#{opts[:target].to_s}&quot;.to_sym
+        i = 1
+        while @transitions.any?{ | t | t[:opts][:name] == name }
+          name = &quot;#{opts[:source].to_s}-&gt;#{opts[:target].to_s}-#{i += 1}&quot;.to_sym
+          # $stderr.puts &quot;  #{__LINE__} #{name.inspect}&quot;
+        end
+        opts[:name] = name
+      end
+
+      # Try to locate an existing transition by name.
       t = opts[:statemachine].transitions.find do | x |
         opts[:name] == x.name
       end
       
-      unless t
-        # opts[:statemachine] ||= @context[:statemachine]
+      # If found just update it's options.
+      # Otherwise create a new one.
+      if t
+        # $stderr.puts &quot;   * UPDATING #{t.inspect}&quot;
+        raise 'unexpected statemachine' unless opts[:statemachine] == t.statemachine
+        raise 'unexpected source' unless opts[:source] == t.source
+        raise 'unexpected target' unless opts[:target] == t.target
+        opts.delete(:name)
+        t.options = opts
+      else
         t = Transition.new opts
         opts[:statemachine].add_transition! t
-      else
-        if t
-          opts.delete(:name)
-          t.options = opts
-        end
       end
       
       t</diff>
      <filename>lib/red_steak/builder.rb</filename>
    </modified>
    <modified>
      <diff>@@ -652,7 +652,7 @@ module RedSteak
         result = @dot_command_output = `#{cmd} 2&gt;&amp;1`
 
         # Fall back to plain svg renderer.
-        if result =~ /Warning: language .* not recognized, use one of:/
+        if result =~ /Warning: language .* not recognized, use one of:/ || ! File.exist?(file_svg)
           cmd = &quot;dot -Tsvg #{file_dot.inspect} -o #{file_svg.inspect}&quot;
           _log { &quot;Run: #{cmd}&quot; }
           result = @dot_command_output = `#{cmd} 2&gt;&amp;1`</diff>
      <filename>lib/red_steak/dot.rb</filename>
    </modified>
    <modified>
      <diff>@@ -11,7 +11,7 @@ describe &quot;RedSteak Synchronous/Asynchronous Interactions&quot; do
   def sm name = nil
     @sm ||=
       RedSteak::Builder.new.build do
-        statemachine (name or raise 'no name') do
+        statemachine(name || (raise 'no name')) do
           initial :start
           final :final
         </diff>
      <filename>test/synch_async.spec</filename>
    </modified>
  </modified>
  <removed type="array"/>
  <parents type="array">
    <parent>
      <id>1bb4e28a57eb0d52eb87f532ebb59c1dba88f466</id>
    </parent>
  </parents>
  <author>
    <name>Kurt Stephens</name>
    <email>ks.github@kurtstephens.com</email>
  </author>
  <url>http://github.com/kstephens/red_steak/commit/220f807bddd54863de8c9a332cf760914c00d484</url>
  <id>220f807bddd54863de8c9a332cf760914c00d484</id>
  <committed-date>2009-05-05T09:26:05-07:00</committed-date>
  <authored-date>2009-05-05T09:26:05-07:00</authored-date>
  <message>Fixed issue with Builder augmentation; force unique Transition names in Builder.</message>
  <tree>0a38dd630268e9a99524eb2fa68faa653b479dbc</tree>
  <committer>
    <name>Kurt Stephens</name>
    <email>ks.github@kurtstephens.com</email>
  </committer>
</commit>
