使用什么命令从 Mercurial 存储库中排除文件?

发布于 2024-08-24 16:42:45 字数 488 浏览 5 评论 0原文

我的 Mercurial 存储库中有一个大文件,导致我的存储库无法上传到 Bitbucket。我收到错误:

abort: HTTP Error 413: Request Entity Too Large

幸运的是,该文件的文件扩展名与我的存储库中的其他文件扩展名不同,因此应该很容易创建规则来排除它。但是,直到几天前该文件可能变得太大时才包含在存储库的提交中。我是否需要将其从历史记录以及未来的提交中删除?我需要什么命令来执行此操作?

我在“包含排除提案”上找到了此文档,但我不确定它是提议的功能还是实际的功能:

https://www.mercurial-scm.org/wiki/IncludeExcludeProposal

I have a large file in my Mercurial repository that is preventing my repository from being uploaded to Bitbucket. I get the error:

abort: HTTP Error 413: Request Entity Too Large

Fortunately the file extension for this file is different from everything else in my repository so it should be easy to create a rule to exclude it. However, the file has been included in commits in the repository up until a few days ago when it probably became too large. Do I need to remove it from history as well as future commits? What command do I need to do this?

I found this document on "IncludeExclude Proposal" but I'm not sure if it's a proposed feature or an actual one:

https://www.mercurial-scm.org/wiki/IncludeExcludeProposal

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

谈情不如逗狗 2024-08-31 16:42:45

如果您已经提交了它,而且看起来您已经提交了,那么排除(又名 hgignore)对您不起作用。

.hgignore(以及您在 InlcudeExcludeProposal 中看到的从未采用的高级语法)有助于防止以免您意外添加不想添加的文件。一旦您添加了文件, hgignore 就不起作用,并且一旦您提交了添加文件,就无法将其从历史记录中删除,除非 EditingHistory

如果您可以删除最后几次提交(意图重新执行除大文件添加之外的所有提交),您可以使用 hg clone -r lastknowngoodextension现有的repopath newrepopath,您的存储库将减去newrepopath中那些不需要的扩展。我认为,Bitbucket 提供了一个 Web 界面来删除变更集,但我不确定。

如果您不能直接克隆(或剥离)最后几个修订版本,那么您就处于 EditingHistory 空间中,使用 mqconvert 或类似方法。

如果您希望跟踪这些文件但不在存储库中,您可能需要查看 bfiles 扩展。

If you've already committed it, and it looks like you have, then exclude (aka hgignore) won't work for you.

.hgignore (and the never adopted advanced syntax you see in InlcudeExcludeProposal) help prevent you from accidentally adding a file you don't want to add. Once you've added a file hgignore has no effect, and once you've committed that add it's there's no way to remove it from history without EditingHistory

If you can just get rid of the last few commits (with intent to re-do all but the big-file adds) you can use hg clone -r lastknowngoodextension existingrepopath newrepopath and you'll have your repo minus those unwanted extensions at newrepopath. I think, Bitbucket offers a web interface to remove changesets, but I'm not certain.

If you can't just clone (or strip) away the last few revisions then you're in the EditingHistory space, using mq or convert or similar.

If you want those files tracked but not in the repo you might want to look at the bfiles extension.

彻夜缠绵 2024-08-31 16:42:45

现在这是可能的。
TortoiseHg 可以做到(有一个选项“忘记文件”)。

或者在控制台中输入 hg忘记

Now it is possible.
TortoiseHg can do it (there is an option 'Forget file').

Or type hg forget in console.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文