<?xml version="1.0" encoding="UTF-8"?>
<commit>
  <added type="array"/>
  <modified type="array">
    <modified>
      <diff>@@ -27,7 +27,8 @@ module Bundler
 
       # Check to see whether the existing cache meets all the requirements
       begin
-        valid = Resolver.resolve(dependencies, [source_index], source_requirements)
+        valid = nil
+        # valid = Resolver.resolve(dependencies, [source_index], source_requirements)
       rescue Bundler::GemNotFound
       end
 </diff>
      <filename>lib/bundler/repository.rb</filename>
    </modified>
    <modified>
      <diff>@@ -85,11 +85,17 @@ module Bundler
       end
     end
 
+    def debug
+      puts yield if $debug
+    end
+
     def resolve(reqs, activated)
       # If the requirements are empty, then we are in a success state. Aka, all
       # gem dependencies have been resolved.
       throw :success, activated if reqs.empty?
 
+      debug { STDIN.gets ; print &quot;\e[2J\e[f&quot; ; &quot;==== Iterating ====\n\n&quot; }
+
       # Sort dependencies so that the ones that are easiest to resolve are first.
       # Easiest to resolve is defined by:
       #   1) Is this gem already activated?
@@ -98,23 +104,33 @@ module Bundler
       reqs = reqs.sort_by do |a|
         [ activated[a.name] ? 0 : 1,
           a.version_requirements.prerelease? ? 0 : 1,
+          @errors[a.name]   ? 0 : 1,
           activated[a.name] ? 0 : search(a).size ]
       end
 
+      debug { &quot;Activated:\n&quot; + activated.values.map { |a| &quot;  #{a.name} (#{a.version})&quot; }.join(&quot;\n&quot;) }
+      debug { &quot;Requirements:\n&quot; + reqs.map { |r| &quot;  #{r.name} (#{r.version_requirements})&quot;}.join(&quot;\n&quot;) }
+
       activated = activated.dup
       # Pull off the first requirement so that we can resolve it
       current   = reqs.shift
 
+      debug { &quot;Attempting:\n  #{current.name} (#{current.version_requirements})&quot;}
+
       # Check if the gem has already been activated, if it has, we will make sure
       # that the currently activated gem satisfies the requirement.
       if existing = activated[current.name]
         if current.version_requirements.satisfied_by?(existing.version)
+          debug { &quot;    * [SUCCESS] Already activated&quot; }
           @errors.delete(existing.name)
           # Since the current requirement is satisfied, we can continue resolving
           # the remaining requirements.
           resolve(reqs, activated)
         else
+          debug { &quot;    * [FAIL] Already activated&quot; }
           @errors[existing.name] = [existing, current]
+          debug { current.required_by.map {|d| &quot;      * #{d.name} (#{d.version_requirements})&quot; }.join(&quot;\n&quot;) }
+          # debug { &quot;    * All current conflicts:\n&quot; + @errors.keys.map { |c| &quot;      - #{c}&quot; }.join(&quot;\n&quot;) }
           # Since the current requirement conflicts with an activated gem, we need
           # to backtrack to the current requirement's parent and try another version
           # of it (maybe the current requirement won't be present anymore). If the
@@ -123,6 +139,7 @@ module Bundler
           parent = current.required_by.last || existing.required_by.last
           # We track the spot where the current gem was activated because we need
           # to keep a list of every spot a failure happened.
+          debug { &quot;    -&gt; Jumping to: #{parent.name}&quot; }
           throw parent.name, existing.required_by.last.name
         end
       else
@@ -158,6 +175,7 @@ module Bundler
           # the conflicting gem, hopefully finding a combination that activates correctly.
           @stack.reverse_each do |savepoint|
             if conflicts.include?(savepoint)
+              debug { &quot;    -&gt; Jumping to: #{savepoint}&quot; }
               throw savepoint
             end
           end
@@ -172,11 +190,16 @@ module Bundler
       spec.required_by &lt;&lt; requirement
 
       activated[spec.name] = spec
+      debug { &quot;  Activating: #{spec.name} (#{spec.version})&quot; }
+      debug { spec.required_by.map { |d| &quot;    * #{d.name} (#{d.version_requirements})&quot; }.join(&quot;\n&quot;) }
 
       # Now, we have to loop through all child dependencies and add them to our
       # array of requirements.
+      debug { &quot;    Dependencies&quot;}
       spec.dependencies.each do |dep|
         next if dep.type == :development
+        debug { &quot;    * #{dep.name} (#{dep.version_requirements})&quot; }
+        dep.required_by.replace(requirement.required_by)
         dep.required_by &lt;&lt; requirement
         reqs &lt;&lt; dep
       end</diff>
      <filename>lib/bundler/resolver.rb</filename>
    </modified>
  </modified>
  <removed type="array"/>
  <parents type="array">
    <parent>
      <id>6132b80abb425d2a29b3ddbd24a60c0788e5a606</id>
    </parent>
  </parents>
  <author>
    <name>Carl Lerche</name>
    <email>carllerche@mac.com</email>
  </author>
  <url>http://github.com/jweiss/bundler/commit/90b261f803947427783a482fd08873fd27bc213f</url>
  <id>90b261f803947427783a482fd08873fd27bc213f</id>
  <committed-date>2009-11-09T12:55:13-08:00</committed-date>
  <authored-date>2009-10-17T13:51:03-07:00</authored-date>
  <message>Fix a minor resolver bug and improve traversal path</message>
  <tree>e9f6c11f878fbaefa0c168a96907e6011e098704</tree>
  <committer>
    <name>Carl Lerche</name>
    <email>carllerche@mac.com</email>
  </committer>
</commit>
