X-Git-Url: http://www.chiark.greenend.org.uk/ucgi/~ian/git?p=chiark-utils.git;a=blobdiff_plain;f=scripts%2Fcvs-repomove;h=a3bb60f1d70d3873cf71087851249a333674c86b;hp=e7d2e53b5af2830e7f9f3c7e74f5467d78a1369b;hb=baf561ddf88e9b6f016bdd76e9757cb161ed1d71;hpb=18188d730fc2337a9b2caec8f46a65387c9a05c4 diff --git a/scripts/cvs-repomove b/scripts/cvs-repomove index e7d2e53..a3bb60f 100755 --- a/scripts/cvs-repomove +++ b/scripts/cvs-repomove @@ -10,6 +10,23 @@ usage: END } +# Copyright 2004-2006 Ian Jackson +# +# This script and its documentation (if any) are free software; you +# can redistribute it and/or modify them under the terms of the GNU +# General Public License as published by the Free Software Foundation; +# either version 3, or (at your option) any later version. +# +# chiark-named-conf and its manpage are distributed in the hope that +# it will be useful, but WITHOUT ANY WARRANTY; without even the +# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR +# PURPOSE. See the GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License along +# with this program; if not, consult the Free Software Foundation's +# website at www.fsf.org, or the GNU Project website at www.gnu.org. + + # We do things in the following order: # src dst # 0. Check things @/..moving-to none/..moved-to @@ -80,11 +97,11 @@ do_move () { ls -d -- $srcrepo/CVSROOT >/dev/null '" - dstrepotrans="$(printf "%s" "$dstrepo" | tr / :)" + dstrepotrans="$(printf '%s\n' "$dstrepo" | tr / :)" movingto="moving-to-$dsthost:$dstrepotrans" resume="$("$CVS_RSH" "$srchost" bash -ec "' if test -d $srcrepo/$module..$movingto; then - echo \" resuming previous attempt at a move\" + echo >&2 \" resuming previous attempt at a move\" resume=true if test -d $srcrepo/$module; then echo >&2 \"but $srcrepo/$module exists too\" @@ -97,10 +114,10 @@ do_move () { set +e previously=\"$(ls -d -- $srcrepo/$module..moved-to-* 2>/dev/null)\" set -e - if [ \"x$previously\" != x ]; then - echo \" btw, module was once before moved away from here\" - mv -- \"$previously\" \ - \"${previously/..moved-to-/..previously-\$(date +%s)-moved-to-}\" + if [ \"x\$previously\" != x ]; then + echo >&2 \" btw, module was once before moved away from here\" + mv -- \"\$previously\" \ + \"\${previously/..moved-to-/..previously-\$(date +%s)-moved-to-}\" fi echo \$resume '")" @@ -115,11 +132,21 @@ do_move () { fi for f in $module..*; do case \"\$f\" in - *..moved-to-*) echo \" btw, module was previously at destn repo\" ;; + *..moved-to-*) + echo \" btw, module was previously at destn repo\" + mv -- \"\$f\" \ + \"\${f/..moved-to-/..previously-\$(date +%s)-moved-to-}\" + ;; *..previously-*) ;; - *..tmp-*) echo \" nb: possibly-stale temp/partial copy \$f\" ;; - *..\*) ;; - *) echo >&2 \"error: found unexpected subdir \$f\"; exit 8;; + *..tmp-*) + echo \" nb: possibly-stale temp/partial copy \$f\" + ;; + *..\*) + ;; + *) + echo >&2 \"error: found unexpected subdir \$f\" + exit 8 + ;; esac done '" @@ -176,7 +203,7 @@ do_furtle () { remotehost="${goose%%:*}" path="${goose#*:}" check_hostname "$remotehost" - check_remote_path "$remotepath/$module" + check_remote_path "$path/$module" isremote=true compute_fqdn_data "$remotehost" if [ "x$fqdn_data" = "x$our_fqdn_data" -a \ @@ -217,7 +244,7 @@ do_furtle () { exit 4 ;; *..moved-to-*) - goose="$(printf "%s" \ + goose="$(printf '%s\n' \ "${new_goose_info#*..moved-to-}" | \ tr : / | sed -e 's,/,:,')" ;;