限制 Subversion 存储库的大小 [英] Limit size of Subversion repository

查看:32
本文介绍了限制 Subversion 存储库的大小的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想通过指定最大大小来限制我的存储库的大小,但是我找不到任何有关这样做的信息.这在技术上可行吗?

Hi I'd like to limit the size of my repository by specifying a maximum size, however I cannot find any information on doing so. Is this technically possible?

对不起,如果我不清楚.我想保留一个功能存储库,我可以在其中继续提交补丁,但是可以自动删除至少具有一个更新版本的文档的最旧版本以保持在大小限制内.所以说我可以返回大约 67 个修订版本,因为旧版本已被删除(最好保留提交消息).

edit: sorry if I wasn't clear. I want to keep a functional repository where I can keep committing patches, however the oldest revisions of documents that have at least one newer revision can be automatically removed to stay within the sizelimit. so say that I can go about 67 revisions back because older ones have been removed (ideally keeping the commit messages).

推荐答案

这样做对您的存储库来说是一场大手术.在真正的存储库上真正执行此操作之前,请确保您完全了解自己在做什么.

Doing this is major surgery on your repository. Make sure you're fully aware of what you're doing before doing this for real on a real repository.

您将无法对单个文件执行所需的操作,但您可以在整个存储库中执行此操作.您需要做的是切断存储库的历史记录尾部.

You won't be able to do what you're after for individual files, but you can do this across the whole repository. What you need to do is cut off the history tail for the repository.

这意味着,如果您的存储库中有 5000 个修订版,并且您删除了最早的 1000 个修订版,您最终将得到一个只有最近 4000 个修订版的存储库.

What this means is that if you've got 5000 revisions in your repository, and you cut off the oldest 1000 revisions, you'll end up with a repository with just the most recent 4000 revisions.

这样做需要一个转储/恢复周期,这意味着您必须在处理和重建存储库时禁用对存储库的写访问.

Doing this requires a dump/restore cycle, which means that you'll have to disable write access to the repository whilst you're working on and rebuilding the repository.

浏览存储库时您不会丢失任何仍然可见的文件,但任何特定文件的历史记录可能会完全丢失(如果对它的所有修改都在前 1000 次修订中).显然,如果某个文件在其中一个早期版本中被删除,您将无法在剪切后将其恢复.

You won't lose any files that are still visible when browsing the repository, but the history for any particular file may be lost entirely (if all modifications to it were in the first 1000 revisions). Obviously if a file was deleted in one of the early revisions, you won't be able to get it back at all after the cut.

另请注意,执行此操作的天真的方法将从 0 开始对所有修订重新编号,因此在上例中,修订 5000 将在截断后变为修订 4000.如果这会给您带来问题,您将不得不做额外的工作.

Also note that the naive way of doing this will renumber all of your revisions starting from 0, so in the above example, revision 5000 will become revision 4000 after the truncation. If this will cause you problems, you'll have to do extra work.

所以,假设我们想丢失earlist 1000 个修订版,基本的工作流程是:

So, assuming we want to lose the earlist 1000 revisions, the basic workflow is:

  1. 使您的存储库脱机(或至少将其设为只读)
  2. run svnadmin dump [repository path] -r 1000:HEAD >存储库.转储.这将创建一个转储文件,其中仅包含 1000 次以后的修订.通过使用 --incremental 标志,转储文件中的第一个修订版将包含存储库的完整转储,因为它查看了修订版 1000(不包括所有历史记录).
  3. 使用 svnadmin create 创建一个干净的存储库并复制 conf &从旧存储库中挂钩目录.
  4. run svnadmin load [新仓库路径] repository.dump 以加载最新的修订版.
  5. 将旧存储库移开(保留以备备份)并将新存储库移至原位.
  1. Take your repository offline (or at least make it read-only)
  2. run svnadmin dump [repository path] -r 1000:HEAD > repository.dump. This will create a dumpfile which only includes revisions from 1000 onwards. By not using the --incremental flag, the first revision in the dumpfile will contain a complete dump of the repository as it looked at revision 1000 (excluding all history).
  3. Create a clean repository with svnadmin create and copy the conf & hooks directories from the old repository.
  4. run svnadmin load [new repository path] < repository.dump to load up the most recent revisions.
  5. Move the old repository out of the way (keep it around for backup) and move the new repository into its place.

如果您想保留修订号,则必须从某处加载空修订.您可以通过将修订版 1:999 转储到单独的转储文件中,然后使用 svn dumpfilter 删除其中的所有内容,然后加载空修订版,然后加载您想要的修订版来实现.这有点繁琐,但会让你到达那里.

If you want to preserve the revision numbers you'll have to load the empty revisions from somewhere. You can do that by dumping out the revisions 1:999 into a separate dump file and then using svn dumpfilter to get rid of everything from it, then load up the empty revisions followed by the revisions you want. It's a bit fiddly, but will get you there.

这篇关于限制 Subversion 存储库的大小的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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