#!/bin/bash ########################################################################### # determines outstanding changesets between branches ########################################################################### # $1 = name of source branch # $2 = name of target branch # $3 = ticket prefix ########################################################################### rootdir=${0%/*} allowed_options="-q --no-merge-details" # by default, provide details for merge commits mergedetails=1 if [ "$(type -t usage)" != "function" ] then usage() { echo "Usage: $(basename $0) [-q] " exit 1 } fi . "$rootdir/include/config.inc" . "$rootdir/include/options.inc" . "$rootdir/include/display.inc" . "$rootdir/include/utility.inc" . "$rootdir/include/cleanup.inc" . "$rootdir/include/svn.inc" . "$rootdir/include/repo-info.inc" . "$rootdir/include/branching.inc" . "$rootdir/include/ticket.inc" case $1 in -*) warning "Unknown option: $1" usage ;; esac has_option "--no-merge-details" && mergedetails= if [ $# -ne 3 ] then usage fi [ -n "$1" ] || error "Source branch name is missing" [ -n "$2" ] || error "Target branch name is missing" [ -n "$3" ] || error "Ticket prefix is missing" src="$1" tgt="$2" prefix="$3" shift 3 message "Loading repository information" standout load_repo_info message "Initializing local branches" standout init_local_branch "$src" init_local_branch "$tgt" tgtmax=$(get_head_rev "$tgt") [ -n "$tgtmax" ] || error "Computing maximum revision of $tgt failed" srcrevs=$(get_revs "$src" "$tgt") tgtmerged=$(get_merged_revs "$tgt" "$src") revs= tickets= message "Determining outstanding changesets" standout while read rev do msg=$(get_log_message "$src" $rev) for t in $(extract_tickets "$msg" "$prefix") do echo "$tickets" | grep -q "\<$t\>" || tickets+="$t " done revs+="$rev " print_log_messages "$src" $rev $mergedetails done < <(subtract_list "$srcrevs" "$(expand_list "$tgtmerged")") tickets="${tickets% }" if [ -n "$tickets" ] then message "Tickets which are missing:" standout for t in $tickets do message " $t: " -n message "$(get_ticket_title "$t")" yellow done else message "No missing changesets found." green fi