使用 svn delete 后需要立即提交吗?
每次签出后,我的项目中的“build”目录都需要删除并重新创建。 这是我所做的,这是一个漫长而繁琐的过程,并且会创建大量不必要的提交:
$ svn delete build
$ svn commit -m "build directory deleted..." [Unnecessary commit]
$ svn update
$ mkdir build [to create a fresh empty directory of build]
$ cd build [perfom operations in build]
$ svn add build
$ svn commit -m "New revision having following XYZ changes"
问题: 有没有解决方法可以避免删除后的冗余提交?我只想删除“build”目录中与我的项目相关的所有内容,以便我可以创建它们的新版本。按照我认为应该有效的步骤,会出现问题
$ svn delete build
$ rm -r build
$ mkdir build
$ svn add build
$ svn commit -m "New revision having following XYZ changes"
A 'build' directory in my project needs to be deleted and created again after every check out.
Here is what I do which is kind of a long and cumbersome process and creates a large number of unnecessary commits:
$ svn delete build
$ svn commit -m "build directory deleted..." [Unnecessary commit]
$ svn update
$ mkdir build [to create a fresh empty directory of build]
$ cd build [perfom operations in build]
$ svn add build
$ svn commit -m "New revision having following XYZ changes"
Problem:
Is there a workaround to avoid the redundant commit just after delete? I just want to delete everything related to my project inside the 'build' directory to be deleted so that I may create new versions of them. Following steps, which I thought should have worked, give problems
$ svn delete build
$ rm -r build
$ mkdir build
$ svn add build
$ svn commit -m "New revision having following XYZ changes"
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
构建目录不是您通常希望在存储库中出现的内容。理想情况下,您应该做的是 1) 使用 svn:ignore 属性忽略 svn 中的构建目录,2) 使用构建脚本删除或创建构建目录
这样您还可以避免出现任何 (不需要)在您的存储库中提交,这只是创建或删除构建目录。
A build directory is not something you typically want in a repository. What you should ideally be doing is 1) Ignore the build directory from svn using the
svn:ignore
property, 2) remove or create the build directory using your build scriptThis way you will also avoid having any (needless) commits in your repository which just create or remove the build directory.
传统的方法是检查并构建,但不提交生成的构建工件。相反,创建一个标记(在 svn 中,您可以使用 svn cp 执行此操作,通常是标记/_build_id_)。如果您需要跟踪构建所使用的编译器版本等,您可以生成并提交包含必要信息的文本文件。这样,如果需要,您可以 - 至少在理论上 - 重新生成相同的构建。将构建工件复制到单独的存档仍然是一个好主意,但这通常不受版本控制。
The traditional approach is to check out and build, but not commit the resulting build artefacts. Instead, create a tag (in svn, you do this with svn cp, customarily to tags/_build_id_). If you need to keep track of what compiler version etc was used for the build, you can generate and commit a text file with the necessary information. This way, you can - at least in theory - regenerate an identical build if you ever need to. Copying the build artefacts to a separate archive is still a goid idea, but this is usually not kept under version control.
从你的 svn 命令我猜你想提交一个没有本地构建目录的代码版本,然后从 svn 存储库更新(也没有构建目录),但然后重新创建“build”目录并将其保存在存储库。
如果每次“svn update”后必须重新创建构建目录(例如,由于“svn update”而发生某些更改),那么您可以使用 svnignore 来忽略第一次提交时的“build”目录,但无法逃避重新创建它。
如果您可以在“svn update”之后重新使用旧的“build”目录,则可以通过在提交之前/之后设置和重置 svnignore 属性来节省时间:
我还没有尝试过我自己,但它应该有效:)
From your svn commands I guess that you want to commit a version of the code without the local build directory, then update from the svn repo (also without the build dir), but then re-create the "build" directory and save it the repository.
If the build directory must be re-created after each "svn update" (e.g. because something changed due to the "svn update") then you can use the svn ignore to ignore the "build" dir on the first commit, but can't escape re-creating it.
If you can re-use the old "build" directory after the "svn update", you can save time by setting and resetting the svn ignore property before/after the commits:
I haven't tried it myself, but it should work :)