Show More
@@ -1061,15 +1061,17 b' class queue(object):' | |||
|
1061 | 1061 | # go backwards with qpush) |
|
1062 | 1062 | if patch: |
|
1063 | 1063 | info = self.isapplied(patch) |
|
1064 | if info: | |
|
1065 | if info[0] < len(self.applied) - 1: | |
|
1066 | raise util.Abort( | |
|
1067 | _("cannot push to a previous patch: %s") % patch) | |
|
1064 | if info and info[0] >= len(self.applied) - 1: | |
|
1068 | 1065 | self.ui.warn( |
|
1069 | 1066 | _('qpush: %s is already at the top\n') % patch) |
|
1070 | 1067 | return 0 |
|
1068 | ||
|
1071 | 1069 | pushable, reason = self.pushable(patch) |
|
1072 |
if |
|
|
1070 | if pushable: | |
|
1071 | if self.series.index(patch) < self.series_end(): | |
|
1072 | raise util.Abort( | |
|
1073 | _("cannot push to a previous patch: %s") % patch) | |
|
1074 | else: | |
|
1073 | 1075 | if reason: |
|
1074 | 1076 | reason = _('guarded by %r') % reason |
|
1075 | 1077 | else: |
@@ -88,3 +88,49 b' qpush should fail the same way as below' | |||
|
88 | 88 | applying patch1 |
|
89 | 89 | unable to read patch1 |
|
90 | 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