# From inside the SVN subdir you want to extract: set -euo pipefail DEST="${1:-trunk-git}" echo "Exporting SVN working copy to $DEST (versioned files only)..." rm -rf -- "$DEST" count=0 start_ts="$(date +%s.%N)" if command -v stdbuf >/dev/null 2>&1; then export_cmd=(stdbuf -o0 -e0 svn export . "$DEST") awk_cmd=(stdbuf -o0 awk -v start="$start_ts") else export_cmd=(svn export . "$DEST") awk_cmd=(awk -W interactive -v start="$start_ts") fi "${export_cmd[@]}" | "${awk_cmd[@]}" ' function elapsed() { cmd = "date +%s.%N" cmd | getline now close(cmd) split(start, s, ".") split(now, n, ".") return (n[1]-s[1]) + (n[2]-s[2])/1e9 } { count++ if (count % 25 == 0) { t = elapsed() printf("[%.1fs] Exported %d items\n", t, count) fflush() } } END { t = elapsed() printf("[%.1fs] Exported %d items (done)\n", t, count) } ' cd "$DEST" git init git config init.defaultBranch trunk || true git add -A git commit -m "Import SVN snapshot" || true