Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/mercurial/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Mercurial 为什么我可以在关闭分支后切换到它?_Mercurial_Dvcs - Fatal编程技术网

Mercurial 为什么我可以在关闭分支后切换到它?

Mercurial 为什么我可以在关闭分支后切换到它?,mercurial,dvcs,Mercurial,Dvcs,今天我发现,即使我关闭了一个分支,我也可以切换回它。为什么? hg init abc cd abc echo 'readme1' > README1.txt hg ci -Am "1st commit" hg branch other-branch echo 'readme2' > README2.txt hg ci -Am "2nd commit" hg update default hg merge other-branch hg ci -m "Merged other-bra

今天我发现,即使我关闭了一个分支,我也可以切换回它。为什么?

hg init abc
cd abc
echo 'readme1' > README1.txt
hg ci -Am "1st commit"
hg branch other-branch
echo 'readme2' > README2.txt
hg ci -Am "2nd commit" 
hg update default
hg merge other-branch
hg ci -m "Merged other-branch into default"
hg update other-branch
hg ci -m "Closing other branch" --close-branch
hg update default
现在我想我不应该这么做了

hg update other-branch
但它工作正常

这使我感到困惑和不安


更新:抱歉,我忘了指出我正在使用HG v.1.6

关闭一个分支主要是因为它不会显示在某些列表中:


正如Amber所说,当你关闭一个分支时,它只记录它已关闭。因此,当您执行“
hg分支
”时,您只会看到“
默认
”,而不会看到“
其他分支

但是,一旦您切换到此分支并提交新内容,它就会自动重新打开它(从而再次出现在“
hg分支
”列表中)。您还可以在完成后重新关闭它

我发现这个特性实际上是可取的:假设您创建了一个分支,以便稳定一些代码以进行交付,只允许在此分支上修复bug。现在在交付之后,您可以关闭稳定分支并在默认情况下再次开发新功能,切换到下一个迭代并准备下一次交付(假设您使用的是scrum)。现在,当三天后,您的配送客户发现问题并要求接收固定配送,而不想等待下一个配送,那么您可以轻松切换到稳定的分支,重现问题,修复问题(重新打开分支),重新部署,最后再次关闭分支。对我来说,这似乎是一个似是而非的情景,也是一个善变的行为

只有我的0.02欧元:-)

干杯,
克里斯托夫

21世纪的文盲不会是那些不会读或写的人;他们将是那些无法学习、忘却和重新学习的人--阿尔文·托夫勒=