Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
branch: master
Fetching contributors…

Cannot retrieve contributors at this time

executable file 34 lines (31 sloc) 1.107 kb
#!/bin/bash
#
if [ "$#" -eq "2" ]; then
WHERE=$1
NEW=$(cd $2; pwd)
SEDCOMMAND="s,http://darcs.haskell.org/packages,$NEW/libraries,g; s,http://darcs.haskell.org/hsc2hs,$NEW/utils/hsc2hs,g; s,http://darcs.haskell.org/haddock2,$NEW/utils/haddock,g; s,http://darcs.haskell.org/ghc,$NEW,g; s,http://darcs.haskell.org,$NEW,g"
elif [ "$#" -eq "3" ]; then
WHERE=$1
OLD=$(cd $2; pwd)
NEW=$(cd $3; pwd)
SEDCOMMAND="s,$OLD,$NEW,g"
else
echo "Usage: $0 directory [old-source] new-source"
exit 1
fi
find $WHERE \( -name repos -o -name defaultrepo \) -print0 | xargs -0 sed -i -e "$SEDCOMMAND"
exit $?
# Alternative version:
#
# if [ "$#" -eq "0" ]; then
# echo "Listing current defaultrepo/repos:"
# find . -path '*/_darcs/prefs/defaultrepo' -o -path '*/_darcs/prefs/repos' | xargs cat
# elif [ "$#" -eq "2" ]; then
# for file in $(find . -path '*/_darcs/prefs/defaultrepo' -o -path '*/_darcs/prefs/repos'); do
# echo "Rewriting $file from $1 to $2"
# sed 's/$1/$2/' $file
# done
# else
# echo "Usage: $0 old-prefix new-prefix"
# exit 1
# fi
Jump to Line
Something went wrong with that request. Please try again.