scheme shell
about
download
support
resources
docu
links
 
scsh.net

Redirect Cvs Checkout

[ Taken from a post by Michael Sperber [Mr. Preprocessor] to comp.lang.scheme.scsh in May 2003; Subject: Re: Change in CVS layout ]

For those who want to avoid a full checkout, I've appended a little script that redirects an existing checkout. Call it like so:

rerepo-cvs.scm <sandbox> scsh-0.6 scsh


  #!/bin/sh
  IFS=" "
  exec scsh -e main -s "$0" "$@"
  !#

(define (cvs-repository-files sandbox) (filter (lambda (name) (string-suffix? "CVS/Repository" name)) (run/strings ("find" ,sandbox "-name" "Repository" "-print"))))

(define (rerepo-cvs! sandbox old-repo new-repo) (for-each (lambda (repository-file) (let ((old-repository (call-with-input-file repository-file read-line))) (if (string-prefix? old-repo old-repository) (let ((new-repository (string-append new-repo (substring old-repository (string-length old-repo) (string-length old-repository))))) (call-with-output-file repository-file (lambda (port) (display new-repository port))))))) (cvs-repository-files sandbox)))

(define (usage! moiself) (display "Usage: " (error-output-port)) (display moiself (error-output-port)) (display " <sandbox> <old-repo> <new-repo>" (error-output-port)) (newline (error-output-port)) (exit 1))

(define (main args) (if (not (= 4 (length args))) (usage! (car args))) (apply rerepo-cvs! (cdr args)))


RedirectCvsCheckout - raw wiki source | code snippets archive