GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — make it work with any Apache repository mirrored on GitHub · javascriptextjs/cloudstack@fed5c2b

File tree

Expand file treeCollapse file tree
Open diff view settings
Filter options
  • tools/git
    • git-pr
Expand file treeCollapse file tree
Open diff view settings
Collapse file

‎tools/git/git-pr‎

Copy file name to clipboardExpand all lines: tools/git/git-pr
+8-5Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -47,20 +47,22 @@ fi
4747
# Check the arguments
4848
if [ -z ${prId} ]; then
4949
echo "Usage: git pr pool-request-number [ --force ]"
50+
echo "Works for any Apache repository mirrored on GitHub'"
5051
echo "For instructions, see: https://cwiki.apache.org/confluence/pages/viewpage.action?pageId=61311655"
5152
clean_up_and_exit 1
5253
fi
5354

5455
# Vars we need
5556
jsonTmp="${PWD}/${prId}.json"
5657
tmpMessageFile="${PWD}/.git-tmp-message.txt"
58+
repoName=$(basename `git rev-parse --show-toplevel`)
5759

5860
# We need UTF-8 to support the GitHub '...' 3-dots-in-1-char, for example.
5961
export LANG="en_EN.UTF-8"
6062

6163
if [ "${prId}" -eq "${prId}" 2>/dev/null ]; then
6264
# Get json data from Github API
63-
curl -s https://api.github.com/repos/apache/cloudstack/pulls/${prId} > ${jsonTmp}
65+
curl -s https://api.github.com/repos/apache/${repoName}/pulls/${prId} > ${jsonTmp}
6466
else
6567
echo "ERROR: Pull-request id must be an integer, not '${prId}'"
6668
clean_up_and_exit 1
@@ -176,23 +178,23 @@ elif [ "${prMergeableState}" != "clean" ] && [ ${force} -eq 1 ]; then
176178
echo "WARNING: You used --force to merge a PR with non-clean merge state '${prMergeableState}'."
177179
fi
178180

179-
github_remote=$(git remote -v | grep "apache/cloudstack.git" | head -n 1 | cut -f1)
181+
github_remote=$(git remote -v | grep -E "apache/${repoName}(.git)?" | head -n 1 | cut -f1)
180182
if [ ${#github_remote} -eq 0 ]; then
181-
echo "ERROR: We couldn't find a git remote pointing to 'apache/cloudstack.git' to merge the PR from."
183+
echo "ERROR: We couldn't find a git remote pointing to 'apache/${repoName}.git' to merge the PR from."
182184
echo "INFO: Currently, your configured remotes are:"
183185
echo "INFO: ***********************************************************************************"
184186
git remote -v
185187
echo "INFO: ***********************************************************************************"
186188
echo "INFO: To merge a PR, we need access to two remotes: "
187189
echo "INFO: 1. Read-only access to GitHub mirror"
188190
echo "INFO: 2. Read/write access to Apache git"
189-
echo "INFO: Please add a remote like this: 'git remote add github https://github.com/apache/cloudstack.git'"
191+
echo "INFO: Please add a remote like this: 'git remote add github https://github.com/apache/${repoName}.git'"
190192
echo "INFO: For more help, visit: https://cwiki.apache.org/confluence/pages/viewpage.action?pageId=61311655"
191193
echo "INFO: Once done, run this script again."
192194
clean_up_and_exit 1
193195
fi
194196

195-
echo "INFO: Using remote repository '${github_remote}' to fetch PR (should point to github.com/apache/cloudstack.git)"
197+
echo "INFO: Using remote repository '${github_remote}' to fetch PR (should point to github.com/apache/${repoName}.git)"
196198
echo "INFO: PR #${prId} against branch '${prDestinationBranch}' from '${prAuthor}': '${prTitle}'"
197199
echo "INFO: has state '${prState}' and mergable state '${prMergeableState}', about to be merged in branch '${currentBranch}'."
198200

@@ -220,6 +222,7 @@ if [ $? -eq 0 ]; then
220222
else
221223
echo "ERROR: Merge failed, aborting."
222224
git merge --abort
225+
clean_up_and_exit 1
223226
fi
224227

225228
# What's next

0 commit comments

Comments
0 (0)
You are visitor 01402520 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.