Fix svn restore issues on Windows
This commit is contained in:
parent
8990eb866d
commit
e2814cccca
|
@ -37,12 +37,12 @@ if [[ $repo_path == "" || $output_path == "" ]]; then
|
|||
exit 1
|
||||
fi
|
||||
|
||||
if [[ ! -d $repo_path ]]; then
|
||||
if [[ ! -d "$repo_path" ]]; then
|
||||
error "Repo directory '$repo_path' doesn't exist."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
mkdir -p $output_path
|
||||
mkdir -p "$output_path"
|
||||
|
||||
now=$(echo $(date '+%Y-%m-%d-%H-%M-%S'))
|
||||
backup_path="$output_path/${now}_jellypixel_repos.dump.gz"
|
||||
|
@ -55,4 +55,4 @@ if [[ ! ($proceed == "1" || $proceed == "y") ]]; then
|
|||
exit 1
|
||||
fi
|
||||
|
||||
svnadmin.exe dump $repo_path | gzip -9 > $backup_path
|
||||
svnadmin.exe dump "$repo_path" | gzip -9 > "$backup_path"
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
#!/usr/bin/env bash
|
||||
|
||||
#
|
||||
# Loads an SVN snapshot into an existing repository. This will replace all existing data in that repo.
|
||||
# Loads an SVN snapshot into a new repository.
|
||||
#
|
||||
|
||||
if which tput >/dev/null 2>&1; then
|
||||
|
@ -41,22 +41,33 @@ if [[ ($backup_path == "") || ($repo_path == "") ]]; then
|
|||
exit 1
|
||||
fi
|
||||
|
||||
if [[ ! -f $backup_path ]]; then
|
||||
if [[ ! -f "$backup_path" ]]; then
|
||||
error "Backup file '$backup_path' doesn't exist.\n"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [[ ! -d $repo_path ]]; then
|
||||
if [[ ! -d "$repo_path" ]]; then
|
||||
error "SVN repo '$repo_path' doesn't exist.\n"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
printf "${BOLD}${YELLOW}Loading backup '$backup_path' to '$repo_path'\n"
|
||||
printf "This will replace all existing data in the repo.\n"
|
||||
printf "The destination repo should be a new repo with no commits.\n"
|
||||
printf "Proceed? (1|y)\n> ${NORMAL}"
|
||||
|
||||
read -e proceed
|
||||
if [[ ! ($proceed == "1" || $proceed == "y") ]]; then
|
||||
exit 1
|
||||
fi
|
||||
|
||||
gunzip -c $backup_path | svnadmin load $repo_path
|
||||
# Was having trouble getting this to work on svnadmin 1.14.1 on Windows:
|
||||
# gunzip -c "$backup_path" | svnadmin load "$repo_path"
|
||||
# It was very slow and the output would freeze.
|
||||
# So now we unzip and then import.
|
||||
source_dir=$(dirname "$backup_path")
|
||||
dump_file="$source_dir/$RANDOM.dump"
|
||||
printf "${BOLD}Unzipping to '$dump_file'\n"
|
||||
gunzip -cf "$backup_path" >> "$dump_file"
|
||||
printf "${BOLD}Loading into SVN repo\n"
|
||||
svnadmin load -F "$dump_file" "$repo_path"
|
||||
rm "$dump_file"
|
||||
|
|
Loading…
Reference in New Issue
Block a user