From 901721097cd3cf4a7c23a0e1d15767f5defe727a Mon Sep 17 00:00:00 2001 From: Brian Harring Date: Sun, 14 Oct 2012 15:56:29 -0700 Subject: update gitignore for intermediate/resultant content --- .gitignore | 11 ++++++++--- README | 2 ++ config | 17 ++++++----------- create-mailmap.py | 26 ++++++++++++++++++++++++++ process_directory.sh | 2 ++ script.sh | 1 + 6 files changed, 45 insertions(+), 14 deletions(-) create mode 100755 create-mailmap.py diff --git a/.gitignore b/.gitignore index 3a10075..6f54c02 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,8 @@ -cvs-repo -output -final +/cvs-repo +/output +/final +/git +/export-stream-raw +/export-stream-rewritten +/userinfo.xml +/gentoo_mailmap.py diff --git a/README b/README index c56f068..1fe1420 100644 --- a/README +++ b/README @@ -7,6 +7,8 @@ that said, it needs to conform to thus: $(pwd)/cvs-repo/CVSROOT $(pwd)/cvs-repo/gentoo-x86/* +From there, get yourself a userinfo.xml, and place it into $(pwd). + From there, ./script.sh is your main point of entry; it'll process that, going parallel, using $(pwd)/output for temp space- it's suggested that be tmpfs (much like cvs-repo). diff --git a/config b/config index 60cd351..58d398b 100644 --- a/config +++ b/config @@ -481,17 +481,12 @@ ctx.retain_conflicting_attic_files = False # with "u" as a prefix) or 8-bit strings in the utf-8 encoding. # Please substitute your own project's usernames here to use with the # author_transforms option of GitOutputOption below. -author_transforms={ - 'jrandom' : ('J. Random', 'jrandom@example.com'), - 'mhagger' : ('Michael Haggerty', 'mhagger@alum.mit.edu'), - 'brane' : (u'Branko Čibej', 'brane@xbc.nu'), - 'ringstrom' : ('Tobias Ringström', 'tobias@ringstrom.mine.nu'), - 'dionisos' : (u'Erik Hülsmann', 'e.huelsmann@gmx.net'), - - # This one will be used for commits for which CVS doesn't record - # the original author, as explained above. - 'cvs2svn' : ('cvs2svn', 'admin@example.com'), - } + +import gentoo_mailmap +author_transforms = gentoo_mailmap.mailmap.copy() +# This one will be used for commits for which CVS doesn't record +# the original author, as explained above. +author_transforms['cvs2svn'] = ('cvs2svn', 'admin@gentoo.org') # This is the main option that causes cvs2svn to output to a # "fastimport"-format dumpfile rather than to Subversion: diff --git a/create-mailmap.py b/create-mailmap.py new file mode 100755 index 0000000..085d84f --- /dev/null +++ b/create-mailmap.py @@ -0,0 +1,26 @@ +#!/usr/bin/python +from xml.etree import ElementTree as etree + +def main(source): + root = etree.parse(source).getroot() + for user in root.findall('user'): + fullname = user.findall('realname')[0].get('fullname') + # Compute email ourselves... + username = user.get('username') + assert username + email = '%s@gentoo.org' % username + yield username, (fullname, email) + # Handle aliases... + for alias in user.findall('alias'): + yield alias.text, (fullname, email) + + +if __name__ == '__main__': + import sys + if len(sys.argv) != 2: + sys.stderr.write("path to userinfo.xml required\n") + sys.exit(1) + + mailmap = dict(main(open(sys.argv[1], 'rb'))) + sys.stdout.write("mailmap=%r\n" % (mailmap,)) + sys.exit(0) diff --git a/process_directory.sh b/process_directory.sh index c9ff6e6..14ef28c 100755 --- a/process_directory.sh +++ b/process_directory.sh @@ -9,8 +9,10 @@ f() { ln -s "${root}/gentoo-x86/$1" "${output}/cvs-repo/gentoo-x86/$1" #ln -s "${root}/gentoo-x86/Attic" "${output}/cvs-repo/gentoo-x86/Attic" ln -s "$(pwd)/config" "${output}/config" + ln -s "$(pwd)/gentoo_mailmap.py" "${output}/gentoo_mailmap.py" # Note- this must be canonical path, else it screws up our $Header rewriting. cd "$(readlink -f "${output}" )" + export PYTHONPATH="${output}${PYTHONPATH:+:${PYTHONPATH}}" time cvs2git --options config -vv cd git git init --bare diff --git a/script.sh b/script.sh index e5a4e35..7104262 100755 --- a/script.sh +++ b/script.sh @@ -5,6 +5,7 @@ proc_count=$(grep -c MHz /proc/cpuinfo) rm -rf git/* git/.git final/* mkdir git -p +./create-mailmap.py userinfo.xml > gentoo_mailmap.py || { echo "failed to create mailmap."; exit 1; } # Prioritize the larger categories first; they typically will have # the most revs, thus start them first. time { \ -- cgit v1.2.3-65-gdbad