{"thread":{"id":"728","subject":"[PATCH cogito] adds cg-mirror-add and cg-mirror-sync","startedAt":"2005-05-27T02:17:39Z","lastAt":"2005-05-27T02:17:39Z","messageCount":1,"participants":["Michael Frank"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"4024","messageId":"1117160259.13298.12.camel@localhost.localdomain","threadId":"728","inReplyTo":null,"subject":"[PATCH cogito] adds cg-mirror-add and cg-mirror-sync","fromName":"Michael Frank","fromEmail":"msfrank@syntaxjockey.com","sentAt":"2005-05-27T02:17:39Z","receivedAt":"2005-05-27T02:17:39Z","isPatch":true,"sender":{"key":"msfrank@syntaxjockey.com","avatar":null},"body":"The attached patch adds the two programs cg-mirror-add and\ncg-mirror-sync.  Say you do all of your work on your laptop and you want\nto make a mirror of your repository available to the public.  You\nspecify the location of the mirror with cg-mirror-add:\n\n$ cg-mirror-add scp://my.server:/var/www/repos/project.git\n\nwhich locally creates the file .git/mirrors.  When you want to upload\nyour changes, you run cg-mirror-sync.\n\nMichael\n\n\nSigned-Off-By: Michael Frank <msfrank@syntaxjockey.com>\n\n-- \n\nMichael Frank               .~.\nmsfrank@syntaxjockey.com    /v\\\n                           // \\\\\n                          /(   )\\\n                           ^`-'^\n\n\ndiff -pruN cogito.old/cg-mirror-add cogito.new/cg-mirror-add\n--- cogito.old/cg-mirror-add\t1969-12-31 16:00:00.000000000 -0800\n+++ cogito.new/cg-mirror-add\t2005-05-26 18:46:16.357489808 -0700\n@@ -0,0 +1,22 @@\n+#!/usr/bin/env bash\n+#\n+# Add new mirror to the GIT repository.\n+# Copyright (c) Michael Frank, 2005\n+#\n+# Takes the mirror location as parameter.  Location can be\n+# an rsync URI, as in:\n+#     $ cg-mirror add rsync://your.server:/path/to/project.git\n+#\n+# or an scp URI (rsync is still used to copy the files):\n+#     $ cg-mirror add scp://user@your.server:/project/path.git\n+#\n+\n+. ${COGITO_LIB}cg-Xlib\n+\n+location=$1\n+\n+([ \"$location\" ]) || die \"usage: cg-mirror-add MIRROR_LOC\"\n+if [ -e $_git/mirrors ]; then\n+    grep -xq $location $_git/mirrors && die \"mirror already exists\"\n+fi\n+echo \"$location\" >> $_git/mirrors\ndiff -pruN cogito.old/cg-mirror-sync cogito.new/cg-mirror-sync\n--- cogito.old/cg-mirror-sync\t1969-12-31 16:00:00.000000000 -0800\n+++ cogito.new/cg-mirror-sync\t2005-05-26 18:37:35.408686064 -0700\n@@ -0,0 +1,25 @@\n+#!/usr/bin/env bash\n+#\n+# Pushes changes from the local GIT repository to mirrors.\n+# Copyright (c) Michael Frank, 2005\n+#\n+\n+. ${COGITO_LIB}cg-Xlib\n+\n+[ -r $_git/mirrors ] || die \"No mirrors to sync!\"\n+\n+uri=\n+for mirror in `cat $_git/mirrors`; do\n+    if echo $mirror | grep -q \"^scp://\"; then\n+        uri=`echo $mirror | sed -e \"s/^scp:\\/\\///\"`\n+        echo \"syncing $mirror ...\"\n+        rsync -a -v -z --exclude=mirrors $_git/* $uri\n+        echo \"\"\n+    elif echo $mirror | grep -q \"^rsync://\"; then\n+        echo \"syncing $mirror ...\"\n+        rsync -a -v -z --exclude=mirrors $_git/* $mirror\n+        echo \"\"\n+    else\n+        echo \"skipping $mirror; mirror uses unknown transport\"\n+    fi\n+done\ndiff -pruN cogito.old/Makefile cogito.new/Makefile\n--- cogito.old/Makefile\t2005-05-26 19:15:25.412593016 -0700\n+++ cogito.new/Makefile\t2005-05-26 17:44:43.348912448 -0700\n@@ -55,7 +55,8 @@ PROG=   git-update-cache git-diff-files \n SCRIPT=\tcommit-id tree-id parent-id cg-add cg-admin-lsobj cg-admin-uncommit \\\n \tcg-branch-add cg-branch-ls cg-cancel cg-clone cg-commit cg-diff \\\n \tcg-export cg-help cg-init cg-log cg-ls cg-merge cg-mkpatch cg-patch \\\n-\tcg-pull cg-restore cg-rm cg-seek cg-status cg-tag cg-tag-ls cg-update\n+\tcg-pull cg-restore cg-rm cg-seek cg-status cg-tag cg-tag-ls cg-update \\\n+\tcg-mirror-add cg-mirror-sync\n \n LIB_SCRIPT=cg-Xlib cg-Xdiffdo cg-Xmergefile\n \n"}]}