Commits

Anonymous committed 5979157

work in tracking down this gnarly bug

Comments (0)

Files changed (4)

-We want a piece of software that's:
-  1) Free of religious devotion to one VCS
-  2) Let's us customize how we interact with it. If we want git's commands because i used it the longest, let us use them with a fucking mercurial repo.
+We want a piece of software that:
+  1) Is Free of religious devotion to one VCS
+  2) Lets us customize how we interact with it. If we want git's commands because i used it the longest, let us use them with a fucking mercurial repo.
   3) We want the extension we wrote for the dartmouth review repo, which is HG, to work on my github project too. because they're both DVCS, damnit.
   4) We want to be able to directly modify the commands they give us. git's remove command is `git rm`. it should be dead simple to make `git remove` map directly to that, and we mean less than 1 minute of thought/work.
   5) We want to prove ruby is viable for large-scale applications, not just web frameworks. can you think of any non-trivial actual applications written in ruby?
-  6) We want to discover where the limits are on Ruby for use in large applications. Where is the language slow? Where is it fast? What techniques are effective? Too many people opine about proper Ruby code, then provide 10 lines of code to illustrate their point. We wrote 15,000 and hope to write many more: what can we learn from that?
+  6) We want to discover where the limits are on Ruby for use in large applications. Where is the language slow? Where is it fast? What techniques are effective? Too many people opine about proper Ruby code, then provide 10 lines of code to illustrate their point. We wrote 15,000 and hope to write many more: what can we learn from that?
+  7) We want to be an example of proper documentation.

lib/amp/commands/commands/workflows/hg/bundle.rb

 
   c.opt :force, "Run even when remote repository is unrelated",     :short => '-f'
   c.opt :rev,   "A changeset up to which you would like to bundle", :short => '-r', :type => :string
-  c.opt :base,  "A base changeset to specify instead of a destination",             :type => :string
+  c.opt :base,  "A base changeset to specify instead of a destination",             :type => :string, :multi => true
   c.opt :all,   "Bundle all changesets in the repository",          :short => '-a'
   c.opt :type,  "Bundle compression type to use (default: bzip2)",  :short => '-t',                   :default => 'bzip2'
   c.opt :ssh,   "Specify ssh command to use",                       :short => '-e', :type => :string
     
     # Type notation!
     # rev :: Amp::Changeset
-    rev  = repo.lookup rev
-    base = repo.lookup(opts[:all] ? nil : opts[:base]) # --all overrides --base
+    rev  &&= repo.lookup rev
+    base   = opts[:all] ? [nil] : (opts[:base] || []) # --all overrides --base
     
-    if base
+    # we want [nil] and ["1", "23"] to be triggered here.
+    if !base.empty?
       if dest
         raise abort("--base is incompatible with specifiying a destination")
       end
       
+      base = base.map {|b| repo.lookup b }
+      
       o   = []
       has = {Amp::RevlogSupport::Node::NULL_ID => nil}
       
         has.update repo.changelog.reachable_nodes_for_node(node_id)
       end
       
-      visit = [rev]
+      visit = rev ? [rev] : repo.changelog.heads
       seen  = {} # {node => Boolean} where node is a string
       add   = proc do |node|
         seen[node] = true
       end
       
       until visit.empty?
-        n = visit.pop
+        n = visit.shift
         
         # for those who are lame:
         # rents = 'rents = parents
       dest, revs, checkout = *c.parse_url(path, [rev])
       # alio is Esperanto for "other"; it's conveniently the same length as repo
       alio = Amp::Repositories.pick nil, dest
-      o = repo.find_outgoing_roots alio, :force => opts[:force]
+      o    = repo.find_outgoing_roots alio, :force => opts[:force]
     end # end if
     
     # Oh no, bitches! If you thought we were done, you'd be wrong.
     # Nevermind, false alarm. Turns out there's not that much left to do.
     
     cg = if revs
-           p [o, rev]
            repo.changegroup_subset o, [rev], 'bundle'
          else
+           p [">>", o]
+           # !!!!!!!!!!!! The bug is in the following line !!!!!!!!! KILLME
            repo.changegroup o, 'bundle'
          end
     

lib/amp/repository/repositories/local_repository.rb

File contents unchanged.

lib/amp/revlogs/revlog.rb

     # @return [String] the node's ID
     def node_id_for_index(index)
       unless @index[index]
-        raise RevlogSupport::LookupError.new("Couldn't find node for id '#{index}'")
+        raise RevlogSupport::LookupError.new("Couldn't find node for id #{index.inspect}")
       end
       @index[index].node_id
     end
     #   the requested node.
     def revision_index_for_node(id)
       unless @index.node_map[id]
-        p id
-        raise StandardError.new("Couldn't find node for id '#{id}'")
+        raise StandardError.new("Couldn't find node for id #{id.inspect}")
       end
       @index.node_map[id]
     end