How to push just one specific patch in Mercurial Queues?

自古美人都是妖i 提交于 2019-12-04 05:04:12

问题


This is what I did :

hg init
hg qnew -m "p1" p1.patch
; some changes
hg qrefresh
hg qpop
hg qnew -m "p2" p2.patch
; some changes
hg qrefresh
hg qpop

Now those 2 patches were separate features and have nothing to do with each other. They need to be independent of each other.

Now I do (because I want only the 1st feature)

hg qpush p1.patch

It says :

applying p2.patch
applying p1.patch

and it gives me both the changes I made !

Am I doing something wrong?

It pushes other patches also when I tell it to push a specific patch.


回答1:


You forgot one thing: set of MQ-patches is queue (FIFO queue). I.e if you can see more than one patch in hg qseries, you have to remember - qpush|qpop will apply|unapply patches not in random order, but in sequential order: push from bottom to top, pop in reverse order

Random access (and changing order of patches in a series as side effect) is --move option for qpush. In your case (using only one patch at a time) and patches names

  • hg qpop -a
  • hg qpush --move p1.patch
  • hg qpop -a
  • hg qpush --move p2.patch

In order to avoid mistakes you can redefine qpush (for this repository) in aliases section for always use --move option



来源:https://stackoverflow.com/questions/16111090/how-to-push-just-one-specific-patch-in-mercurial-queues

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!