合并集市中的两个结账

发布于 2024-07-29 01:33:09 字数 740 浏览 5 评论 0原文

我刚刚开始使用 bazaar,我发现结帐功能对我的工作方式最有用 - 即我可以从“主副本”c/o,进行一些开发,然后提交我的更改新目录。 然后更新“主副本”。

但是,如果我正在处理(例如)两个项目,更改代码的不同部分怎么办? 说:

~/master                - master copy
bzr co master ./gui
bzr co master ./engine

所以我在 ./gui 目录中做与 gui 相关的事情,在 ./engine 中做底层的事情。 我应该如何提交更改? 如果我先提交gui,然后提交引擎,我想任何冲突都会在引擎中标记出来?

有没有一种方法可以合并 gui 和引擎,然后只对主副本进行一次提交?

让事情变得更复杂一点,如果我这样做怎么样:

bzr branch gui ./mouse

现在我也许一直在研究鼠标,但也在研究图形用户界面。 如果我想合并来自 gui 和鼠标的代码,然后提交给 master,管理这个的最佳方法是什么? 或者事实上,如果我也:

bzr branch gui ./keyboard

如果我改变了图形用户界面,键盘和鼠标,我应该分层合并 - 即鼠标+键盘,然后将其与图形用户界面合并,然后将图形用户界面提交给master?

我希望我想要实现的目标很清楚! 在此先感谢您的时间。

I'm just starting out with bazaar, and I've found that the checkout feature is the most useful for the way I work - namely I can c/o from a "master copy", do some development and then commit my changes in the new directory. This then updates the "master copy".

But what if I'm working on (eg) two projects, changing different portions of code? Say:

~/master                - master copy
bzr co master ./gui
bzr co master ./engine

So I'm doing gui-related stuff in the ./gui directory and under-the-hood stuff in ./engine. How should I commit my changes? If I commit gui first, then engine, I guess any conflicts will be flagged in engine?

Is there a way to merge gui and engine, and then do just one commit to the master copy?

To make things a little more complicated, how about if I do this:

bzr branch gui ./mouse

Now I perhaps I've been working on mouse, but also on gui. If I want to merge the code from gui AND mouse, and then commit to master, what is the best way to manage this? Or indeed, if I also:

bzr branch gui ./keyboard

If I've changed altered gui, keyboard and mouse, should I hierarchically merge - ie mouse+keyboard, then merge this with gui, then commit gui to master?

I hope it is clear what I'm trying to achieve! Thanks in advance for your time.

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

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

发布评论

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

评论(2

相对绾红妆 2024-08-05 01:33:09

如果您有两个签出,则每当您对其中一个提交更改时,您都必须首先从另一个签出中拉取任何更改,这可能需要在每个步骤中解决冲突。 这通常是一个好主意,因为随着时间的推移,更容易解决冲突并确保您的代码不会有太大分歧。

然而,听起来您希望让单独的开发人员处理“gui”和“engine”,或者您只想保存冲突解决方案,直到两个分支的开发完成。 在这种情况下,您可能应该使用“bzr分支”将它们创建为独立分支。 每个分支都可以使用本地提交,不用担心彼此冲突。 然后,当需要合并时,您可以通过 3 种方法之一进行操作,所有这些方法都会得到相同的最终结果:

1. 将一个分支合并到另一个分支,然后将其推送到 master:

cd gui
bzr merge ../engine
# manually fix any conflicts
bzr commit
bzr push #back up to main

上述方法的缺点是,您的“gui”分支现在有“engine”更改。 如果您打算在将两个分支推回主线后将其丢弃,那么这很好。 但如果你想让分支保持更长的时间,你可以:

2. 合并到主线:

cd master
bzr merge ../gui
bzr commit
bzr merge ../engine
# manually fix conflicts
bzr commit

这样做的好处是你仍然有“gui”和“engine”作为单独的分支,但你之前必须提交一个到 master你确信他们会一起工作。 所以你真的可能想要:

3. 创建一个合并分支:

bzr branch ~/master gui-engine-merge
cd gui-engine-merge
bzr merge ../gui
bzr commit
bzr merge ../engine
# manually fix conflicts
bzr commit
bzr push ~/master
# since this branch was only for merging, you don't need it anymore:
cd ..
rm -r gui-engine-merge

If you have two checkouts, any time you commit changes to one, you will first have to pull down any changes from the other one, potentially having to resolve conflicts at each step. This is generally a good idea, since it's easier to resolve conflicts over time and make sure your code doesn't diverge too much.

However, it sounds like you want to have separate developers working on "gui" and "engine", or you just want to save your conflict resolution till development on both branches has completed. In this case, you should probably create them as independent branches with "bzr branch". Each branch can use local commits and not worry about conflicts with each other. Then when it comes time to merge you can do it one of 3 ways, all of which get the same end result:

1. Merge one branch into the other, then push it up to master:

cd gui
bzr merge ../engine
# manually fix any conflicts
bzr commit
bzr push #back up to main

The downside to the above method is that your "gui" branch now has the "engine" changes in it. Which is fine if you're going to throw away both branches once they're pushed back into the mainline. But if you want to keep the branches longer, you can:

2. Merge into the mainline:

cd master
bzr merge ../gui
bzr commit
bzr merge ../engine
# manually fix conflicts
bzr commit

This has the upside that you still have "gui" and "engine" as separate branches, but you've had to commit one to master before you were sure that they would both work together. So you really probably want to:

3. Create a merge branch:

bzr branch ~/master gui-engine-merge
cd gui-engine-merge
bzr merge ../gui
bzr commit
bzr merge ../engine
# manually fix conflicts
bzr commit
bzr push ~/master
# since this branch was only for merging, you don't need it anymore:
cd ..
rm -r gui-engine-merge
妖妓 2024-08-05 01:33:09

是的,如果 bzr 检测到冲突,它应该阻止您从引擎存储库中签入更改。 通常,您首先在登记之前执行“bzr up”,然后确保您的东西与其他人兼容。

至于你的问题的第二部分,处理鼠标/键盘分支,这就是我通常会这样做的。 只需 cd 进入 gui 目录,然后执行以下操作:

bzr merge ../mouse

合并更改后,您可以从 gui 目录提交,它会将更改集发送到“master”目录。

请注意,我算不上 bzr 专家,但这是我处理 SVN 存储库的方式。

Yes, bzr should prevent you from checking in changes from the engine repo if it detects conflicts. Normally, you first do "bzr up" just prior to check-in and then make sure your stuff plays nice with others.

As for the second part of your question, dealing with mouse/keyboard branches, this is how I would normally do it. Simply cd into the gui dir, and then do:

bzr merge ../mouse

After merging the changes, you can then commit from the gui directory and it will send the changeset to the "master" directory.

Note that I'm hardly a bzr expert, but this is the way I've been dealing with SVN repos.

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