如何防止Subversion合并二进制文件?

时间:2023-01-26 15:15:48

We have the need to keep .dlls in our repository. Our team experiences SVN conflicts on .dll files quite frequently and it is super annoying. For some reason, even though the mime type of the .dlls are set to application/octet-stream, svn is still trying to merge them.

我们需要在我们的存储库中保留.dll。我们的团队经常在.dll文件上遇到SVN冲突,这非常烦人。出于某种原因,即使.dll的mime类型设置为application / octet-stream,svn仍然试图合并它们。

From what I found here (which I swear the way things used to be) it says that as long as the mime type isn't text, svn will not try to merge them. But looking at my dlls tells me that svn is merging my application/octet-stream files too (at least I am assuming SVN is merging, not sure why there would be a conflict without a merge). Why the heck would svn try to merge a binary file? It's just stupid...

从我在这里发现的(我发誓过去的方式)它说,只要mime类型不是文本,svn就不会尝试合并它们。但是看着我的dll告诉我svn也在合并我的应用程序/八位字节流文件(至少我假设SVN正在合并,不确定为什么没有合并就会发生冲突)。为什么hen会尝试合并二进制文件?这只是愚蠢的......

Anyone come across this problem?

有人遇到过这个问题吗?

My aim is to find a solution that allows binary files to be part of the repository, but never be conflicted. I want SVN to just replace with the newest binary and call it good.

我的目标是找到一个解决方案,允许二进制文件成为存储库的一部分,但永远不会发生冲突。我希望SVN只用新的二进制代替,并称之为好。

Please don't discuss why I should or should not be putting binary files in the repository - I have to and don't want conflict problems.

请不要讨论为什么我应该或不应该将二进制文件放在存储库中 - 我必须也不想要冲突问题。

As a FYI: I use both Tortoise 1.5.0 and Ankh.

作为一个FYI:我同时使用Tortoise 1.5.0和Ankh。

5 个解决方案

#1


To make sure that I understand you correctly, let's recapitulate:

为了确保我理解正确,让我们概括一下:

  • you have binary files checked into svn
  • 你有二进制文件检入svn

  • these files can change both client-side and in the repository
  • 这些文件可以在客户端和存储库中进行更改

  • whenever both are changed, the changes from the repository should 'win'
  • 无论何时更改,存储库中的更改都应该“赢”

AFAIK, the svn way to do that would be:

AFAIK,这样做的方法是:

  • run 'svn update --accept theirs-full' on the binary files
  • 在二进制文件上运行'svn update --accept theirs-full'

  • run a regular 'svn update' on the whole local copy
  • 在整个本地副本上运行常规的“svn update”

I do not think this can be done in one command, and I also do not think it should be doable in one command, as that first command can lose valuable data.

我不认为这可以在一个命令中完成,我也不认为它应该在一个命令中可行,因为第一个命令可能会丢失有价值的数据。

#2


If the file was changed on the server and locally you'll obviously get a conflict. Of course updating the working copy includes updating the binary files as they are part of the revisions. This doesn't mean svn tries to merge them, but you'll definitely get a conflict. If those files are changed frequently I guess they are generated frequently -- possibly even compiler output files. Such files should not be in the repository at all.

如果在服务器和本地更改了文件,您显然会发生冲突。当然,更新工作副本包括更新二进制文件,因为它们是修订的一部分。这并不意味着svn尝试合并它们,但你肯定会遇到冲突。如果经常更改这些文件,我猜它们经常生成 - 甚至可能是编译器输出文件。这些文件根本不应该在存储库中。

If you need to archive release binaries (or similar) you should do this on a tag or release branch but not on trunk.

如果需要存档发布二进制文件(或类似文件),则应在标记或发布分支上执行此操作,但不应在主干上执行此操作。

#3


We have the same problem with certain files.

我们对某些文件有同样的问题。

CVS handles this problem very well, but unfortunately my company is moving to Subversion.

CVS很好地处理了这个问题,但不幸的是我的公司正在转向Subversion。

Certain config files are modified by our app everytime you run it, but when the developers check in new changes, we want them to always overite the users repository.

每次运行时,我们的应用程序都会修改某些配置文件,但是当开发人员检查新的更改时,我们希望它们始终覆盖用户存储库。

In the .CVSwrappers file, put *.fileext -k b -m COPY. This tells CVS to always make a backup copy of the file in the local repository and download the new version when there are conflicts. So elegant.

在.CVSwrappers文件中,输入* .fileext -k b -m COPY。这告诉CVS始终在本地存储库中制作文件的备份副本,并在发生冲突时下载新版本。太优雅了。

There is no equivalent setup for SVN. If anyone knows how, please post it.

SVN没有等效的设置。如果有人知道如何,请发布。

#4


