简体   繁体   English

如何使用Shell脚本知道GIT和SVN存储库的大小?

[英]How to know the size of GIT and SVN repository using shell script?

I am trying to write a shell script , from which i can get to know the size of remote GIT repository and SVN repository. 我正在尝试编写一个shell script ,从中我可以了解远程GIT存储库和SVN存储库的大小。

Example: 例:

My GIT repository 
name : MyGITProject
Username : MMMMM
password : yyyyy



My SVN repository
name : MySVNProject
Username : SSSSSSS
password : kkkkkk

You can use git-sizer for this purpose. 您可以为此使用git-sizer Here it has been explained completely on how to do this process. 此已对如何执行此过程进行了完整的说明。 Note that you need a local copy of your git to be able to do so. 请注意,您需要git的本地副本才能这样做。

To make it as a shell script: 使其成为shell脚本:

  1. Make a local copy of your git repository. 制作git储存库的本地副本。
  2. Change directory to there, run git-sizer in you shell 将目录切换到那里,在您的shell中运行git-sizer
  3. Echo the output to a file, you can strip the output to only give you the information you need. 将输出回显到文件中,可以剥离输出以仅提供所需的信息。

Also, as a pure-shell workaround for SVN, I did this : 另外,作为SVN的纯壳解决方法,我这样做是:

  1. Update SVN 更新SVN
  2. Run du recursively for the folders you need: du -sh --max-depth=x (X the depth of folder structure) 对所需的文件夹递归运行dudu -sh --max-depth=x (X文件夹结构的深度)

Technically, this is not a good idea to put max-depth to a high number. 从技术上讲,这不是将max-depth的好主意。 As your SVN might have astronomical number of files and folders in and this will bring a substantial overhead to your I/O and CPU. 由于您的SVN中可能有天文数字的文件和文件夹,这将给I / O和CPU带来巨大的开销。 But it can help you write a useful script. 但这可以帮助您编写有用的脚本。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM