|
|
|
|
@@ -93,10 +93,6 @@ EOF
|
|
|
|
|
|
|
|
|
|
ensure_dirs() {
|
|
|
|
|
mkdir -p "$SESSIONS_DIR"
|
|
|
|
|
mkdir -p "$LOGS_DIR"
|
|
|
|
|
mkdir -p "$WORKTREES_DIR"
|
|
|
|
|
mkdir -p "$QUEUE_DIR"
|
|
|
|
|
mkdir -p "$QUEUE_ITEMS_DIR"
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
ensure_worktree_dir() {
|
|
|
|
|
@@ -261,9 +257,7 @@ PYEOF
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
ensure_queue_dirs() {
|
|
|
|
|
mkdir -p "$QUEUE_DIR"
|
|
|
|
|
mkdir -p "$QUEUE_ITEMS_DIR"
|
|
|
|
|
mkdir -p "$LOGS_DIR"
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
generate_queue_id() {
|
|
|
|
|
@@ -854,11 +848,6 @@ EOF
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
parse_issue_ref_from_message() {
|
|
|
|
|
# DEPRECATED: This function is not called anywhere.
|
|
|
|
|
# The active implementation is extract_issue_ref_from_message()
|
|
|
|
|
# in kugetsu-session.sh which is used by cmd_delegate.
|
|
|
|
|
# This function is kept for backwards compatibility and will
|
|
|
|
|
# be removed in a future release.
|
|
|
|
|
local message="$1"
|
|
|
|
|
|
|
|
|
|
local gitserver=""
|
|
|
|
|
@@ -866,20 +855,21 @@ parse_issue_ref_from_message() {
|
|
|
|
|
local repo=""
|
|
|
|
|
local issue_number=""
|
|
|
|
|
|
|
|
|
|
if [[ "$message" =~ (https?://)?([a-zA-Z0-9.-]+\.[a-zA-Z]{2,})/([a-zA-Z0-9._-]+)/([a-zA-Z0-9._-]+)/(issues|pull)/([0-9]+) ]]; then
|
|
|
|
|
gitserver="${BASH_REMATCH[2]}"
|
|
|
|
|
owner="${BASH_REMATCH[3]}"
|
|
|
|
|
repo="${BASH_REMATCH[4]}"
|
|
|
|
|
issue_number="${BASH_REMATCH[6]}"
|
|
|
|
|
elif [[ "$message" =~ (https?://)?([a-zA-Z0-9.-]+\.[a-zA-Z]{2,})/([a-zA-Z0-9._-]+)/([a-zA-Z0-9._-]+)#([0-9]+) ]]; then
|
|
|
|
|
gitserver="${BASH_REMATCH[2]}"
|
|
|
|
|
owner="${BASH_REMATCH[3]}"
|
|
|
|
|
repo="${BASH_REMATCH[4]}"
|
|
|
|
|
issue_number="${BASH_REMATCH[5]}"
|
|
|
|
|
elif [[ "$message" =~ ([a-zA-Z0-9._-]+)/([a-zA-Z0-9._-]+)#([0-9]+) ]]; then
|
|
|
|
|
owner="${BASH_REMATCH[1]}"
|
|
|
|
|
repo="${BASH_REMATCH[2]}"
|
|
|
|
|
issue_number="${BASH_REMATCH[3]}"
|
|
|
|
|
if echo "$message" | grep -qE '[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}/[a-zA-Z0-9_.-]+/[a-zA-Z0-9_.-]+/(issues|pull)/[0-9]+'; then
|
|
|
|
|
gitserver=$(echo "$message" | grep -oE '[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}/[a-zA-Z0-9_.-]+/[a-zA-Z0-9_.-]+' | head -1 | sed 's/\/[^/]*\/[^/]*$//')
|
|
|
|
|
local full_path=$(echo "$message" | grep -oE '[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}/[a-zA-Z0-9_.-]+/[a-zA-Z0-9_.-]+/(issues|pull)/[0-9]+' | head -1)
|
|
|
|
|
owner=$(echo "$full_path" | cut -d'/' -f2)
|
|
|
|
|
repo=$(echo "$full_path" | cut -d'/' -f3)
|
|
|
|
|
issue_number=$(echo "$full_path" | grep -oE '[0-9]+$' | head -1)
|
|
|
|
|
elif echo "$message" | grep -qE '[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}/[a-zA-Z0-9_.-]+/[a-zA-Z0-9_.-]+#[0-9]+'; then
|
|
|
|
|
gitserver=$(echo "$message" | grep -oE '[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}/[a-zA-Z0-9_.-]+/[a-zA-Z0-9_.-]+' | head -1)
|
|
|
|
|
owner=$(echo "$gitserver" | cut -d'/' -f2)
|
|
|
|
|
repo=$(echo "$gitserver" | cut -d'/' -f3)
|
|
|
|
|
issue_number=$(echo "$message" | grep -oE '#[0-9]+' | grep -oE '[0-9]+' | head -1)
|
|
|
|
|
elif echo "$message" | grep -qE '[a-zA-Z0-9_.-]+/[a-zA-Z0-9_.-]+#([0-9]+)'; then
|
|
|
|
|
owner=$(echo "$message" | grep -oE '[a-zA-Z0-9_.-]+/[a-zA-Z0-9_.-]+#' | sed 's/#$//' | cut -d'/' -f1)
|
|
|
|
|
repo=$(echo "$message" | grep -oE '[a-zA-Z0-9_.-]+/[a-zA-Z0-9_.-]+#' | sed 's/#$//' | cut -d'/' -f2)
|
|
|
|
|
issue_number=$(echo "$message" | grep -oE '#[0-9]+' | grep -oE '[0-9]+' | head -1)
|
|
|
|
|
fi
|
|
|
|
|
|
|
|
|
|
echo "${gitserver}|${owner}|${repo}|${issue_number}"
|
|
|
|
|
|