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
  • Setting up your $PATH on the Chalmers system
  • Setting up ssh alias and ControlMaster
  • Setting up an ssh ControlMaster connection -
  • Getting a fresh copy -
  • Getting other people's changes? -
  • Commit your changes -
  • Apply a patch from someone else - -
  • Troubleshooting - +
  • Troubleshooting + -
  • Technical Information -
  • Further information about Darcs +
  • Technical Information +
  • Further information about Darcs

    @@ -228,6 +231,45 @@ somewhere. 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): @@ -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.

    - +

    Getting other people's changes?

    Get all new patches from the main repo: @@ -254,7 +296,7 @@ Get all new patches from the main repo:

    Without -a, you can choose which patches you want to get.

    - +

    Commit your changes

    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 -a flag to push, all local patches which are not in the main repo are pushed.

    - +

    Apply a patch from someone else

    Use: @@ -301,16 +343,16 @@ Use: This applies the patch to your local repository. To commit it to the main repo, use darcs push.

    - -

    Troubleshooting

    +

    Troubleshooting

    +

    I get the error "darcs not found" when pushing

    If you get darcs not found when you try to push your changes, you don't have darcs on your $PATH on the Chalmers system. See the section above on setting up your $PATH on the Chalmers system.

    - +

    I get the error "(sftp) failed to fetch files."

    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.

    - +

    I get the error "Not a repository: gfreposerver:..."

    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:

    -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 darcs-cm script shown above.

    -
    -  $ ssh -M gfreposerver "bash -c 'while true; do echo -n .; sleep 30; done'"
    -
    -

    - -

    How do I avoid typing in my password so many times?

    +

    How do I avoid typing in my password so many times?

    +

    Using ssh ControlMaster

    See above.

    - +

    Using ssh-agent

    NOTE: the method below will not work with momo.medic.chalmers.se. @@ -406,7 +443,7 @@ Try to use it to log in (with your own username again): zsh:bringert:[~]>

    - +

    Technical Information

    This section contains information about how the repository is set @@ -436,7 +473,7 @@ The repo has this in _darcs/prefs/defaults: The server which we push to has darcs 1.0.4, which is needed for posthook support.

    - +

    Further information about Darcs

    For more info about what you can do with darcs, see http://darcs.net/manual/ 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? ==