是否有一个版本控制系统可以让我们管理代码的多个并行版本并在运行时在它们之间切换?

发布于 2024-09-07 09:58:14 字数 49 浏览 1 评论 0原文

如果我想首先向已知用户的子集启用一项新功能,是否有任何自动化框架系统可以做到这一点?

If I want to enable a new piece of functionality to a subset of known users first, is there any automated system of framework that exists to do this?

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

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

发布评论

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

评论(5

椒妓 2024-09-14 09:58:14

也许不直接使用版本控制 - 您可能有兴趣阅读 flickr 如何选择性地部署功能: http://code.flickr.com/blog/page/2/

这家伙谈论在 Rails 应用程序中实现类似的东西:http://www.alandelevie.com/2010/05/19/feature-flippers-with-rails/

Perhaps not directly with version control - you might be interested to read how flickr goes about selectively deploying functionality: http://code.flickr.com/blog/page/2/

And this guy talks about implementing something similar in a rails app: http://www.alandelevie.com/2010/05/19/feature-flippers-with-rails/

jJeQQOZ5 2024-09-14 09:58:14

大多数编程语言都有 if 语句。

Most programming languages have if statements.

我一向站在原地 2024-09-14 09:58:14

我不知道“在运行时在它们之间切换”是什么意思。您通常不会将可执行代码签入 SCM 系统。有一个单独的过程来检查、构建、打包和部署。这就是敏捷技术中持续集成和自动化构建的领域。

像 Subversion 这样的 SCM 系统允许您拥有用于并行开发的标签和分支。您始终可以根据自己的需要自由构建、打包和部署这些内容。

I don't know what "switching between them at runtime" means. You usually don't check executable code into an SCM system. There's a separate process to check out, build, package, and deploy. That's the province of continuous integration and automated builds in agile techniques.

SCM systems like Subversion allow you to have tags and branches for parallel development. You're always free to build, package, and deploy those as you see fit.

心碎的声音 2024-09-14 09:58:14

据我所知没有...

如果您想要一个具有多个版本且可以在之间切换的版本控制系统。找到您喜欢的 SCM 并查找分支。

但是,听起来您希望我能够在运行时以编程方式切换 SCM 中的版本。问题是,版本控制系统要想做到这一点,就必须了解语言及其实现方式。

它必须知道如何加载和运行下一个版本。例如,如果它是 C 代码,则必须动态编译并即时运行它。如果是 PHP,则必须神奇地将脚本加载到支持 PHP 的沙箱 http 服务器中。等等...在这种情况下,这是不可能的。

您可以编写一个应用程序来使用命令行更改 scm 中的版本。

要在运行时执行此操作,该功能必须是应用程序本身的一部分。

As far as I know no...

If you wanted a revision control system that had multiple versions that you could switch between. Find a SCM you like and lookup branching.

But, it sounds like you want it to me able to switch versions in the SCM programmatically during runtime. The problem with that is, for a revision control system to be able to do that it would have to be aware of the language and how it's implemented.

It would have to know how load and run the next version. For example, if it was C code it would have to dynamically compile and run it on the fly. If it was PHP it would have to magically load the script in a sandbox http server that has PHP support. Etc... In which case, it isn't possible.

You can write an app to change the version in the scm by using the command line.

To do it during runtime, that functionality has to be part of the application itself.

情痴 2024-09-14 09:58:14

我能想到的最好(唯一)方法是使用一段类似于“引导加载程序”的通用代码,它使用系统调用根据您的要求检查正确的分支。然后(如果需要)它编译该代码并运行它。

从技术上讲,它不是“在运行时”,但如果它有效的话,它看起来就是这样。

您的第一个其他选项是动态加载代码,但这非常依赖于语言,并且您需要指定。

另一种方法是将两者永久保留在工作代码库中(如果是完整重复,则大小会增加一倍),并在运行时进行切换。您可以通过使用两个分支之间共享的对象以及条件编译之类的方法来节省大量空间,以便为两个目标使用相同的源文件。

The best (only) way I can think of doing it is to have one common piece of code that acts like a 'bootloader', which uses a system call to checkout the correct branch based on whatever your requirements are. It then (if necessary) compiles that code, and runs it.

It's not technically 'at runtime', but it appears that way if it works.

Your first other option is something that dynamically loads code, but that's very language-dependent, and you'd need to specify.

The other is to permanently have both in the working codebase (which doubles your size if it's a full duplication), and switch at runtime. You can save a good bit of space by using objects that are shared between both branches, and things like conditional compilation to use the same source files for both targets.

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