aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBrian Harring <ferringb@google.com>2012-10-16 05:34:41 -0700
committerBrian Harring <ferringb@google.com>2012-10-16 13:28:49 -0700
commit9ab662882db48df135679083a2929c53d9cedc05 (patch)
tree2aa0f5d30d7cda540a099d3cde3d54fa133d1efa /create-git.sh
parenttweak the progress output a bit; specifically, percentile increments (diff)
downloadgit-conversion-tools-9ab662882db48df135679083a2929c53d9cedc05.tar.gz
git-conversion-tools-9ab662882db48df135679083a2929c53d9cedc05.tar.bz2
git-conversion-tools-9ab662882db48df135679083a2929c53d9cedc05.zip
add --full mode; via this, the two phases can work together. faster namely.
Diffstat (limited to 'create-git.sh')
-rwxr-xr-xcreate-git.sh58
1 files changed, 42 insertions, 16 deletions
diff --git a/create-git.sh b/create-git.sh
index 667fed0..4fa47e5 100755
--- a/create-git.sh
+++ b/create-git.sh
@@ -8,32 +8,58 @@ rm -rf git/* git/.git
set -f
mkdir -p git
cd git
+git_root="$(pwd)"
git init --bare
git config core.logAllRefUpdates false
git config prune.expire now
mkdir -p objects/info
-targets=( $(find ../final/ -maxdepth 1 -mindepth 1 -printf '../final/%P/\n' | \
- xargs -n1 readlink -f | \
- while read l; do
- [ -e "$l/cvs2svn-tmp/git-dump.dat" ] || continue;
- echo "$l/git/objects" >> objects/info/alternates
- echo "$l"
- done
- )
-)
-echo "loading all commits, linearizing, and rewriting history..."
-time (
- "${root}/rewrite-commit-dump.py" "${targets[@]}" | \
- tee ../export-stream-rewritten | \
- git fast-import
-) 2>&1 | tee git-creation.log
+update_alternates() {
+ local alternates="$(readlink -f objects/info)/alternates"
+ cd "${root}"
+ while read l; do
+ l=$(readlink -f "$l")
+ [ -e "$l/cvs2svn-tmp/git-dump.dat" ] || { echo "ignoring nonexistant alternates source $l" >&2; continue; }
+ echo "$l/git/objects" >> "${alternates}"
+ echo "$l"
+ done
+ echo "starting history linearizing/rewriting" >&2
+}
+
+standalone_mode() {
+ echo "loading all commits" >&2
+ find ../final/ -maxdepth 1 -mindepth 1 -printf '../final/%P/\n' | \
+ xargs -n1 readlink -f | update_alternates
+}
+
+if [ "$1" == --fast ]; then
+ command=update_alternates
+else
+ command=standalone_mode
+ echo "loading all commits in parallel to their generation..." >&2
+fi
+
+# Roughly; since alternates are updated as we go- and since rewrite-commit-dump
+# doesn't actually output anything till it's linearized the history, we have
+# to delay fast-import's startup until we know we have data (meaning linearize
+# has finished- thus the alternates are all in place).
+# Bit tricky, but the gains have been worth it.
+time {
+ ${command} | \
+ "${root}/rewrite-commit-dump.py" | \
+ ( read line; { echo "$line"; cat; } | \
+ tee ../export-stream-rewritten |\
+ git fast-import
+ )
+} 2>&1 > >(tee git-creation.log)
+ret=$?
+[ $ret -eq 0 ] || { echo "none zero exit... the hell? $ret"; exit 1; }
echo "recomposed; repacking and breaking alternate linkage..."
# Localize the content we actual use out of the alternates...
time git repack -Adf --window=100 --depth=100
# Wipe the alternates.
-rm objects/info/alternates
+rm objects/info/alternates || { echo "no alternates means no sources..."; exit 2; }
echo "doing cleanup..."
time git prune
echo "doing basic sanity check"