From: Michael Frank <msfrank@syntaxjockey.com>
To: git@vger.kernel.org
Subject: [PATCH cogito] adds cg-mirror-add and cg-mirror-sync
Date: Thu, 26 May 2005 19:17:39 -0700 [thread overview]
Message-ID: <1117160259.13298.12.camel@localhost.localdomain> (raw)
[-- Attachment #1: Type: text/plain, Size: 659 bytes --]
The attached patch adds the two programs cg-mirror-add and
cg-mirror-sync. Say you do all of your work on your laptop and you want
to make a mirror of your repository available to the public. You
specify the location of the mirror with cg-mirror-add:
$ cg-mirror-add scp://my.server:/var/www/repos/project.git
which locally creates the file .git/mirrors. When you want to upload
your changes, you run cg-mirror-sync.
Michael
Signed-Off-By: Michael Frank <msfrank@syntaxjockey.com>
--
Michael Frank .~.
msfrank@syntaxjockey.com /v\
// \\
/( )\
^`-'^
[-- Attachment #2: mirror.patch --]
[-- Type: text/x-patch, Size: 2426 bytes --]
diff -pruN cogito.old/cg-mirror-add cogito.new/cg-mirror-add
--- cogito.old/cg-mirror-add 1969-12-31 16:00:00.000000000 -0800
+++ cogito.new/cg-mirror-add 2005-05-26 18:46:16.357489808 -0700
@@ -0,0 +1,22 @@
+#!/usr/bin/env bash
+#
+# Add new mirror to the GIT repository.
+# Copyright (c) Michael Frank, 2005
+#
+# Takes the mirror location as parameter. Location can be
+# an rsync URI, as in:
+# $ cg-mirror add rsync://your.server:/path/to/project.git
+#
+# or an scp URI (rsync is still used to copy the files):
+# $ cg-mirror add scp://user@your.server:/project/path.git
+#
+
+. ${COGITO_LIB}cg-Xlib
+
+location=$1
+
+([ "$location" ]) || die "usage: cg-mirror-add MIRROR_LOC"
+if [ -e $_git/mirrors ]; then
+ grep -xq $location $_git/mirrors && die "mirror already exists"
+fi
+echo "$location" >> $_git/mirrors
diff -pruN cogito.old/cg-mirror-sync cogito.new/cg-mirror-sync
--- cogito.old/cg-mirror-sync 1969-12-31 16:00:00.000000000 -0800
+++ cogito.new/cg-mirror-sync 2005-05-26 18:37:35.408686064 -0700
@@ -0,0 +1,25 @@
+#!/usr/bin/env bash
+#
+# Pushes changes from the local GIT repository to mirrors.
+# Copyright (c) Michael Frank, 2005
+#
+
+. ${COGITO_LIB}cg-Xlib
+
+[ -r $_git/mirrors ] || die "No mirrors to sync!"
+
+uri=
+for mirror in `cat $_git/mirrors`; do
+ if echo $mirror | grep -q "^scp://"; then
+ uri=`echo $mirror | sed -e "s/^scp:\/\///"`
+ echo "syncing $mirror ..."
+ rsync -a -v -z --exclude=mirrors $_git/* $uri
+ echo ""
+ elif echo $mirror | grep -q "^rsync://"; then
+ echo "syncing $mirror ..."
+ rsync -a -v -z --exclude=mirrors $_git/* $mirror
+ echo ""
+ else
+ echo "skipping $mirror; mirror uses unknown transport"
+ fi
+done
diff -pruN cogito.old/Makefile cogito.new/Makefile
--- cogito.old/Makefile 2005-05-26 19:15:25.412593016 -0700
+++ cogito.new/Makefile 2005-05-26 17:44:43.348912448 -0700
@@ -55,7 +55,8 @@ PROG= git-update-cache git-diff-files
SCRIPT= commit-id tree-id parent-id cg-add cg-admin-lsobj cg-admin-uncommit \
cg-branch-add cg-branch-ls cg-cancel cg-clone cg-commit cg-diff \
cg-export cg-help cg-init cg-log cg-ls cg-merge cg-mkpatch cg-patch \
- cg-pull cg-restore cg-rm cg-seek cg-status cg-tag cg-tag-ls cg-update
+ cg-pull cg-restore cg-rm cg-seek cg-status cg-tag cg-tag-ls cg-update \
+ cg-mirror-add cg-mirror-sync
LIB_SCRIPT=cg-Xlib cg-Xdiffdo cg-Xmergefile
reply other threads:[~2005-05-27 2:18 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1117160259.13298.12.camel@localhost.localdomain \
--to=msfrank@syntaxjockey.com \
--cc=git@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).