Svn get current user

前端 未结 8 1675
旧时难觅i
旧时难觅i 2021-02-05 01:47

How to get current user that is using svn on particular workstation?

can I use svn.exe executable with some switch to get that info.

Thanks.

8条回答
  •  长情又很酷
    2021-02-05 02:48

    Edit: Note this answer only applies to SVN versions before 1.9. If you using SVN version >1.9, then try the svn auth approach described in @bahrep's answer

    This is a bash script that I use, which I put in my ~/bin/ folder and called svn_whoami.sh:

    #!/bin/bash
    
    debug=false
    
    for ((i=1;i<=$#;i++)) do
        case ${!i} in
    
            -h|--help)
                programName=$( basename ${0} )
                echo "Usage:"
                echo "    ${programName} [-h|--help] [-d|--debug]"
                echo
                echo "Example:"
                echo "    ${programName} --debug"
                exit 0;
                ;;
            -d|--debug)
                debug=true;
                ;;
    
        esac;
    done;
    
    if [ "${debug}" == "true" ]; then
        echo "cat ~/.subversion/auth/svn.simple/* | grep -A6 username --color";
    fi;
    
    cat ~/.subversion/auth/svn.simple/* | grep -A6 svn:realmstring
    

    Output:

    $ svn_whoami.sh -d
    cat ~/.subversion/auth/svn.simple/* | grep -A6 username --color
    svn:realmstring
    V 53
     Authorization Realm
    K 8
    username
    V 5
    yourUserName
    --
    svn:realmstring
    V 45
     Authorization Realm
    K 8
    username
    V 5
    yourUserName
    

提交回复
热议问题