summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorbringert <bringert@cs.chalmers.se>2005-11-24 12:59:28 +0000
committerbringert <bringert@cs.chalmers.se>2005-11-24 12:59:28 +0000
commit853bcef7b9251ed39bd3895abb0d48699e508422 (patch)
treea1b6cbb38f02b8346fbfa51cabae688b85fed201
parentb71cf25c86e8477ab5d845b0d559b6326b7cb8d2 (diff)
Include darcs-cm script.
-rw-r--r--doc/darcs.html99
-rw-r--r--doc/darcs.txt46
2 files changed, 108 insertions, 37 deletions
diff --git a/doc/darcs.html b/doc/darcs.html
index c9989de3d..9c3b43262 100644
--- a/doc/darcs.html
+++ b/doc/darcs.html
@@ -27,24 +27,27 @@ GF has now been moved to a Darcs repository. No changes should be committed to t
<LI><A HREF="#toc9">Setting up your $PATH on the Chalmers system</A>
<LI><A HREF="#toc10">Setting up ssh alias and ControlMaster</A>
<LI><A HREF="#toc11">Setting up an ssh ControlMaster connection</A>
- <LI><A HREF="#toc12">Getting a fresh copy</A>
- <LI><A HREF="#toc13">Getting other people's changes?</A>
- <LI><A HREF="#toc14">Commit your changes</A>
- <LI><A HREF="#toc15">Apply a patch from someone else</A>
+ <UL>
+ <LI><A HREF="#toc12">Automating the ControlMaster connection</A>
+ </UL>
+ <LI><A HREF="#toc13">Getting a fresh copy</A>
+ <LI><A HREF="#toc14">Getting other people's changes?</A>
+ <LI><A HREF="#toc15">Commit your changes</A>
+ <LI><A HREF="#toc16">Apply a patch from someone else</A>
</UL>
- <LI><A HREF="#toc16">Troubleshooting</A>
+ <LI><A HREF="#toc17">Troubleshooting</A>
<UL>
- <LI><A HREF="#toc17">I get the error "darcs not found" when pushing</A>
- <LI><A HREF="#toc18">I get the error "(sftp) failed to fetch files."</A>
- <LI><A HREF="#toc19">I get the error "Not a repository: gfreposerver:..."</A>
- <LI><A HREF="#toc20">How do I avoid typing in my password so many times?</A>
+ <LI><A HREF="#toc18">I get the error "darcs not found" when pushing</A>
+ <LI><A HREF="#toc19">I get the error "(sftp) failed to fetch files."</A>
+ <LI><A HREF="#toc20">I get the error "Not a repository: gfreposerver:..."</A>
+ <LI><A HREF="#toc21">How do I avoid typing in my password so many times?</A>
<UL>
- <LI><A HREF="#toc21">Using ssh ControlMaster</A>
- <LI><A HREF="#toc22">Using ssh-agent</A>
+ <LI><A HREF="#toc22">Using ssh ControlMaster</A>
+ <LI><A HREF="#toc23">Using ssh-agent</A>
</UL>
</UL>
- <LI><A HREF="#toc23">Technical Information</A>
- <LI><A HREF="#toc24">Further information about Darcs</A>
+ <LI><A HREF="#toc24">Technical Information</A>
+ <LI><A HREF="#toc25">Further information about Darcs</A>
</UL>
<P></P>
@@ -228,6 +231,45 @@ somewhere.
You may want to create a script or alias for starting the connection.
</P>
<A NAME="toc12"></A>
+<H3>Automating the ControlMaster connection</H3>
+<P>
+You can create a darcs wrapper which sets up a ControlMaster connection
+if there isn't one already. Put the code below in for example <CODE>~bin/darcs-cm</CODE>,
+and use that program instead of <CODE>darcs</CODE> to work with the repository.
+</P>
+<PRE>
+ #!/bin/bash
+
+ DARCS=`which darcs`
+ SSH=`which ssh`
+ REPOSERVER=gfreposerver
+
+ if [ ! -x "$SSH" ]; then
+ echo "ssh ($SSH): command not found" 1&gt;&amp;2
+ exit 1
+ fi
+
+ if [ "$1" = "--stop" ]; then
+ $SSH -O exit "$REPOSERVER"
+ exit $?
+ fi
+
+ if [ ! -x "$DARCS" ]; then
+ echo "darcs ($DARCS): command not found" 1&gt;&amp;2
+ exit 1
+ fi
+
+ if ! $SSH -O check "$REPOSERVER" &gt;&amp; /dev/null; then
+ echo "Connection to $REPOSERVER is down, connecting..."
+ $SSH -f -M "$REPOSERVER" \
+ "bash -c 'while true; do echo -n .; sleep 30; done'" &gt; /dev/null
+ sleep 1
+ fi
+
+ exec $DARCS "$@"
+</PRE>
+<P></P>
+<A NAME="toc13"></A>
<H2>Getting a fresh copy</H2>
<P>
Get your copy with (all on one line):
@@ -242,7 +284,7 @@ history for the repository. This saves space, bandwidth and CPU time,
and most people don't need the full history of all changes in the
past.
</P>
-<A NAME="toc13"></A>
+<A NAME="toc14"></A>
<H2>Getting other people's changes?</H2>
<P>
Get all new patches from the main repo:
@@ -254,7 +296,7 @@ Get all new patches from the main repo:
<P>
Without <CODE>-a</CODE>, you can choose which patches you want to get.
</P>
-<A NAME="toc14"></A>
+<A NAME="toc15"></A>
<H2>Commit your changes</H2>
<P>
There are two steps to commiting a change to the main repo. First you
@@ -288,7 +330,7 @@ ssh-access, all you need to do is:
If you use the <CODE>-a</CODE> flag to push, all local patches which are not in
the main repo are pushed.
</P>
-<A NAME="toc15"></A>
+<A NAME="toc16"></A>
<H2>Apply a patch from someone else</H2>
<P>
Use:
@@ -301,16 +343,16 @@ Use:
This applies the patch to your local repository. To commit it to the
main repo, use <CODE>darcs push</CODE>.
</P>
-<A NAME="toc16"></A>
-<H1>Troubleshooting</H1>
<A NAME="toc17"></A>
+<H1>Troubleshooting</H1>
+<A NAME="toc18"></A>
<H2>I get the error "darcs not found" when pushing</H2>
<P>
If you get <CODE>darcs not found</CODE> when you try to push your changes, you
don't have darcs on your <CODE>$PATH</CODE> on the Chalmers system. See
the section above on setting up your <CODE>$PATH</CODE> on the Chalmers system.
</P>
-<A NAME="toc18"></A>
+<A NAME="toc19"></A>
<H2>I get the error "(sftp) failed to fetch files."</H2>
<P>
There seems to be a problem with how darcs 1.0.4 calls sftp, which
@@ -318,7 +360,7 @@ means that normal password authentication does not work. Either use
Darcs 1.0.3 on your client, and be prepared to enter your password
many times, or use the ssh ControlMaster feature as described above.
</P>
-<A NAME="toc19"></A>
+<A NAME="toc20"></A>
<H2>I get the error "Not a repository: gfreposerver:..."</H2>
<P>
You get this error when you have set up ControlMaster, but don't have a master
@@ -329,21 +371,16 @@ connection running. Start a master connection:
</PRE>
<P></P>
<P>
-If your master connection keeps dying because of inactivity, you can have it
-run some program with outputs something once in a while, e.g.:
+or use the <CODE>darcs-cm</CODE> script shown above.
</P>
-<PRE>
- $ ssh -M gfreposerver "bash -c 'while true; do echo -n .; sleep 30; done'"
-</PRE>
-<P></P>
-<A NAME="toc20"></A>
-<H2>How do I avoid typing in my password so many times?</H2>
<A NAME="toc21"></A>
+<H2>How do I avoid typing in my password so many times?</H2>
+<A NAME="toc22"></A>
<H3>Using ssh ControlMaster</H3>
<P>
See above.
</P>
-<A NAME="toc22"></A>
+<A NAME="toc23"></A>
<H3>Using ssh-agent</H3>
<P>
<B>NOTE: the method below will not work with <CODE>momo.medic.chalmers.se</CODE></B>.
@@ -406,7 +443,7 @@ Try to use it to log in (with your own username again):
zsh:bringert:[~]&gt;
</PRE>
<P></P>
-<A NAME="toc23"></A>
+<A NAME="toc24"></A>
<H1>Technical Information</H1>
<P>
This section contains information about how the repository is set
@@ -436,7 +473,7 @@ The repo has this in <CODE>_darcs/prefs/defaults</CODE>:
The server which we push to has darcs 1.0.4, which is needed for
posthook support.
</P>
-<A NAME="toc24"></A>
+<A NAME="toc25"></A>
<H1>Further information about Darcs</H1>
<P>
For more info about what you can do with darcs, see <A HREF="http://darcs.net/manual/">http://darcs.net/manual/</A>
diff --git a/doc/darcs.txt b/doc/darcs.txt
index 42a80f25b..1a62279f3 100644
--- a/doc/darcs.txt
+++ b/doc/darcs.txt
@@ -172,6 +172,45 @@ somewhere.
**NOTE: You need to have a ControlMaster connection running whenever you want to access the repo using ssh.**
You may want to create a script or alias for starting the connection.
+=== Automating the ControlMaster connection ===
+
+You can create a darcs wrapper which sets up a ControlMaster connection
+if there isn't one already. Put the code below in, for example, ``~bin/darcs-cm``,
+and use that program instead of ``darcs`` to work with the repository.
+
+
+```
+#!/bin/bash
+
+DARCS=`which darcs`
+SSH=`which ssh`
+REPOSERVER=gfreposerver
+
+if [ ! -x "$SSH" ]; then
+ echo "ssh ($SSH): command not found" 1>&2
+ exit 1
+fi
+
+if [ "$1" = "--stop" ]; then
+ $SSH -O exit "$REPOSERVER"
+ exit $?
+fi
+
+if [ ! -x "$DARCS" ]; then
+ echo "darcs ($DARCS): command not found" 1>&2
+ exit 1
+fi
+
+if ! $SSH -O check "$REPOSERVER" >& /dev/null; then
+ echo "Connection to $REPOSERVER is down, connecting..."
+ $SSH -f -M "$REPOSERVER" \
+ "bash -c 'while true; do echo -n .; sleep 30; done'" > /dev/null
+ sleep 1
+fi
+
+exec $DARCS "$@"
+```
+
== Getting a fresh copy ==
Get your copy with (all on one line):
@@ -265,12 +304,7 @@ connection running. Start a master connection:
$ ssh -M gfreposerver
```
-If your master connection keeps dying because of inactivity, you can have it
-run some program with outputs something once in a while, e.g.:
-
-```
-$ ssh -M gfreposerver "bash -c 'while true; do echo -n .; sleep 30; done'"
-```
+or use the ``darcs-cm`` script shown above.
== How do I avoid typing in my password so many times? ==