How to get trailing space character in authors file for git svn

The authors in my svn repo look like this:

$ svn log --xml | Posted by grep | sort -u | perl -pe's /. > (.?) & lt ../$ 1 = / '

Conclusion:

<author>ashfame</author>
<author>clean</author>
<author>clean </author>
<author>rocketweb</author>

But when cloning a repo to import using git svn cloneit it stops between wordsAuthor: clean not defined in /home/ashfame/fun/authors-transform.txt file

Note the double space after cleaning, which means its third user "clean ".

How do I format the authors file to have a space in the username? My current content is as follows:

ashfame = Ashfame <mail@example.com>
clean = Yogesh Tiwari <yogesh.tiwari@example.com>
clean = Yogesh Tiwari <yogesh.tiwari@example.com>
"clean\ " = Yogesh Tiwari <yogesh.tiwari@example.com>
"clean " = Yogesh Tiwari <yogesh.tiwari@example.com>
rocketweb = rocketweb <rocketweb@rocketweb.com>
(no author) = Yogesh Tiwari <yogesh.tiwari@example.com>
(no author) = no_author

: svn repo git - , "" , "" , , svn repo. , ?

+5
3

, SVN, - . script Github:

#!/bin/sh

git filter-branch --env-filter '

an="$GIT_AUTHOR_NAME"
am="$GIT_AUTHOR_EMAIL"
cn="$GIT_COMMITTER_NAME"
cm="$GIT_COMMITTER_EMAIL"

if [ "$GIT_COMMITTER_EMAIL" = "your@email.to.match" ]
then
    cn="Your New Committer Name"
    cm="Your New Committer Email"
fi
if [ "$GIT_AUTHOR_EMAIL" = "your@email.to.match" ]
then
    an="Your New Author Name"
    am="Your New Author Email"
fi

export GIT_AUTHOR_NAME="$an"
export GIT_AUTHOR_EMAIL="$am"
export GIT_COMMITTER_NAME="$cn"
export GIT_COMMITTER_EMAIL="$cm"
'

say change-commit-author-script.sh . chmod +x change-commit-author-script.sh, ./change-commit-author-script.sh

, script, .

+2

authorname.

author-prog, bash script, .

#!/bin/bash

if [ "$1" = "VisualSVN Server" ];then
    echo "VirtualSVNServer <svn.localdomain>";
fi
+3

If, like me, you have already created users.txtone that you want to convey only as --authors-fileto later understand that it does not work, here is a script that uses your existing one users.txtand allows you to create additional settings:

#!/bin/sh

if [ -z ${GIT_SVN_USERS_TXT+x} ]; then
    echo "the environment variable GIT_SVN_USERS_TXT must be set to the path of your users.txt" >&2
    exit 1
fi

while read line; do
    # remove largest suffix and trim whitespace
    svn=$(echo ${line%%=*} | xargs)
    # remove smallest prefix and trim whitespace
    git=$(echo ${line#*=} | xargs)
    if [ "$1" = "$svn" ]; then
        echo "$git"
        exit 0
    fi
done < "$GIT_SVN_USERS_TXT"

if [ "$1" = "spaceatend " ]; then
    echo "VirtualSVNServer <svn.localdomain>"
    exit 0
fi

echo "Unable to find user $1" >&2
exit 1

Run it as follows:

GIT_SVN_USERS_TXT=/path/to/users.txt git svn clone --authors-prog=/path/to/script.sh --no-metadata ...
0
source

All Articles