Are you sure that it's trying to merge them? It sounds more like you are getting a conflict because subversion doesn't know how to merge them (which you don't want it to do anyway).

你确定它正试图合并它们吗?这听起来更像是你遇到冲突,因为subversion不知道如何合并它们(你不想让它做任何事情)。

What exactly do you want to happen if you have a locally modified dll and someone commits the same dll before you do? What do you expect to happen? This is obviously a conflict and subversion doesn't know if you want it to use your dll or their dll.

如果你有一个本地修改的dll并且有人在你做之前提交相同的dll,你到底想要发生什么?你期望发生什么?这显然是一个冲突,颠覆不知道你是否想要它使用你的DLL或他们的DLL。

#5


These dll files, are they build output from the actual projects?

这些dll文件,它们是否从实际项目中构建输出?

If that's the case, they shouldn't be put in svn at all. Subversion should contain the source files, and a build server / dev box can build the dlls from there.

如果是这样的话,就不应该把它们放在svn中。 Subversion应该包含源文件,构建服务器/ dev框可以从那里构建dll。

#1


To make sure that I understand you correctly, let's recapitulate:

为了确保我理解正确,让我们概括一下:

  • you have binary files checked into svn
  • 你有二进制文件检入svn

  • these files can change both client-side and in the repository
  • 这些文件可以在客户端和存储库中进行更改

  • whenever both are changed, the changes from the repository should 'win'
  • 无论何时更改,存储库中的更改都应该“赢”

AFAIK, the svn way to do that would be:

AFAIK,这样做的方法是:

  • run 'svn update --accept theirs-full' on the binary files
  • 在二进制文件上运行'svn update --accept theirs-full'

  • run a regular 'svn update' on the whole local copy
  • 在整个本地副本上运行常规的“svn update”

I do not think this can be done in one command, and I also do not think it should be doable in one command, as that first command can lose valuable data.

我不认为这可以在一个命令中完成,我也不认为它应该在一个命令中可行,因为第一个命令可能会丢失有价值的数据。

#2


If the file was changed on the server and locally you'll obviously get a conflict. Of course updating the working copy includes updating the binary files as they are part of the revisions. This doesn't mean svn tries to merge them, but you'll definitely get a conflict. If those files are changed frequently I guess they are generated frequently -- possibly even compiler output files. Such files should not be in the repository at all.

如果在服务器和本地更改了文件,您显然会发生冲突。当然,更新工作副本包括更新二进制文件,因为它们是修订的一部分。这并不意味着svn尝试合并它们,但你肯定会遇到冲突。如果经常更改这些文件,我猜它们经常生成 - 甚至可能是编译器输出文件。这些文件根本不应该在存储库中。

If you need to archive release binaries (or similar) you should do this on a tag or release branch but not on trunk.

如果需要存档发布二进制文件(或类似文件),则应在标记或发布分支上执行此操作,但不应在主干上执行此操作。

#3


We have the same problem with certain files.

我们对某些文件有同样的问题。

CVS handles this problem very well, but unfortunately my company is moving to Subversion.

CVS很好地处理了这个问题,但不幸的是我的公司正在转向Subversion。

Certain config files are modified by our app everytime you run it, but when the developers check in new changes, we want them to always overite the users repository.

每次运行时,我们的应用程序都会修改某些配置文件,但是当开发人员检查新的更改时,我们希望它们始终覆盖用户存储库。

In the .CVSwrappers file, put *.fileext -k b -m COPY. This tells CVS to always make a backup copy of the file in the local repository and download the new version when there are conflicts. So elegant.

在.CVSwrappers文件中,输入* .fileext -k b -m COPY。这告诉CVS始终在本地存储库中制作文件的备份副本,并在发生冲突时下载新版本。太优雅了。

There is no equivalent setup for SVN. If anyone knows how, please post it.

SVN没有等效的设置。如果有人知道如何,请发布。

#4


Are you sure that it's trying to merge them? It sounds more like you are getting a conflict because subversion doesn't know how to merge them (which you don't want it to do anyway).

你确定它正试图合并它们吗?这听起来更像是你遇到冲突,因为subversion不知道如何合并它们(你不想让它做任何事情)。

What exactly do you want to happen if you have a locally modified dll and someone commits the same dll before you do? What do you expect to happen? This is obviously a conflict and subversion doesn't know if you want it to use your dll or their dll.

如果你有一个本地修改的dll并且有人在你做之前提交相同的dll,你到底想要发生什么?你期望发生什么?这显然是一个冲突,颠覆不知道你是否想要它使用你的DLL或他们的DLL。

#5


These dll files, are they build output from the actual projects?

这些dll文件,它们是否从实际项目中构建输出?

If that's the case, they shouldn't be put in svn at all. Subversion should contain the source files, and a build server / dev box can build the dlls from there.

如果是这样的话,就不应该把它们放在svn中。 Subversion应该包含源文件,构建服务器/ dev框可以从那里构建dll。