How to get a list of all Subversion commit author usernames?

前端 未结 8 1638
无人共我
无人共我 2021-01-29 20:51

I\'m looking for an efficient way to get the list of unique commit authors for an SVN repository as a whole, or for a given resource path. I haven\'t been able to find an SVN co

8条回答
  •  误落风尘
    2021-01-29 21:18

    In PowerShell, set your location to the working copy and use this command.

    svn.exe log --quiet |
    ? { $_ -notlike '-*' } |
    % { ($_ -split ' \| ')[1] } |
    Sort -Unique
    

    The output format of svn.exe log --quiet looks like this:

    r20209 | tinkywinky | 2013-12-05 08:56:29 +0000 (Thu, 05 Dec 2013)
    ------------------------------------------------------------------------
    r20208 | dispy | 2013-12-04 16:33:53 +0000 (Wed, 04 Dec 2013)
    ------------------------------------------------------------------------
    r20207 | lala | 2013-12-04 16:28:15 +0000 (Wed, 04 Dec 2013)
    ------------------------------------------------------------------------
    r20206 | po | 2013-12-04 14:34:32 +0000 (Wed, 04 Dec 2013)
    ------------------------------------------------------------------------
    r20205 | tinkywinky | 2013-12-04 14:07:54 +0000 (Wed, 04 Dec 2013)
    

    Filter out the horizontal rules with ? { $_ -notlike '-*' }.

    r20209 | tinkywinky | 2013-12-05 08:56:29 +0000 (Thu, 05 Dec 2013)
    r20208 | dispy | 2013-12-04 16:33:53 +0000 (Wed, 04 Dec 2013)
    r20207 | lala | 2013-12-04 16:28:15 +0000 (Wed, 04 Dec 2013)
    r20206 | po | 2013-12-04 14:34:32 +0000 (Wed, 04 Dec 2013)
    r20205 | tinkywinky | 2013-12-04 14:07:54 +0000 (Wed, 04 Dec 2013)
    

    Split by ' \| ' to turn a record into an array.

    $ 'r20209 | tinkywinky | 2013-12-05 08:56:29 +0000 (Thu, 05 Dec 2013)' -split ' \| '
    r20209
    tinkywinky
    2013-12-05 08:56:29 +0000 (Thu, 05 Dec 2013)
    

    The second element is the name.

    Make an array of each line and select the second element with % { ($_ -split ' \| ')[1] }.

    tinkywinky
    dispy
    lala
    po
    tinkywinky
    

    Return unique occurrences with Sort -Unique. This sorts the output as a side effect.

    dispy
    lala
    po
    tinkywinky
    

提交回复
热议问题