def tickets(options={})
      since  = options[:since]
      merged = options[:merged]

      tickets = Set.new
      link    = options[:link]

      @git.log("#{since}..#{merged}", :merges => true).each do |commit|
        if (match = MERGE_COMMENT.match(commit.comment))
          words = match[1].split(WORD_BOUNDARY)
        else
          words = commit.comment.split(WORD_BOUNDARY)
        end

        got = words.detect do |w|
          if match = link.match(w)
            if match[1]
              tickets << match[1]
            else
              raise ArgumentError, "Regexp '#{link}' lacks capture groups; please use a () somewhere"
            end
          else
            nil
          end
        end
        unless got
          logger.warn "Couldn't infer a ticket link from '#{commit.comment}'"
        end
      end

      if (link_to = options[:link_to])
        link_to = link_to + '/' unless link_to =~ %r{/$}
        tickets.each { |t| puts link_to + t }
      else
        tickets.each { |t| puts t }
      end
    end
def tickets(options={})
      since  = options[:since]
      merged = options[:merged]

      tickets = Set.new
      link    = options[:link]

      @git.log("#{since}..#{merged}", :merges => true).each do |commit|
        if (match = MERGE_COMMENT.match(commit.comment))
          words = match[1].split(WORD_BOUNDARY)
        else
          words = commit.comment.split(WORD_BOUNDARY)
        end

        got = words.detect do |w|
          if match = link.match(w)
            if match[1]
              tickets << match[1]
            else
              raise ArgumentError, "Regexp '#{link}' lacks capture groups; please use a () somewhere"
            end
          else
            nil
          end
        end
        unless got
          logger.warn "Couldn't infer a ticket link from '#{commit.comment}'"
        end
      end

      if (link_to = options[:link_to])
        link_to = link_to + '/' unless link_to =~ %r{/$}
        tickets.each { |t| puts link_to + t }
      else
        tickets.each { |t| puts t }
      end
    end
Produce a report of all the tickets that have been merged into the named branch. This works
 by scanning merge commit comments, recognizing words that look like a ticket reference, and
 extracting a matched segment as the ticket ID. The user must specify a matching Regexp using
 the :link option.

 @example Match Acunote stories
   git.tickets(:link=>/acu([0-9]+)/)

 @option options [String] :since the name of a "base branch" representing the previous release
 @option options [Regexp] :merged the name of a branch (e.g. master) representing the next release
 @option options [Regexp] :link a word prefix that connotes links to an external ticketing system
 @option options [Boolean] :local Consider only local branches
 @option options [Boolean] :remote Consider only remote branches