svn:将主干与没有版本控制历史的文件合并

发布于 2024-10-18 01:31:55 字数 910 浏览 2 评论 0原文

我正在开发一个版本控制方面组织不太好的项目。我在版本控制(svn)下有我自己的程序版本;然而,我的老板不使用版本控制,因此没有共享存储库。他对他的程序版本做了一些更改,现在他要求我将这些更改合并到我的版本中 - 手动执行会非常麻烦,所以我想也许我可以将他的所有文件保存为我工作的一个分支,然后让svn 进行合并(我以前从未合并过任何东西,恐怕我实际上对 svn 不太了解......)。问题是 svn 似乎所做的只是复制我老板添加到他的版本中的文件,但似乎没有对他在他的程序版本中更改的源代码文件的副本进行任何更改。

好吧,这就是我所做的(按照在线教程):

  1. 我检查了主干的新工作副本和新创建的分支之一(其中包含我刚刚从老板的目录复制的文件)。我认为这可能比只使用我通常使用的工作副本更安全,因为我真的不知道我在做什么......
  2. cd'ed进入我新创建的主干工作副本;我在那里输入了

svn 合并文件:///home/user/svn/repository/branches/the_new_branch

我得到了这个输出:

--- Merging r8 through r27 into '.': 
   C macro/forall.mcr
A    macro/upscale.mcr
   C macro/sbond.mcr
...
Summary of conflicts:
  Tree conflicts: 429

现在我想知道是否/如何获得已执行的确切更改的摘要(例如源代码的哪些行 - 如果有 - 已更改),并且仅在以防万一添加了以前不存在的文件,我如何让 svn 也检查文件的内容并在该级别上执行合并。

如果这里有人能帮助我那就太好了,所以提前非常感谢!

编辑:我正在使用Linux。

I am working on a version control-wise not terribly well-organized project. I have my own version of our program under version control (svn); my boss, however, does not use version control, thus there is no shared repository. He made several changes to his version of the program, and now he asked me to incorporate those changes into my version - doing it manually would be extremely cumbersome, so I thought perhaps I could save all his files as a branch of my work and let svn do the merging (I have never merged anything before, I don't actually know much about svn I'm afraid...). The trouble is that all svn seems to have done is copying the files my boss added to his version, but no changes seem to have been made to my copies of the source code files which he had changed in his version of the program.

Well, here's what I did (following an online tutorial):

  1. I checked out a new working copy of my trunk and one of the newly created branch (that contains the files which I had just copied from my boss' directory). I thought perhaps this would be safer than just working with the working copy that I normally use, as I didn't really know what I was doing...
  2. I cd'ed into my newly created trunk working copy; there I entered


svn merge file:///home/user/svn/repository/branches/the_new_branch

I got this output:

--- Merging r8 through r27 into '.': 
   C macro/forall.mcr
A    macro/upscale.mcr
   C macro/sbond.mcr
...
Summary of conflicts:
  Tree conflicts: 429

Now I would like to know if/how I can get a summary of what exact changes have been performed (e.g. what lines of source code - if any - have been changed), and in case only files were added that had not been there before, how I can get svn to also examine the files' contents and perform merges on that level as well.

In case anyone on here could help me out that would be great, so thanks a lot in advance!

EDIT: I'm using Linux.

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

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

发布评论

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

评论(2

柠檬色的秋千 2024-10-25 01:31:55

回想起来:如果使用 Windows,使用 WinMerge 进行手动合并可能是您的最佳选择。

下次:

  • 签出本地副本,将其称为“Boss”,
  • 从“Boss”导出,并给他该源,
  • 继续处理您自己签出的副本
  • 当 boss 更改完成后,
  • ,将其复制到 Boss更新“Boss”
  • 签入'老板,

你就完成了。

in retrospect: If using Windows, a manual merge using WinMerge may be your best bet.

Next Time:

  • check out a local copy, call it 'Boss'
  • export from 'Boss' and give him that source
  • keep working on your own checked out copy
  • when the bosses changes are done, copy them over the Boss
  • update 'Boss'
  • checkin 'Boss'

And you're done.

谁的新欢旧爱 2024-10-25 01:31:55

我会像你的老板创建了一个功能分支一样,然后将此功能分支合并到你的主干中:

尝试查找你的老板从哪个版本的主干开始进行更改(假设它是修订版 1000)。

然后从此修订版本创建一个分支,并将工作副本切换到该分支。

现在,将此工作副本中的文件替换为您老板项目中的文件。您可以使用 WinMerge 或等效程序递归地比较目录并查找哪些文件是新的、修改的、删除的或未更改的。

将更改提交到分支。

然后,从主干到分支的更改从 1000 开始合并到 HEAD。这是您必须解决冲突的地方。完成后,功能分支包含老板的所有更改,并且与主干保持同步。

现在你可以将功能分支重新集成到主干中,并威胁你的老板如果他继续不使用版本控制就杀了他。

I would do as if your boss had made a feature-branch, and then merge this feature branch to your trunk :

Try to find from which revision of you trunk your boss started making changes (lets' say it's revision 1000).

Then create a branch from this revision, and switch your working copy to that branch.

Now replace the files in this working copy by the files in your boss's project. You could use WinMerge or an equivalent program to compere the directories recursively and find which files are new, modified, deleted or unchanged.

Commit the changes to the branch.

Then, merge the changes from trunk to branch, starting at 1000, to HEAD. This is where you'll have to resolve conflicts. Once it's done, the feature branch contains all your boss's changes and is up to date with the trunk.

Now you can reintegrate the feature branch into the trunk, and threaten your boss to kill him if he continues not using revision control.

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