ctubbsii commented on a change in pull request #197:
URL: https://github.com/apache/fluo-website/pull/197#discussion_r486394788



##########
File path: _scripts/publish.sh
##########
@@ -0,0 +1,36 @@
+#! /usr/bin/env bash
+
+# catch most errors
+set -eE
+trap 'echo "[ERROR] Error occurred at $BASH_SOURCE:$LINENO command: 
$BASH_COMMAND"' ERR
+
+function publish_main() {
+  local src='asf-staging' dst='asf-site' r yn remotes=()
+  for r in $(git remote); do
+    remotes+=("$r ($(git config "remote.$r.url"))")
+  done
+  echo 'Select a remote:'
+  select r in "${remotes[@]}"; do
+    if [[ -n $r ]]; then
+      r="${r%% *}"
+      git remote update --prune "${r:?}"
+      echo 'Updating would perform the following (if anything):'
+      git push --dry-run "$r" "$r/$src:refs/heads/$dst"
+      if [[ "$(git rev-parse "remotes/$r/$src")" == "$(git rev-parse 
"remotes/$r/$dst")" ]]; then

Review comment:
       Yes. Specifically, this check is to determine whether the previous 
`--dry-run` would have printed 'Everything up-to-date' or if it would have 
shown that they were different. I don't want to ask "Are you sure you want to 
publish" if publishing wouldn't actually do anything.

##########
File path: _scripts/publish.sh
##########
@@ -0,0 +1,36 @@
+#! /usr/bin/env bash
+
+# catch most errors
+set -eE
+trap 'echo "[ERROR] Error occurred at $BASH_SOURCE:$LINENO command: 
$BASH_COMMAND"' ERR
+
+function publish_main() {
+  local src='asf-staging' dst='asf-site' r yn remotes=()
+  for r in $(git remote); do
+    remotes+=("$r ($(git config "remote.$r.url"))")
+  done
+  echo 'Select a remote:'
+  select r in "${remotes[@]}"; do
+    if [[ -n $r ]]; then
+      r="${r%% *}"
+      git remote update --prune "${r:?}"
+      echo 'Updating would perform the following (if anything):'
+      git push --dry-run "$r" "$r/$src:refs/heads/$dst"
+      if [[ "$(git rev-parse "remotes/$r/$src")" == "$(git rev-parse 
"remotes/$r/$dst")" ]]; then

Review comment:
       Yes. Specifically, this check is to determine whether the previous 
`--dry-run` would have printed 'Everything up-to-date' or if it would have 
shown that they were different. I don't want to ask "Are you sure you want to 
publish" if saying yes wouldn't actually do anything.




----------------------------------------------------------------
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.

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


Reply via email to