maedhroz commented on code in PR #2114:
URL: https://github.com/apache/cassandra/pull/2114#discussion_r1109072421


##########
.build/sh/development-switch.sh:
##########
@@ -0,0 +1,150 @@
+#!/usr/bin/env bash
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
+#
+#     http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+#set -o xtrace
+set -o errexit
+set -o pipefail
+set -o nounset
+
+error() {
+  echo -e "$*" 1>&2
+  exit 1
+}
+
+_usage() {
+  cat <<EOF
+Usage: $(basename $0) (options)* (submodule)*
+
+Options:
+  --github-user Github user/org where the fork exists; defaults to $USER
+  --jira        JIRA used for development, will checkout if not done yet
+  -h|--help     This help page
+EOF
+  exit 1
+}
+
+_is_main_branch() {
+  local -r name="$1"
+  [[ "$name" == cassandra-* ]] && return 0
+  [[ "$name" == "trunk" ]] && return 0
+  return 1
+}
+
+_get_gh_user() {
+  # was the GitHub user set?
+  local gh_user
+  gh_user="$(git config --get 'cassandra.github.user' || true)"
+  if [[ ! -z "${gh_user:-}" ]]; then
+    echo "${gh_user}"
+    return 0
+  fi
+
+  # can it be inferred from remote?
+  local current_branch
+  current_branch="$(git rev-parse --abbrev-ref HEAD)"
+  local url
+  url="$(git config --local --get branch."${current_branch}".url || true)"
+  local inferred_name="$USER"
+  if [[ ! -z "${url:-}" ]]; then
+    inferred_name="$(echo "$url" | awk -F/ '{print $(NF-1)}' | awk -F: '{print 
$NF}')"
+  fi
+  echo "What is the github user/org used?  Inferred ${inferred_name}, enter 
new name or empty to accept" 1>&2

Review Comment:
   ```suggestion
     echo "What is the github user/org used?  Inferred ${inferred_name}, enter 
new name or empty to accept:" 1>&2
   ```



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to