简体   繁体   English

自定义开源项目的源代码控制的最佳实践

[英]Best practice for source control of a customized Open Source project

I have been using an open source Java project and had to make some custom changes for our site. 我一直在使用开源Java项目,不得不为我们的网站进行一些自定义更改。 I have downloaded the source code via Subversion, modified two files and built a custom JAR file. 我已经通过Subversion下载了源代码,修改了两个文件并构建了一个自定义JAR文件。 Now I need to store these custom changes into OUR Subversion source control system. 现在我需要将这些自定义更改存储到OUR Subversion源代码控制系统中。 What is the best way to do this? 做这个的最好方式是什么?

Should I check the entire tagged version of the open source code into our system and then create a branch with our change in it? 我应该将开源代码的完整标记版本检查到我们的系统中,然后创建一个包含我们更改的分支吗? Or should I just check-in our custom files and rely on the open source tagged version to always be around? 或者我应该只是签入我们的自定义文件并依赖开源标记版本来永远存在? Or perhaps something else altogether? 或者其他一些东西呢?

Take a good look at Subversion vendor branches , which are meant for "maintain[ing] custom modifications to third-party data in your own version control system". 仔细查看Subversion 供应商分支 ,这些分支用于“在您自己的版本控制系统中维护对第三方数据的自定义修改”。 This sounds like exactly what you want. 这听起来就像你想要的。 You would create a vendor branch for the open source Java project in your main repo (from their last SVN revision before your modifications). 您将在主仓库中为开源Java项目创建供应商分支(在修改之前从他们上一个SVN修订版开始)。 Then, check in your modifications. 然后,检查您的修改。 In the future, you can merge in upstream changes. 将来,您可以合并上游更改。

The Subversion book is free and available online , with a section devoted to choosing a repository layout . Subversion书籍是免费的, 可在线获取 ,其中一节专门用于选择存储库布局

the Subversion community recommends that you choose a repository location for each project root—the “topmost” directory that contains data related to that project—and then create three subdirectories beneath that root: trunk, meaning the directory under which the main project development occurs; Subversion社区建议您为每个项目根目录选择一个存储库位置 - 包含与该项目相关的数据的“最顶层”目录 - 然后在该根目录下创建三个子目录:trunk,表示主项目开发所在的目录; branches, which is a directory in which to create various named branches of the main development line; branches,这是一个创建主开发线的各种命名分支的目录; and tags, which is a collection of tree snapshots that are created, and perhaps destroyed, but never changed. 和标记,它是创建的树快照的集合,可能已被破坏,但从未更改过。

I'm happy to elaborate if you are having trouble determining what exactly this means for your project. 如果您无法确定这对您的项目意味着什么,我很高兴详细说明。

First try to avoid this as long as you can, if it is possible try to get your changes into the open-source project (less work for your self in the future...) 首先尝试尽可能避免这种情况,如果有可能尝试将您的更改纳入开源项目(将来为您自己的工作减少......)

But if that was not a option, I would follow Matthew Flaschen advice about vendor branches. 但如果那不是一个选择,我会跟随Matthew Flaschen关于供应商分支的建议。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM