Mercurial - 如何推送未完成的分支?
我们将所有来自 CVS 的内容都转换为 Mercurial,到目前为止一切顺利。我们今天遇到的一个问题就是这种情况。
在迁移到 Mercurial 之前,我不久前有一些未决的更改,这些功能已经启动,后来由于各种原因被推迟。很可能其他人会在几个月后从我停下来的地方完成这些功能。
克隆新的 Mercurial 存储库后,我创建了单独的分支来隔离这些功能。
它给我留下了这样的东西(编造的版本号)
hg update default
hg branch feature1
hg commit -m "Description of what I was doing in feature1"
hg update default
hg branch feature2
hg commit -m "Description of what I was doing feature2" (my tip is now here)
hg update default
hg push -f (to force the creation of my new branches, w/o affecting default, I haven't merged them)
在此期间,团队一直在工作并推送到我们的中央存储库,因此默认分支是版本 40(提示)
现在我的 push -f工作正常,但定位(提示)到我的最新更改 -> 50:特征3(提示)。我希望该提示保留在中央存储库中的默认状态,并且只需将我的分支放在那里,以便有人随时可以拿起它们。当我使用 hgwebdir 时,该图看起来也很有趣,所以我很确定这是错误的方法。
我该怎么做?我应该先关闭分行吗?提示实际上很重要还是只是元数据。
We converted everything to Mercurial coming from CVS and so far so good. An issue we encountered today though is this situation.
Before the move to Mercurial I had a few pending changes from a while back, features that were started and later postponed for various reason. Odds are that someone else will finish those features months from now picking up from where I left off.
After cloning the new Mercurial repository I created separate branches to isolate those features.
It left me with something like this (made up rev. number)
hg update default
hg branch feature1
hg commit -m "Description of what I was doing in feature1"
hg update default
hg branch feature2
hg commit -m "Description of what I was doing feature2" (my tip is now here)
hg update default
hg push -f (to force the creation of my new branches, w/o affecting default, I haven't merged them)
During this the team have been working and pushing to our central repository so the default branch is say rev 40 (tip)
Now my push -f worked fine but positioned (tip) to my latest change -> 50:feature3 (tip). I was expecting the tip to stay at default on the central repository and just have my branches in there for someone to pick them up whenever. The graph also looks pretty funny when I use hgwebdir so I am pretty sure that's the wrong approach.
How would I do this? Should I close the branch first? Is tip actually important or just meta-data.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
tip
始终是添加到存储库的最新变更集。来自hg help revs
:只要默认分支的头是您所期望的,就可以了。无需关闭分支(但如果您的 Mercurial 版本足够新以支持它,最好使用
hg push --new-branch
)。tip
is always the most recent changeset added to the repository. Fromhg help revs
:So long as the head of the default branch is what you expect, you'll be OK. No need to close the branch (but it's better to use
hg push --new-branch
if your version of Mercurial is new enough to support it).tip
只是一个自动应用的标签,指的是(我认为)最近的提交。没什么大不了的;它只是为了方便而存在。tip
is just an automatically-applied label referring to (I think) the most recent commit. Not a big deal; it's just there for convenience.tip
标签是纯元数据,并且始终指向具有最高修订号的变更集——没有比这更多的逻辑了。然而,
tip
现在指向功能分支上的变更集这一事实不会给您带来任何麻烦。当人们进行克隆时,它们将自动更新到默认
分支上的最尖端变更集。这样他们就可以在克隆后立即开始工作。此外,已经拥有克隆的人在运行hg update
时将保留在其指定分支上。这里,hg update
将带您到该命名分支上最尖端的变更集,例如,在default
上(如果这是您开始的位置)。人们可能认为
hg update Tip
与hg update
相同,但这只是在没有命名分支在起作用的情况下。对于命名分支,给出明确的修订名称(例如tip
)可以更改您的命名分支,而普通的hg update
则不能。The
tip
label is pure meta-data and always points to the changeset with the highest revision number -- there is no more logic than that.However, the fact that
tip
now points to a changeset on the feature branch wont cause you any trouble. When people make a clone, they will automatically be updated to the tip-most changeset on thedefault
branch. So they can begin working right away after a clone. Furthermore, people who already have a clone will stay on their named branch when they runhg update
. Herehg update
takes you to the tip-most changeset on that named branch, e.g., ondefault
if that is where you started.People may think that
hg update tip
is the same ashg update
, but that is only when there are no named branches at play. With named branches, giving an explicit revision name such astip
can changeset your named branch -- a plainhg update
cannot.