From d7d1870be318303e4f5679eb4e1a6823b9f5c930 Mon Sep 17 00:00:00 2001 From: Brian Harring Date: Sat, 13 Oct 2012 18:09:53 -0700 Subject: add usable script --- .gitignore | 1 + process_directory.sh | 34 ++++++++++++++++++++++++++++++++++ script.sh | 22 ++++++++++++++++++++++ 3 files changed, 57 insertions(+) create mode 100755 process_directory.sh create mode 100755 script.sh diff --git a/.gitignore b/.gitignore index 8b5efc7..3a10075 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,3 @@ cvs-repo output +final diff --git a/process_directory.sh b/process_directory.sh new file mode 100755 index 0000000..54c51cf --- /dev/null +++ b/process_directory.sh @@ -0,0 +1,34 @@ +#!/bin/bash +f() { + set -x + mkdir -p "${output}"/{git,cvs-repo/gentoo-x86/Attic} + ln -s "${cvsroot}" "${output}/cvs-repo/CVSROOT" + ln -s "${root}/gentoo-x86/$1" "${output}/cvs-repo/gentoo-x86/$1" + #ln -s "${root}/gentoo-x86/Attic" "${output}/cvs-repo/gentoo-x86/Attic" + ln -s "$(pwd)/config" "${output}/config" + cd "${output}" + time cvs2git --options config -vv + cd git + git init --bare + cat ../cvs2svn-tmp/git-{blob,dump}.dat | git fast-import + rm -rf "${final}" + cd "$root" + mv "$output" "${final}" + git --git-dir "${final}/git" log --pretty=tformat:"%at %H" > "${final}/git-hashes" + set +x +} + +[ $# -ne 1 ] && { echo "need an argument..."; exit 1; } + +root="$(pwd)/cvs-repo" +cvsroot="${root}/CVSROOT" +repo="${root}/gentoo-x86" +output="$(pwd)/output/${1%,v}" +final="$(pwd)/final/$1" +mkdir -p "$(dirname "${final}")" + +rm -rf "${output}" +mkdir -p "${output}" +echo "processing ${1%,v} ${1}" +time f "$1" &> "${output}/"log || { echo "failed $1"; exit 1; } +echo "processed $1" diff --git a/script.sh b/script.sh new file mode 100755 index 0000000..12c2032 --- /dev/null +++ b/script.sh @@ -0,0 +1,22 @@ +#!/bin/bash + +proc_count=$(grep -c MHz /proc/cpuinfo) +[ $proc_count -eq 0 ] && proc_count=1 + +rm -rf git +mkdir git +# Prioritize the larger categories first; they typically will have +# the most revs, thus start them first. +time { \ + find cvs-repo/gentoo-x86 -maxdepth 1 -mindepth 1 -printf '%P\n' | \ + xargs -n1 -I{} -- du -cs "cvs-repo/gentoo-x86/{}" | grep -v 'total$' | \ + sort -gr | awk '{print $2;}' | xargs -n1 basename | \ + xargs -n1 -P${proc_count} ./process_directory.sh | \ + { + cd git; + git init &> /dev/null + while read l; do + git fetch "$(readlink -f "../final/$l/git")" && git merge FETCH_HEAD -m "blah" -q + done + } +} -- cgit v1.2.3-65-gdbad