lib/git_topic.rb
def review  ref=nil, opts={}
      rb = remote_branches_organized
      review_branches = rb[:review]

      if ref.nil?
        # select the oldest (by HEAD) topic, if any exist
        if review_branches.empty?
          puts "nothing to review."
          return
        else
          user, topic = oldest_review_user_topic
        end
      else
        p             = topic_parts( ref )
        user, topic   = p[:user], p[:topic]
      end

      if remote_topic_branch = find_remote_review_branch( topic )
        # Get the actual user/topic, e.g. to get the user if ref only specifies
        # the topic.
        real_user, real_topic = user_topic_name( remote_topic_branch )
        git [
          switch_to_branch(
            review_branch( real_topic, real_user ),
            remote_topic_branch )]
      else
        raise "No review topic found matching ‘#{ref}’"
      end
      report  "Reviewing topic #{user}/#{topic}."

      unless rebased_to_master?
        git "rebase --quiet master"
        report(
          "
            #{user}/#{topic} was not rebased to master, but has successfully
            been automatically rebased.
          ".unindent,
          "
            #{user}/#{topic} was not rebased to master, and I could not
            automatically rebase it.  You will not be able to accept this topic.
            Either
              1) rebase the topic manually or
              2) reject the topic and ask the author to rebase.
          ".unindent )
      end
    end
# Switch to a review branch to check somebody else's code.
Switch to a review branch to check somebody else's code.
Switch to a review branch to check somebody else ' s code .
def review  ref=nil, opts={}
      rb = remote_branches_organized
      review_branches = rb[:review]
      if ref.nil?
        if review_branches.empty?
          puts "nothing to review."
          return
        else
          user, topic = oldest_review_user_topic
        end
      else
        p             = topic_parts( ref )
        user, topic   = p[:user], p[:topic]
      end
      if remote_topic_branch = find_remote_review_branch( topic )
        real_user, real_topic = user_topic_name( remote_topic_branch )
        git [
          switch_to_branch(
            review_branch( real_topic, real_user ),
            remote_topic_branch )]
      else
        raise "No review topic found matching ‘#{ref}’"
      end
      report  "Reviewing topic #{user}/#{topic}."
      unless rebased_to_master?
        git "rebase --quiet master"
        report(
          "
            #{user}/#{topic} was not rebased to master, but has successfully
            been automatically rebased.
          ".unindent,
          "
            #{user}/#{topic} was not rebased to master, and I could not
            automatically rebase it.  You will not be able to accept this topic.
            Either
              1) rebase the topic manually or
              2) reject the topic and ask the author to rebase.
          ".unindent )
      end
    end
def review ref = nil , opts = { } rb = remote_branches_organized review_branches = rb [ :review ] if ref . nil? if review_branches . empty? puts "nothing to review." return else user , topic = oldest_review_user_topic end else p = topic_parts ( ref ) user , topic = p [ :user ] , p [ :topic ] end if remote_topic_branch = find_remote_review_branch ( topic ) real_user , real_topic = user_topic_name ( remote_topic_branch ) git [ switch_to_branch ( review_branch ( real_topic , real_user ) , remote_topic_branch ) ] else raise "No review topic found matching ‘#{ref}’" end report "Reviewing topic #{user}/#{topic}." unless rebased_to_master? git "rebase --quiet master" report ( "
            #{user}/#{topic} was not rebased to master, but has successfully
            been automatically rebased.
          " . unindent , "
            #{user}/#{topic} was not rebased to master, and I could not
            automatically rebase it.  You will not be able to accept this topic.
            Either
              1) rebase the topic manually or
              2) reject the topic and ask the author to rebase.
          " . unindent ) end end
Switch to a review branch to check somebody else's code.
Switch to a review branch to check somebody else ' s code .
# select the oldest (by HEAD) topic, if any exist # Get the actual user/topic, e.g. to get the user if ref only specifies # the topic.
ref
opts