Progress bar for svn checkout in text mode

2019-07-02 20:52发布

I'm writing a bash script that needs to fetch source code from several remote subversion repositories. I use svn checkout -q to avoid displaying long lists of files that clutter the output but now I'm looking for a clean way to display progress info to the user during each svn checkout. Something in the vein of wget and curl's progress indicators. I'll have users in OSX and Linux. pv is available on both but so far, I haven't found how to use it with svn checkout. I should also say that I'm not looking for tools that use GUI windows, but text-only tools.

Any suggestions would be very welcome! Thanks!

2条回答
爱情/是我丢掉的垃圾
2楼-- · 2019-07-02 21:42

Closest thing I've found: http://www.danielkraaij.nl/2014/03/30/subversion-progressbar-in-bash/

n=$(svn info -R svn://svn/project/trunk | grep "URL: " | uniq | wc -l)

n=$(svn info -R svn://svn/project/trunk | grep "URL: " | uniq | wc -l)
i=1
while read line filename
    do
    counter=$(( 100*(++i)/n))
    echo -e "($counter %)\n"
    echo -e "filename: $filename \n"
done < <(svn co svn://svn/project/trunk /var/www/project)

dialog --backtitle "Subversion Installer" --title "SVN Checkout" --gauge "Getting total file count" 7 120 < <(
    n=$(svn info -R svn://svn/project/trunk | grep "URL: " | uniq | wc -l)
    i=1
    while read line filename
        do
        counter=$(( 100*(++i)/n))
        echo "XXX"
        echo "$counter"
        echo "filename: $filename"
        echo "XXX"

    done < <(svn co svn://svn/project/trunk /var/www/project)
)
查看更多
等我变得足够好
3楼-- · 2019-07-02 21:51

try:

svn list -v -R URL

you can parse the result, and do a progress by file count.

查看更多
登录 后发表回答