Getting list of SVN users for Subversion -> Git migration? Getting list of SVN users for Subversion -> Git migration? git git

Getting list of SVN users for Subversion -> Git migration?


Pass the path to the repository as a URL:

svn log -q file:///var/subversion | grep -e '^r' | awk 'BEGIN { FS = "|" } ; { print $2 }' | sort | uniq

By the way, if you need the list of authors in chronological order of first commit (I found it helpful once when converting from svn to git), you can do the following:

svn log -q -r 1:HEAD url://to/repo | grep '^r' | awk -F'|' '!x[$2]++{print$2}'


See the instructions below to convert an SVN repository to a git repository

Note: To ONLY see the list of users run line item 1.

CONVERT SVN REPO to GIT REPO

1. Retrieve a list of all Subversion committers

 $ svn log -q https://svn.example.com/repository_name | awk -F '|' '/^r/ {sub("^ ", "", $2); sub(" $", "", $2); print $2" = "$2" <"$2">"}' | sort -u > authors-transform.txt

That will grab all the log messages, pluck out the usernames, eliminate any duplicate usernames, sort the usernames and place them into a "authors-transform.txt” file. Now edit each line in the file. For example, convert:

username = username <username>

into this:

 username = Firstname Lastname <username@example.com>

2. Clone the Subversion repository using git-svn

git svn clone [SVN repo URL] --no-metadata -A authors-transform.txt --stdlayout ~/temp

3. Convert svn:ignore properties to .gitignoreIf your svn repo was using svn:ignore properties, you can easily convert this to a .gitignore file using:

cd ~/tempgit svn show-ignore > .gitignoregit add .gitignoregit commit -m 'Convert svn:ignore properties to .gitignore.'

4. Push repository to a bare git repositoryFirst, create a bare repository and make its default branch match svn’s "trunk” branch name.

git init --bare ~/new-bare.gitcd ~/new-bare.gitgit symbolic-ref HEAD refs/heads/trunkcd ~/tempgit remote add bare ~/new-bare.gitgit config remote.bare.push 'refs/remotes/*:refs/heads/*'git push bare

You can now safely delete the ~/temp repository.

5. Rename "trunk" branch to "master"Your main development branch will be named "trunk” which matches the name it was in Subversion. You’ll want to rename it to Git’s standard "master” branch using:

cd ~/new-bare.gitgit branch -m trunk master

6. Clean up branches and tagsgit-svn makes all of Subversions tags into very-short branches in Git of the form "tags/name”. You’ll want to convert all those branches into actual Git tags using:

cd ~/new-bare.gitgit for-each-ref --format='%(refname)' refs/heads/tags |cut -d / -f 4 |while read refdo   git tag "$ref" "refs/heads/tags/$ref";   git branch -D "tags/$ref";done

7. Move bare repository to central remote repositoryExample of how to move your local bare repository to a gitolite repository:

mv new-bare.git repository_name.gittar czvf repository_name.git.tar.gz repository_name.git/scp repository_name.git.tar.gz remote_host:ssh remote_hosttar xzvf repository_name.git.tar.gzsudo chown -R git:staff repository_name.git/cd repository_name.git/find . -type f -exec chmod go= {} \;  # remove group and world permissionsfind . -type d -exec chmod go= {} \;  # remove group and world permissionscd ../mv repository_name.git /Users/git/repositories/

8. Clone new local copy

mv old-svn-copy old-svn-copy.backupgit clone git@remote_host:repository_name.git

List all unversioned files from your old local svn repository and copy them to the new local git repository:

cd old-svn-copy.backupgit clean -dXn  # Using this command because the old copy was a git-svn clonecp example-file.txt ../repository_name/  # copy all files and directories from the list that you need in the new local git repository

You can now move the local svn copy backup to your trash. It might be a good idea not to empty your trash until your sure everything is working correctly.

9. Done.

Source here