防止 SVN 中其他提交者覆盖文件

发布于 2024-12-17 03:41:49 字数 223 浏览 0 评论 0原文

当一位开发人员打开文件 A 并开始编辑它时,就会出现问题。另一位开发人员也已写入文件 A 并提交到主干。

第一个开发人员 svn-updates 和 file-A 现在已在他的工作目录中更新,但他已经开始基于上次修订版处理 file-A 了。如果她保存文件然后提交,它将覆盖其他开发人员所做的所有更改。

在这种情况下,可以采取什么措施来预防呢?有什么好的工作流程吗? DVCS 能否帮助解决此类冲突?

The problem arises when one developer has a file-A open and begins to edit it. Another developer has also written into file-A and committed into trunk.

The first developer svn-updates and file-A is now updated in his working directory but he has already started working on file-A based on the last revision. If she saves the file and then commits, it will overwrite all changes made by the other developer.

In this situation, what can be done to prevent it? Any good workflows? Will a DVCS help resolve this type of conflict?

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

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

发布评论

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

评论(4

枉心 2024-12-24 03:41:49

进行 SVN 更新应该要么优雅地将其他开发人员的更改合并到第一个开发人员的工作副本中,要么应该发出“合并冲突”信号。此时,您可以在提交之前手动解决冲突。

请参阅 http://svnbook。 red-bean.com/en/1.7/svn.tour.cycle.html#svn.tour.cycle.resolve

Doing an SVN update should either gracefully merge the other developer's changes into the first developer's working copy, or it should signal a "merge conflict". At which point you resolve the conflicts manually, before committing.

See http://svnbook.red-bean.com/en/1.7/svn.tour.cycle.html#svn.tour.cycle.resolve.

清泪尽 2024-12-24 03:41:49

您在每个文件属性上设置需要锁定。这迫使每个开发人员在编辑文件之前锁定文件。

这通常不是您想要的工作方式,但如果您的开发过程需要它,那就去做吧。

You set requires-lock on each files properties. This forces each developer to lock the file before editing it.

It's normally not they way you wanna work but if you development process requires it then go for it.

韵柒 2024-12-24 03:41:49

只要您在更新之前将文件保存在工作目录中,那么您就不会遇到您所描述的问题。

我认为您应该能够通过执行以下操作将本地目录回滚到以前的版本:

svn update -r [版本号]

然后保存您正在编辑的文件,然后执行以下操作:

svn更新

然后应该合并更改或提示您本地目录中存在冲突。

一旦解决了冲突(如果有),您就可以提交回存储库。

As long as you save the files in your working directory before doing an update to it then you won't have the problem you are describing.

I would think you should be able to roll back your local directory to the previous version by doing a:

svn update -r [revision_number]

Then saving the file you are editing, then doing a:

svn update

which should then either merge in the changes or prompt you that there is a conflict in the local directory.

Once you resolve the conflict (if there is one) you can commit back to the repo.

萌能量女王 2024-12-24 03:41:49

遇到这种情况,可以采取什么措施来预防呢?有什么好的工作流程吗?

只是合理工作流程:

  • 不更新WC不保存您的编辑
  • 使用好的编辑器,如果文件发生更改,它会自动重新加载打开的文件在后台(丢失更改教导“经常保存,更新前保存”非常快)

In this situation, what can be done to prevent it? Any good workflows?

Just rational workflow:

  • Do not update the WC without saving your edits
  • Use good editor, which auto-reload opened file, if it was was changed in background (losing changes teach "Save often, save before update" extremely fast)
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文