1#!/bin/sh
2cd `dirname "$0"`
3mtn sy
4if [ ! -d .git ]; then
5 git init # --initial-branch=trunk # not yet supported on WSL
6 git checkout -b trunk
7 git remote add origin git@github.com:lapo-luchini/asn1js.git
8 rm git-marks1.txt git-marks2.txt
9fi
10touch git-marks1.txt git-marks2.txt
11[ -f git-authors.txt ] || echo 'lapo@lapo.it = Lapo Luchini <lapo@lapo.it>' > git-authors.txt
12mtn ls branches --ignore-suspend-certs | sort -V | awk '
13 NR == 1 { base = $0; len = length(base) }
14 { d = length($0) - len; print $0 " = " (d > 0 ? substr($0, len+2) : "trunk") }
15' > git-branches.txt
16mtn --quiet --authors=git-authors.txt --branches-file=git-branches.txt --import-marks=git-marks1.txt --export-marks=git-marks1.txt git_export | \
17 git fast-import --import-marks=git-marks2.txt --export-marks=git-marks2.txt
18git push --mirror origin
19git reset # to update working copy state (doesn't change files)