从 hg 存储库中删除二进制文件

发布于 2025-01-07 22:25:50 字数 518 浏览 0 评论 0原文

Mercurial 是否可以删除具有特定扩展名的所有文件?我做了一个 addremove,然后我所有的二进制 .pyc 都被版本化了,现在当我进行版本化时,我得到了这个塞子:

tool kdiff3 can't handle binary
tool docdiff can't handle binary
 no tool found to merge bnano-www/wtforms/widgets.pyc
keep (l)ocal or take (o)ther? o
19 files updated, 67 files merged, 0 files removed, 0 files unresolved

C:\Users\developer\bnano\bnano-www>

我真的不知道这意味着什么,除非我可以按 o 表示其他并继续我的工作。现在我想清理我的存储库,最佳方案是能够在不添加二进制文件的情况下执行添加删除操作,但我认为这是不可能的。

您能否给出一些建议,在这种情况下该怎么做?

谢谢

Is it possible with Mercurial to remove all files with a certaain extension? I did an addremove and then all my binary .pyc were versioned and now I get this stopper when I do versioning:

tool kdiff3 can't handle binary
tool docdiff can't handle binary
 no tool found to merge bnano-www/wtforms/widgets.pyc
keep (l)ocal or take (o)ther? o
19 files updated, 67 files merged, 0 files removed, 0 files unresolved

C:\Users\developer\bnano\bnano-www>

I don't really know what it means except I can press o for other and go on with my work. Now I'd like to clean my repository and optimal would be to be able to do an addremove without binaries getting added but I think it is not possible.

Can you give some recommendation what to do in this case?

Thanks

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

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

发布评论

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

评论(3

紫南 2025-01-14 22:25:50

HgIgnore

首先,您可以在 .hgignore 文件中添加一些规则来告诉 Mercurial 您想要忽略一些文件。然后,hg addremove 不会自动添加它们,它们也不会作为未跟踪的出现在命令的输出中(即 hg status)。

删除文件

要删除文件,您可以使用 hg remove myfile,例如,如果所有 pyc 文件都位于同一目录中,您可以执行 hg删除 *.pyc 然后提交更改。

如果您的文件分散在各个存储库中,类似 hg remove -I *.pyc **/* 之类的内容应该删除所有目录中的所有 .pyc 文件。

排除模式

仅供参考,最好在 .hgignore 文件中添加不需要的文件,您还可以通过执行 hg addremove -X * 告诉 addremove 忽略某些文件.pyc。这将添加/删除除具有 pyc 扩展名的文件之外的所有文件。

您可以使用 help 查找有关特定 Mercurial 命令的帮助。例如,hg help addremove。总的来说,一切都解释得很清楚!

教程

为了更深入地探索各种 Mercurial 概念,我推荐这个优秀的教程:http://hginit.com

HgIgnore

First of all, you can add some rules to the .hgignore file to tell Mercurial that you want to ignore some files. Then, hg addremove won't add them automatically and they won't appear in the output of the commands (ie hg status) as untracked.

Removing the files

To remove your files, you can use hg remove myfile, for example, if all your pyc files are in the same directory, you can do hg remove *.pyc and then commit the change.

If your files are scattered in various repository, something like hg remove -I *.pyc **/* should remove all .pyc files in all directories.

Exclusion patterns

FYI, will it's better to add unwanted files in the .hgignore file, you can also tell addremove to ignore some files by doing hg addremove -X *.pyc. This will add/remove every files except those having the pyc extension.

You can find help about a specific mercurial command using help. For example, hg help addremove. In general everything is neatly explained !

Tutorial

To explore various Mercurial concepts in more depth, I recommand this excellent tutorial : http://hginit.com

转角预定愛 2025-01-14 22:25:50

要从存储库中删除所有二进制文件,您可以使用Mercurial 文件集

hg remove "set:binary()"

正如其他发帖人提到的,在 .hgignore 文件中添加不需要的扩展名是个好主意。

To remove all binary files from a repository, you can use Mercurial filesets:

hg remove "set:binary()"

And as the other posters mentioned, it's a great idea to add unwanted extensions in the .hgignore file.

浪荡不羁 2025-01-14 22:25:50

您应该能够像删除任何其他文件一样删除它们hg remove *.pyc。您可能希望将 .pyc 添加到 .hgignore 文件中,以防止它们在您使用 addremove 时返回。

不过,一般来说,您将来应该使用 hg add 有选择地添加文件,因为随着项目的发展,它包含的文件应该相对较快地稳定下来。

You should be able to remove them like any other file hg remove *.pyc. You probably want to add .pyc to the .hgignore file to keep them from coming back when you use addremove.

In general though, you should be using hg add to selectively add files in the future, given that as the project develops, what files it contains should stabilize relatively quickly.

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