diff --git a/authors.py b/authors.py index 91557dd..c31ebab 100644 --- a/authors.py +++ b/authors.py @@ -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] diff --git a/hg2git.cf b/hg2git.cf index ea6c43d..15351b1 100644 --- a/hg2git.cf +++ b/hg2git.cf @@ -1,6 +1,7 @@ # PREP WORK git clone --depth=1 --branch=master https://github.com/frej/fast-export.git curl "http://repo1.maven.org/maven2/com/madgag/bfg/1.12.15/bfg-1.12.15.jar" -o /bfg.jar +cp {authors.py,users.csv} mkdir # TO CREATE A GIT REPO AT FROM @@ -12,6 +13,7 @@ cp /* . git init git config core.ignoreCase false sh hg-fast-export.sh -r --force -A reformatted-authors.txt +git config --bool core.bare true # WARNING !!! # ----------- @@ -20,7 +22,7 @@ sh hg-fast-export.sh -r --force -A reformatted-authors.txt # TO CLEAN UP LARGE FILES git gc -java -jar /bfg.jar --strip-blobs-bigger-than +java -jar /bfg.jar --strip-blobs-bigger-than # == ~40M git reflog expire --expire=now --all git gc --prune=now --aggressive @@ -32,26 +34,28 @@ cd 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 /.git cd git config --local --bool core.bare false git checkout master * cloning repo with a specific : git clone -b --single-branch - -# 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