Show More
@@ -195,28 +195,6 def foldchanges(ui, repo, node1, node2, | |||
|
195 | 195 | os.unlink(patchfile) |
|
196 | 196 | return files |
|
197 | 197 | |
|
198 | def between(repo, old, new, keep): | |
|
199 | """select and validate the set of revision to edit | |
|
200 | ||
|
201 | When keep is false, the specified set can't have children.""" | |
|
202 | revs = [old] | |
|
203 | current = old | |
|
204 | while current != new: | |
|
205 | ctx = repo[current] | |
|
206 | if not keep and len(ctx.children()) > 1: | |
|
207 | raise util.Abort(_('cannot edit history that would orphan nodes')) | |
|
208 | if len(ctx.parents()) != 1 and ctx.parents()[1] != node.nullid: | |
|
209 | raise util.Abort(_("can't edit history with merges")) | |
|
210 | if not ctx.children(): | |
|
211 | current = new | |
|
212 | else: | |
|
213 | current = ctx.children()[0].node() | |
|
214 | revs.append(current) | |
|
215 | if len(repo[current].children()) and not keep: | |
|
216 | raise util.Abort(_('cannot edit history that would orphan nodes')) | |
|
217 | return revs | |
|
218 | ||
|
219 | ||
|
220 | 198 | def pick(ui, repo, ctx, ha, opts): |
|
221 | 199 | oldctx = repo[ha] |
|
222 | 200 | if oldctx.parents()[0] == ctx: |
@@ -625,6 +603,28 def histedit(ui, repo, *parent, **opts): | |||
|
625 | 603 | os.unlink(repo.sjoin('undo')) |
|
626 | 604 | |
|
627 | 605 | |
|
606 | def between(repo, old, new, keep): | |
|
607 | """select and validate the set of revision to edit | |
|
608 | ||
|
609 | When keep is false, the specified set can't have children.""" | |
|
610 | revs = [old] | |
|
611 | current = old | |
|
612 | while current != new: | |
|
613 | ctx = repo[current] | |
|
614 | if not keep and len(ctx.children()) > 1: | |
|
615 | raise util.Abort(_('cannot edit history that would orphan nodes')) | |
|
616 | if len(ctx.parents()) != 1 and ctx.parents()[1] != node.nullid: | |
|
617 | raise util.Abort(_("can't edit history with merges")) | |
|
618 | if not ctx.children(): | |
|
619 | current = new | |
|
620 | else: | |
|
621 | current = ctx.children()[0].node() | |
|
622 | revs.append(current) | |
|
623 | if len(repo[current].children()) and not keep: | |
|
624 | raise util.Abort(_('cannot edit history that would orphan nodes')) | |
|
625 | return revs | |
|
626 | ||
|
627 | ||
|
628 | 628 | def writestate(repo, parentctxnode, created, replaced, |
|
629 | 629 | tmpnodes, existing, rules, keep, oldtip, replacemap): |
|
630 | 630 | fp = open(os.path.join(repo.path, 'histedit-state'), 'w') |
General Comments 0
You need to be logged in to leave comments.
Login now