1150 stabilized on top of pctx or one of its descendants. None if none |
1150 stabilized on top of pctx or one of its descendants. None if none |
1151 can be found. |
1151 can be found. |
1152 """ |
1152 """ |
1153 def selfanddescendants(repo, pctx): |
1153 def selfanddescendants(repo, pctx): |
1154 yield pctx |
1154 yield pctx |
|
1155 for prec in repo.set('allprecursors(%d)', pctx): |
|
1156 yield prec |
1155 for ctx in pctx.descendants(): |
1157 for ctx in pctx.descendants(): |
1156 yield ctx |
1158 yield ctx |
|
1159 for prec in repo.set('allprecursors(%d)', ctx): |
|
1160 yield prec |
1157 |
1161 |
1158 # Look for an unstable which can be stabilized as a child of |
1162 # Look for an unstable which can be stabilized as a child of |
1159 # node. The unstable must be a child of one of node predecessors. |
1163 # node. The unstable must be a child of one of node predecessors. |
1160 for ctx in selfanddescendants(repo, pctx): |
1164 for ctx in selfanddescendants(repo, pctx): |
1161 unstables = list(repo.set('unstable() and children(allprecursors(%d))', |
1165 for child in ctx.children(): |
1162 ctx.rev())) |
1166 if child.unstable(): |
1163 if unstables: |
1167 return child |
1164 return unstables[0] |
|
1165 return None |
1168 return None |
1166 |
1169 |
1167 def _solveunstable(ui, repo, orig, dryrun=False): |
1170 def _solveunstable(ui, repo, orig, dryrun=False): |
1168 """Stabilize a unstable changeset""" |
1171 """Stabilize a unstable changeset""" |
1169 obs = orig.parents()[0] |
1172 obs = orig.parents()[0] |
1170 if not obs.obsolete(): |
1173 if not obs.obsolete(): |
|
1174 print obs.rev(), orig.parents() |
|
1175 print orig.rev() |
1171 obs = orig.parents()[1] |
1176 obs = orig.parents()[1] |
1172 assert obs.obsolete() |
1177 assert obs.obsolete() |
1173 newer = successorssets(repo, obs.node()) |
1178 newer = successorssets(repo, obs.node()) |
1174 # search of a parent which is not killed |
1179 # search of a parent which is not killed |
1175 while not newer or newer == [()]: |
1180 while not newer or newer == [()]: |