从存储库中删除旧的 .Svn 文件 [英] Delete older .Svn files from reposititory

查看:22
本文介绍了从存储库中删除旧的 .Svn 文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的 .svn 存储库变得非常大(5 GB),我们真的不需要回过头来使用它.(找到 6 个月或一年).

My .svn repository is getting quite large (5 GB) and we really don't need to go back quite so far with it. ( 6 months or a year is find).

我在从存储库签出的目录的根目录下也有 8 GB .svn 文件夹.

I also have on 8 GB .svn folder at the root of the directory that is checked out of the repository.

我什至会满足于重新开始"并将旧 SVN 的副本保留 6 个月或一年,然后最终根据 如何备份和恢复svn中的所有源代码?

I would even settle for "starting over" and keeping a copy of the old SVN around for 6 months or a year and then eventually deleting it per How to backup and restore all the source code in svn?

推荐答案

你的 .svn 存储库是什么意思?

What do you mean your .svn repository?

那个 .svn 文件夹主要用于管理检出的版本,与您的存储库服务器的历史记录完全无关.

That .svn folder is mainly used to manage the checked out version and has absolutely nothing to do with the history of your repository server.

.svn 目录包含诸如客户端上的哪些文件发生了更改、签出的人员以及 URL 等信息.在 Subversion 1.7 之前的版本中,它甚至保留了检出目录的完整副本.这样,您可以在不与服务器交谈的情况下执行差异以查看您所做的更改.这意味着如果您检出 100Mb 的文件,您的 .svn 目录也将是大约 100Mb.

The .svn directory contains information like what files on the client changed, who did the checkout, and the URL. In pre-1.7 versions of Subversion, it even kept a complete copy of the checked out directory. This way, you could do a diff to see the changes you made without talking to the server. That meant if you checked out 100Mb of files, your .svn directory would be about 100Mb too.

如果您谈论的是客户端,则只需检查 URL 中需要处理的部分.例如,假设您有这样的标准 Subversion 存储库设置:

If you're talking about the client, you only need to checkout the part of the URL that you need to work on. For example, let's say you have the standard Subversion repository setup like this:

  • http://%REPO_URL%/trunk
  • http://%REPO_URL%/tags
  • http://%REPO_URL%/branches

trunk 下,你有你所有的项目:

Under trunk, you have all of your projects:

  • http://%REPO_URL%/trunk/project_foo
  • http://%REPO_URL%/trunk/project_bar
  • http://%REPO_URL%/trunk/project_fubar

如果我只在 project_foo 中工作,我就不必检查 http://%REPO_URL%/trunk.我当然不想签出 http://%REPO_URL% 这会给我我的整个存储库,包括完全签出的所有分支和标签.(我见过这样做的人).

I don't have to checkout http://%REPO_URL%/trunk if I'm only working in project_foo. I certainly don't want to checkout http://%REPO_URL% which will give me my entire repository including all branches and tags fully checked out. (And I've seen people who had done this).

Subversion 客户端不会检出整个存储库,而只会检出项目的单个版本.如果您检查您需要的内容,您可能会拥有一个数百 TB 大小的存储库,但您正在使用的工作副本的大小可能不会超过 1 GB.

A Subversion client doesn't checkout the entire repository, but just a single version of the project. If you checkout what you need, you could have a repository that's hundreds of terabytes in size, but you're working copy probably isn't over a gigabyte in size.

我看到的一个问题是人们检查二进制代码——第三方库或编译代码.此代码不应该是您的存储库的一部分.如果您使用 Java,请使用 Maven、Gradle 或 Ant 和 Ivy 来管理这些第三方库以及您的项目可能使用的您自己的构建对象.如果您使用 .NET,请使用 NuGet 执行相同操作.

One issue I've seen is people checking in binary code -- either third party libraries or compiled code. This code should not be part of your repository. If you use Java, use Maven, Gradle, or Ant with Ivy to manage these third party libraries and your own built objects that your project might use. If you use .NET, use NuGet to do the same.

Subversion 以差异格式存储文件.如果一个版本与另一个版本相差一行,则只有该行更改存储在 Subversion 中.尽管单个源更改可能是一行,但它可能会对构建的文件产生重大影响.二进制文件占据 Subversion 存储库 90% 以上的空间并不罕见.也就是说,一个应该有 500 MB 大小的存储库会因为二进制文件而膨胀到 50 GB 以上.

Subversion stores files in a diff format. If one version differs from another by a single line, only that line change is stored in Subversion. Although that single source change might be a single line, it could have major repercussions in the built file. It isn't unusual for binary files to take up over 90% of space of a Subversion repository. That is, a repository that should be about 500 megabytes in size would swell to over 50 Gigabytes because of the binary files.

更糟糕的是,二进制文件很快就会过时,Subversion 没有简单的方法来删除过时的版本.此外,Subversion 中没有工具可以帮助您分析二进制文件.在两个二进制版本之间进行区分是没有意义的.除了构建和检查版本的人之外,作者没有任何相关性——不一定是应该就任何问题联系的人(这是一种很好的表达责备的方式).

Even worse, binary files quickly become obsolete, and Subversion has no easy way of removing the obsolete version. Besides, there are no tools in Subversion that can help you analyze your binaries. Diffing between two binary versions is meaningless. The author has no relevance except that's who built and checked in the version -- not necessarily the person who should be contacted about any questions (which is a nice way of saying the blame).

我希望这能回答您的问题.只检出你需要的东西,你的 .svn 目录就会小得多.不要在 Subversion 中存储二进制文件,您的 .svn 目录将不必引用它们.如果这些没有帮助,请查看稀疏结帐这可以消除您不需要的跟踪文件.

I hope this answers your question. Checkout only what you need, and your .svn directory will be that much smaller. Don't store binary files in Subversion, and your .svn directory won't have to reference them. If these don't help, look into sparse checkouts which can eliminate tracking files you don't need.

这篇关于从存储库中删除旧的 .Svn 文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