Progress bar for svn checkout in text mode

好久不见. 提交于 2019-12-23 15:44:32

问题


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!


回答1:


try:

svn list -v -R URL

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




回答2:


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)
)


来源:https://stackoverflow.com/questions/15093884/progress-bar-for-svn-checkout-in-text-mode

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!