Svn get current user

前端 未结 8 1646
旧时难觅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:45

    In Windows it is located in

    %APPDATA%\Subversion\auth\
    

    To find this directory, just go to run (win-key+r), paste the above command and hit enter or click on Run button.

    For me, there was a file in folder svn.simple. It is a text file and it has info with saved authentication data. I have something like this:

    ...
    K 8
    username
    V 6
    kosta
    END
    
    0 讨论(0)
  • 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
    <http://your.1st.url.name.here:80> Authorization Realm
    K 8
    username
    V 5
    yourUserName
    --
    svn:realmstring
    V 45
    <http://your.2nd.url.name.here:80> Authorization Realm
    K 8
    username
    V 5
    yourUserName
    
    0 讨论(0)
提交回复
热议问题