Mercurialã§ãã©ã³ãåãå¤æ´ããæ¹æ³
ããã«ã±
@nakayoshixããã«ãdefaultãã©ã³ãã§ä½æ¥ãããªãã¸ã§ã³ç¾¤ã«å¾ãããã©ã³ãåãæå®ãããå ´åã«ã©ãããã°ããã®ãã
ã¨èãããã®ã§ããã®å ´ã§ã¯æãã¤ããªãã£ããã ãã©ãå·éã«èããã¨ç°¡åã«ã§ããã®ã§æ¸ãã¦ããã¾ãã
hgã®rebaseã¯ãå
ã®ãã©ã³ãåãä¿æããããããã¯ã移åå
ãªãã¸ã§ã³ã®ãã©ã³ãåã使ããã®ã©ã¡ããããããã¾ããã
ä»åã¯ãæ°ãããã©ã³ãåã使ããããã¨ããã±ã¼ã¹ã§ãã
æ¹é
ã§ãä»åã®è§£æ±ºæ¹æ³ã¯æ°ãããã©ã³ããã¤ãã£ã¦ãããããã«rebaseãã¦ããã©ã³ããã¤ããããã ãã®ã³ãããã®ã¿ãå¾ããåé¤ããã
ã¨ããæ¹éã§ãã
ãã£ã¨ã¯ã¼ã«ãªæ¹æ³ãããã¨æãã®ã§ããããã£ããæãã¦ãã ããã
è£è¶³ã¨ãã¦ããã§ä½¿ç¨ãã¦ããæ¡å¼µã®rebaseã¨histeditã¯æ¬¡ã®ããã«è¨å®ãã¾ãã
次ã®ããã«~/.hgrc ã«è¿½è¨ãã¾ãã(Windowsã ã£ããMecurial.iniããã
[extensions]
rebase =
histedit =/Users/kyon/mercurial_extensions/histedit/hg_histedit.py
histeditã¯durin42 / histedit / source / — Bitbucketãããã¦ã³ãã¼ããã¦ããhg_histedit.pyã®çµ¶å¯¾ãã¹ãæå®ãã¾ãã
æé
ç¶æ³ã¨ãã¦ã¯æ¬¡ã®æã
@ 5:default
task/2ã®ãã©ã³ããä½æãå¿ããã¾ã¾ä½æ¥ o 4:default
task/2ã®ãã©ã³ããä½æãå¿ãã¦ä½æ¥éå§ o 3:task/1 task/1ã§ã®ä½æ¥ãç¶ç¶ o 2:task/1 / task/1ã§ã®ä½æ¥ãéå§ o 1:default
ããã¾ã§ã¯defaultãã©ã³ãã§ã®ä½æ¥ o 0:default
defaultãã©ã³ãã§ä½æ¥éå§
ããã§
hg update 1 ã¨ãã¦ã
o 5:default
task/2ã®ãã©ã³ããä½æãå¿ããã¾ã¾ä½æ¥ o 4:default
task/2ã®ãã©ã³ããä½æãå¿ãã¦ä½æ¥éå§ o 3:task/1 task/1ã§ã®ä½æ¥ãç¶ç¶ o 2:task/1 / task/1ã§ã®ä½æ¥ãéå§ @ 1:default
ããã¾ã§ã¯defaultãã©ã³ãã§ã®ä½æ¥ o 0:default
defaultãã©ã³ãã§ä½æ¥éå§
ããã§task/2ã®ãã©ã³ããä½æãã
hg branch task/2
ããã¦ããã®ãã©ã³ããéå§ããããã®ã³ãããããã(æåãã©ã³ããä½æããå ´åã¯ã管ç対象ã«å¤æ´ããªãã¦ãã³ãããã§ãã)
hg ci -m "task/2ãã©ã³ããä½æããããã ãã®ã³ããã"
@ 6:task/2
task/2ãã©ã³ããä½æããããã ãã®ã³ããã o 5:default task/2ã®ãã©ã³ããä½æãå¿ããã¾ã¾ä½æ¥ o 4:default / task/2ã®ãã©ã³ããä½æãå¿ãã¦ä½æ¥éå§ o 3:task/1 task/1ã§ã®ä½æ¥ãç¶ç¶ o 2:task/1 / task/1ã§ã®ä½æ¥ãéå§ o 1:default
ããã¾ã§ã¯defaultãã©ã³ãã§ã®ä½æ¥ o 0:default
defaultãã©ã³ãã§ä½æ¥éå§
ããã§ãrevision4,5ãtask/2ãã©ã³ãã¨ãã¦ç§»åãã
hg rebase -d 6 -s 4
@ 6:task/2
task/2ã®ãã©ã³ããä½æãå¿ããã¾ã¾ä½æ¥ o 5:task/2
task/2ã®ãã©ã³ããä½æãå¿ãã¦ä½æ¥éå§ o 4:task/2
task/2ãã©ã³ããä½æããããã ãã®ã³ããã o 3:task/1 task/1ã§ã®ä½æ¥ãç¶ç¶ o 2:task/1 / task/1ã§ã®ä½æ¥ãéå§ o 1:default
ããã¾ã§ã¯defaultãã©ã³ãã§ã®ä½æ¥ o 0:default
defaultãã©ã³ãã§ä½æ¥éå§
@nakayoshixãããããã¾ã§ã¯ã§ãã¦ãã¦ãåé¡ã¯åå¨ãã¦ããªãã£ãrev4(task/2ãã©ã³ããä½æããããã ãã®ã³ããã)ãåå¨ãã¦ãããã¨ã§ããã
ããã§histeditã使ç¨ãã¦ãrevision4ãåé¤ããã
hg histedit 4
ããããã¨ãããã¹ãã¨ãã£ã¿ãéãã¦ãrevision4,5,6ã®é çªãå¤ããããã³ãããããããªãããããåé¤åºæ¥ããããã
詳細ã¯å®éã«histeditãå©ãã¦ã»ããã
èµ·åããããã¹ãã¨ãã£ã¿ã®ã³ã¡ã³ãã«ã©ã®ãããªãã¨ãã§ããã説æãããã¾ãã
ããã§ãrevision4ã®ã¿ãåé¤å¯¾è±¡ã«ãã¦ãããã¹ãã¨ãã£ã¿ã§ä¿åããã¦éããã¨ãrevision4ã®ã¿ãåé¤ãããç¶æ
ã«ãªãã¾ãã
@ 5:task/2
task/2ã®ãã©ã³ããä½æãå¿ããã¾ã¾ä½æ¥ o 4:task/2
task/2ã®ãã©ã³ããä½æãå¿ãã¦ä½æ¥éå§ o 3:task/1 task/1ã§ã®ä½æ¥ãç¶ç¶ o 2:task/1 / task/1ã§ã®ä½æ¥ãéå§ o 1:default
ããã¾ã§ã¯defaultãã©ã³ãã§ã®ä½æ¥ o 0:default
defaultãã©ã³ãã§ä½æ¥éå§
ããã§è§£æ¶ã§ããã
ã¾ã¨ã
ãdefaultãã©ã³ãã§ã®ä½æ¥ã¯ãããªãããã«commitãç¦æ¢ããããã¨ããã§ãããã ãããã©ã
ä»åã®ã±ã¼ã¹ã¯ãã¾ãã¾defaultãã©ã³ãã ã£ãã ãã§ããtask/1ãã©ã³ãã§ä½æ¥ãã¦ãã¾ã£ããã©ãå®ã¯defaultããæ´¾çãããtask/2ã§éå§ãã¹ãã ã£ããã¨ãããã£ã¦ããã®å ´åã«ãåãæé ã§è§£æ¶ã§ãã¾ãã
èªåã§ä½æ¥ãã¦ããã¨ãã«ãã©ã³ãã®ç§»åã¯çµæ§èªååãã¦ãã¾ã£ã¦ãããã¨ãããã®ã§ãä»åã®ãããªäºè±¡ã«åºä¼ããªãã£ãã®ã§ããããªãã»ã©ã¼ãã£ã¦æãã§ããã
histeditã¨rebaseã¨collapseãããã°ã ãããã§ããã