1
0
Fork 0

Updated authors.py to read from users.csv; modified some steps in hg2git

This commit is contained in:
jochan 2017-06-15 11:13:31 -07:00
parent 57ba7953bf
commit e6435972f2
2 changed files with 22 additions and 17 deletions

View File

@ -1,5 +1,6 @@
import re
import csv
import os
failed_pattern = re.compile("^\*\*\*.*$")
null_author = re.compile("^<>$")
@ -18,7 +19,7 @@ null_any = re.compile("^<.*>$")
any_email = re.compile("^.+\s\S+@\S+$")
any_null = re.compile("^.+$")
with open("users.csv", "r") as users_file:
with open(os.path.dirname(os.path.abspath(__file__)) + "/users.csv", "r") as users_file:
users_reader = csv.reader(users_file, delimiter=',')
users = [{"name": user[0], "username": user[1], "email": user[2]} for user in users_reader]

View File

@ -1,6 +1,7 @@
# PREP WORK
git clone --depth=1 --branch=master https://github.com/frej/fast-export.git <fast-export>
curl "http://repo1.maven.org/maven2/com/madgag/bfg/1.12.15/bfg-1.12.15.jar" -o <bfg-repo-cleaner>/bfg.jar
cp {authors.py,users.csv} <authors>
mkdir <target>
# TO CREATE A GIT REPO AT <target> FROM <source>
@ -12,6 +13,7 @@ cp <fast-export>/* .
git init
git config core.ignoreCase false
sh hg-fast-export.sh -r <source> --force -A reformatted-authors.txt
git config --bool core.bare true
# WARNING !!!
# -----------
@ -20,7 +22,7 @@ sh hg-fast-export.sh -r <source> --force -A reformatted-authors.txt
# TO CLEAN UP LARGE FILES
git gc
java -jar <bfg-repo-cleaner>/bfg.jar --strip-blobs-bigger-than <size> <target>
java -jar <bfg-repo-cleaner>/bfg.jar --strip-blobs-bigger-than <size> <target> # <size> == ~40M
git reflog expire --expire=now --all
git gc --prune=now --aggressive
@ -32,26 +34,28 @@ cd <target>
comm -2 -3 all.log open.log > closed.log
for branch in `cat closed.log`; do git tag "closed/$branch" $branch; git branch -df $branch; done
# BEFORE GOING LIVE
git checkout master -f
git clean -df
* create .gitignore:
find . -name ".hgignore" > hgignore-files.log
for file in `cat hgignore-files.log`; do
newfile=${file/hgignore/gitignore};
cp $file $newfile;
sed -E -i.bak "s/syntax:/#syntax:/; s/^\^//; s/\$$//; s/\\\w\+/*/; s/\\\\\//\//g" $newfile; #optional
done
# TO CONVERT HGIGNORE TO GITIGNORE (do this on a non-bare clone)
find . -name ".hgignore" > hgignore-files.log
for file in `cat hgignore-files.log`; do
newfile=${file/hgignore/gitignore};
echo $newfile >> gitignore-files.log
cp $file $newfile;
sed -i.bak "s/syntax:/#syntax:/; s/^\^//; s/\$$//; s/\\\w\+/*/; s/\\\\\//\//g" $newfile; # optional
done
cat gitignore-files.log | xargs git add
git clean -df && git commit -m "Added gitignore files" && git push
# OTHER TASKS
* cloning repo with all branches:
* cloning non-bare mirror repo with all branches:
git clone --mirror <target> <target-clone>/.git
cd <target-clone>
git config --local --bool core.bare false
git checkout master
* cloning repo with a specific <branch>:
git clone -b <branch> --single-branch <target> <target-clone>
# NOTES
* use `git pull --rebase` instead of merging local commits to avoid excessive merges
* merges should typically only happen when merging a distinct branch with master
* serving git repo
git daemon --base-path=. --export-all --reuseaddr --informative-errors --verbose
* URL: git://10.0.33.167/
* convert bare repo to non-bare
git config --bool core.bare true
git checkout master -f