Show More
@@ -1029,15 +1029,17 b' class queue(object):' | |||||
1029 | # go backwards with qpush) |
|
1029 | # go backwards with qpush) | |
1030 | if patch: |
|
1030 | if patch: | |
1031 | info = self.isapplied(patch) |
|
1031 | info = self.isapplied(patch) | |
1032 | if info: |
|
1032 | if info and info[0] >= len(self.applied) - 1: | |
1033 | if info[0] < len(self.applied) - 1: |
|
|||
1034 | raise util.Abort( |
|
|||
1035 | _("cannot push to a previous patch: %s") % patch) |
|
|||
1036 | self.ui.warn( |
|
1033 | self.ui.warn( | |
1037 | _('qpush: %s is already at the top\n') % patch) |
|
1034 | _('qpush: %s is already at the top\n') % patch) | |
1038 | return 0 |
|
1035 | return 0 | |
|
1036 | ||||
1039 | pushable, reason = self.pushable(patch) |
|
1037 | pushable, reason = self.pushable(patch) | |
1040 |
if |
|
1038 | if pushable: | |
|
1039 | if self.series.index(patch) < self.series_end(): | |||
|
1040 | raise util.Abort( | |||
|
1041 | _("cannot push to a previous patch: %s") % patch) | |||
|
1042 | else: | |||
1041 | if reason: |
|
1043 | if reason: | |
1042 | reason = _('guarded by %r') % reason |
|
1044 | reason = _('guarded by %r') % reason | |
1043 | else: |
|
1045 | else: |
@@ -88,3 +88,49 b' qpush should fail the same way as below' | |||||
88 | applying patch1 |
|
88 | applying patch1 | |
89 | unable to read patch1 |
|
89 | unable to read patch1 | |
90 | [1] |
|
90 | [1] | |
|
91 | ||||
|
92 | Test qpush to a patch below the currently applied patch. | |||
|
93 | ||||
|
94 | $ hg qq -c guardedseriesorder | |||
|
95 | $ hg qnew a | |||
|
96 | $ hg qguard +block | |||
|
97 | $ hg qnew b | |||
|
98 | $ hg qnew c | |||
|
99 | ||||
|
100 | $ hg qpop -a | |||
|
101 | popping c | |||
|
102 | popping b | |||
|
103 | popping a | |||
|
104 | patch queue now empty | |||
|
105 | ||||
|
106 | try to push and pop while a is guarded | |||
|
107 | ||||
|
108 | $ hg qpush a | |||
|
109 | cannot push 'a' - guarded by ['+block'] | |||
|
110 | [1] | |||
|
111 | $ hg qpush -a | |||
|
112 | applying b | |||
|
113 | patch b is empty | |||
|
114 | applying c | |||
|
115 | patch c is empty | |||
|
116 | now at: c | |||
|
117 | ||||
|
118 | now try it when a is unguarded, and we're at the top of the queue | |||
|
119 | $ hg qsel block | |||
|
120 | number of guarded, applied patches has changed from 1 to 0 | |||
|
121 | $ hg qpush b | |||
|
122 | abort: cannot push to a previous patch: b | |||
|
123 | [255] | |||
|
124 | $ hg qpush a | |||
|
125 | abort: cannot push to a previous patch: a | |||
|
126 | [255] | |||
|
127 | ||||
|
128 | and now we try it one more time with a unguarded, while we're not at the top of the queue | |||
|
129 | ||||
|
130 | $ hg qpop b | |||
|
131 | popping c | |||
|
132 | now at: b | |||
|
133 | $ hg qpush a | |||
|
134 | abort: cannot push to a previous patch: a | |||
|
135 | [255] | |||
|
136 |
General Comments 0
You need to be logged in to leave comments.
Login now