lib/git_topic.rb
def reject  topic_or_opts=nil, opts={}
      if topic_or_opts.is_a? Hash
        topic = nil
        opts = topic_or_opts
      else
        topic = topic_or_opts
      end

      raise "Must be on a review branch." unless on_review_branch?
      unless working_tree_clean?
        if opts[:save_comments]
          comment
        else
          raise "Working tree must be clean without --save-comments."
        end
      end

      # switch to master
      # push to rejected, destroy remote
      # destroy local
      user, topic = user_topic_name( current_branch )

      rem_review_branch   = find_remote_review_branch( topic ).gsub( %r{^origin/}, '' )
      rem_rej_branch      = remote_rejected_branch( topic, user )

      refspecs = [
        "refs/heads/#{current_branch}:refs/heads/#{rem_rej_branch}",
        ":refs/heads/#{rem_review_branch}",
        "refs/notes/reviews/*:refs/notes/reviews/*"
      ].join( " " )
      git [
        "checkout master",
        "push origin #{refspecs}",
        "branch -D #{current_branch}"
      ]

      report  "Rejected topic #{user}/#{topic}"
    end
# Reject the branch currently being reviewed.
Reject the branch currently being reviewed.
Reject the branch currently being reviewed .
def reject  topic_or_opts=nil, opts={}
      if topic_or_opts.is_a? Hash
        topic = nil
        opts = topic_or_opts
      else
        topic = topic_or_opts
      end
      raise "Must be on a review branch." unless on_review_branch?
      unless working_tree_clean?
        if opts[:save_comments]
          comment
        else
          raise "Working tree must be clean without --save-comments."
        end
      end
      user, topic = user_topic_name( current_branch )
      rem_review_branch   = find_remote_review_branch( topic ).gsub( %r{^origin/}, '' )
      rem_rej_branch      = remote_rejected_branch( topic, user )
      refspecs = [
        "refs/heads/#{current_branch}:refs/heads/#{rem_rej_branch}",
        ":refs/heads/#{rem_review_branch}",
        "refs/notes/reviews/*:refs/notes/reviews/*"
      ].join( " " )
      git [
        "checkout master",
        "push origin #{refspecs}",
        "branch -D #{current_branch}"
      ]
      report  "Rejected topic #{user}/#{topic}"
    end
def reject topic_or_opts = nil , opts = { } if topic_or_opts . is_a? Hash topic = nil opts = topic_or_opts else topic = topic_or_opts end raise "Must be on a review branch." unless on_review_branch? unless working_tree_clean? if opts [ :save_comments ] comment else raise "Working tree must be clean without --save-comments." end end user , topic = user_topic_name ( current_branch ) rem_review_branch = find_remote_review_branch ( topic ) . gsub ( %r{ ^origin/ } , '' ) rem_rej_branch = remote_rejected_branch ( topic , user ) refspecs = [ "refs/heads/#{current_branch}:refs/heads/#{rem_rej_branch}" , ":refs/heads/#{rem_review_branch}" , "refs/notes/reviews/*:refs/notes/reviews/*" ] . join ( " " ) git [ "checkout master" , "push origin #{refspecs}" , "branch -D #{current_branch}" ] report "Rejected topic #{user}/#{topic}" end
Reject the branch currently being reviewed.
Reject the branch currently being reviewed .
# switch to master # push to rejected, destroy remote # destroy local
topic_or_opts
opts