1352 |
1352 |
1353 def between(repo, old, new, keep): |
1353 def between(repo, old, new, keep): |
1354 """select and validate the set of revision to edit |
1354 """select and validate the set of revision to edit |
1355 |
1355 |
1356 When keep is false, the specified set can't have children.""" |
1356 When keep is false, the specified set can't have children.""" |
1357 ctxs = list(repo.set('%n::%n', old, new)) |
1357 revs = repo.revs('%n::%n', old, new) |
1358 if ctxs and not keep: |
1358 if revs and not keep: |
1359 revs = [ctx.rev() for ctx in ctxs] |
|
1360 if (not obsolete.isenabled(repo, obsolete.allowunstableopt) and |
1359 if (not obsolete.isenabled(repo, obsolete.allowunstableopt) and |
1361 repo.revs('(%ld::) - (%ld)', revs, revs)): |
1360 repo.revs('(%ld::) - (%ld)', revs, revs)): |
1362 raise error.Abort(_('can only histedit a changeset together ' |
1361 raise error.Abort(_('can only histedit a changeset together ' |
1363 'with all its descendants')) |
1362 'with all its descendants')) |
1364 if repo.revs('(%ld) and merge()', revs): |
1363 if repo.revs('(%ld) and merge()', revs): |
1365 raise error.Abort(_('cannot edit history that contains merges')) |
1364 raise error.Abort(_('cannot edit history that contains merges')) |
1366 root = ctxs[0] # list is already sorted by repo.set |
1365 root = repo[revs.first()] # list is already sorted by repo.revs() |
1367 if not root.mutable(): |
1366 if not root.mutable(): |
1368 raise error.Abort(_('cannot edit public changeset: %s') % root, |
1367 raise error.Abort(_('cannot edit public changeset: %s') % root, |
1369 hint=_("see 'hg help phases' for details")) |
1368 hint=_("see 'hg help phases' for details")) |
1370 return [c.node() for c in ctxs] |
1369 return pycompat.maplist(repo.changelog.node, revs) |
1371 |
1370 |
1372 def ruleeditor(repo, ui, actions, editcomment=""): |
1371 def ruleeditor(repo, ui, actions, editcomment=""): |
1373 """open an editor to edit rules |
1372 """open an editor to edit rules |
1374 |
1373 |
1375 rules are in the format [ [act, ctx], ...] like in state.rules |
1374 rules are in the format [ [act, ctx], ...] like in state.rules |