Edited hg2git to indicate that running bfg may prevent hg-fast-export from running successfully
This commit is contained in:
parent
28a7803f38
commit
5c0d2a1592
29
authors.py
29
authors.py
|
@ -2,7 +2,7 @@ import re
|
|||
|
||||
failed_pattern = re.compile("^\*\*\*.*$")
|
||||
null_author = re.compile("^<>$")
|
||||
visier_prepended = re.compile("^VISIER\\.*$")
|
||||
visier_prepended = re.compile("^VISIER\\\.*$")
|
||||
full_name_no_email = re.compile("^([A-Z]\w*\s?)+$")
|
||||
full_name_null_email = re.compile("^([A-Z]\w*\s?)+<>$")
|
||||
full_name_with_email = re.compile("^([A-Z]\w*\s?)+<.*>$")
|
||||
|
@ -19,13 +19,13 @@ any_null = re.compile("^.+$")
|
|||
|
||||
|
||||
def email_from_fullname(author):
|
||||
return "email for " + author
|
||||
return ""
|
||||
|
||||
def email_from_username(author):
|
||||
return "email for " + author
|
||||
return ""
|
||||
|
||||
def username_from_email(author):
|
||||
return "dummy_username for " + author
|
||||
return ""
|
||||
|
||||
def replace_author(author):
|
||||
if failed_pattern.match(author):
|
||||
|
@ -34,25 +34,25 @@ def replace_author(author):
|
|||
return "nulluser " + author
|
||||
if visier_prepended.match(author):
|
||||
return replace_author(author[7:])
|
||||
if full_name_no_email.match(author):
|
||||
return author.strip() + " <{}>".format(email_from_fullname(author.strip()))
|
||||
if full_name_with_email.match(author):
|
||||
return author
|
||||
if full_name_null_email.match(author):
|
||||
fullname = author.strip()[:-2].strip()
|
||||
return fullname + " <{}>".format(email_from_fullname(fullname))
|
||||
if full_name_with_email.match(author):
|
||||
if full_name_no_email.match(author):
|
||||
return author.strip() + " <{}>".format(email_from_fullname(author.strip()))
|
||||
if username_with_email.match(author):
|
||||
return author
|
||||
if username_no_email.match(author):
|
||||
return author.strip() + " <{}>".format(email_from_username(author.strip()))
|
||||
if username_null_email.match(author):
|
||||
username = author.strip()[:-2].strip()
|
||||
return username + " <{}>".format(email_from_username(username))
|
||||
if username_with_email.match(author):
|
||||
return author
|
||||
if username_no_email.match(author):
|
||||
return author.strip() + " <{}>".format(email_from_username(author.strip()))
|
||||
if username_sqr_email.match(author):
|
||||
return author.replace("[", "<").replace("]", ">")
|
||||
if username_rnd_name.match(author):
|
||||
username = author.split("(")[0].strip()
|
||||
return username + " " + email_from_username(username)
|
||||
return username + " <{}>".format(email_from_username(username))
|
||||
if username_address.match(author):
|
||||
username = author.split("@")[0]
|
||||
return username + " <{}>".format(email_from_username(username))
|
||||
|
@ -61,8 +61,9 @@ def replace_author(author):
|
|||
if null_any.match(author):
|
||||
return username_from_email(author[1:-1]) + " " + author
|
||||
if any_email.match(author):
|
||||
email = author.split(" ")[-1].strip()
|
||||
return author.replace(email, "<{}>".format(email))
|
||||
bad_email = author.split(" ")[-1]
|
||||
email = bad_email.strip().replace("<", "").replace(">", "")
|
||||
return author.replace(bad_email, "<{}>".format(email))
|
||||
if any_null.match(author):
|
||||
return "nulluser <>"
|
||||
|
||||
|
|
18
hg2git.cf
18
hg2git.cf
|
@ -13,13 +13,18 @@ git init
|
|||
git config core.ignoreCase false
|
||||
sh hg-fast-export.sh -r <source> --force -A reformatted-authors.txt
|
||||
|
||||
# WARNING !!!
|
||||
# -----------
|
||||
# VSERVER HAS DIFFICULTY RUNNING HG-FAST-EXPORT AFTER THE FOLLOWING HAVE BEEN DONE.
|
||||
# DO NOT EXECUTE ANY OF THE FOLLOWING UNTIL YOU ARE SURE GIT NO LONGER NEEDS TO SYNC WITH HG!!
|
||||
|
||||
# TO CLEAN UP LARGE FILES
|
||||
git gc
|
||||
java -jar <bfg-repo-cleaner>/bfg.jar --strip-blobs-bigger-than <size> <target>
|
||||
git reflog expire --expire=now --all
|
||||
git gc --prune=now --aggressive
|
||||
|
||||
# TO DELETE CLOSED BRANCHES
|
||||
# TO DELETE ALL CLOSED BRANCHES
|
||||
cd <source>
|
||||
hg heads --closed --template "{branch}\n" | tr " " "_" | sort > <target>/all.log
|
||||
hg heads --template "{branch}\n" | tr " " "_" | sort > <target>/open.log
|
||||
|
@ -27,22 +32,23 @@ 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
|
||||
|
||||
# CLEAN-UP WORK
|
||||
git checkout master
|
||||
# BEFORE GOING LIVE
|
||||
git checkout master -f
|
||||
git clean -df
|
||||
* create .gitignore (do before committing anything):
|
||||
* create .gitignore:
|
||||
* `find -name ".hgignore"` to find all .hgignore files
|
||||
* rename all .hgignore to .gitignore
|
||||
* rewrite anything under "syntax: regexp" to glob form
|
||||
* remove "syntax: {glob|regexp}" lines
|
||||
* stage and commit all .gitignore files
|
||||
|
||||
# OTHER TASKS
|
||||
* cloning all branches:
|
||||
* cloning 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 a specific <branch>:
|
||||
* cloning repo with a specific <branch>:
|
||||
git clone -b <branch> --single-branch <target> <target-clone>
|
||||
|
||||
# NOTES
|
||||
|
|
Loading…
Reference in New Issue