##// END OF EJS Templates
histedit: clean abort when there is nothing to edit
Pierre-Yves David -
r17766:d9da3275 default
parent child Browse files
Show More
@@ -455,6 +455,9 b' def histedit(ui, repo, *parent, **opts):'
455
455
456 keep = opts.get('keep', False)
456 keep = opts.get('keep', False)
457 revs = between(repo, parent, topmost, keep)
457 revs = between(repo, parent, topmost, keep)
458 if not revs:
459 ui.warn(_('nothing to edit\n'))
460 return 1
458
461
459 ctxs = [repo[r] for r in revs]
462 ctxs = [repo[r] for r in revs]
460 rules = opts.get('commands', '')
463 rules = opts.get('commands', '')
@@ -588,7 +591,7 b' def between(repo, old, new, keep):'
588
591
589 When keep is false, the specified set can't have children."""
592 When keep is false, the specified set can't have children."""
590 ctxs = list(repo.set('%n::%n', old, new))
593 ctxs = list(repo.set('%n::%n', old, new))
591 if not keep:
594 if ctxs and not keep:
592 if repo.revs('(%ld::) - (%ld + hidden())', ctxs, ctxs):
595 if repo.revs('(%ld::) - (%ld + hidden())', ctxs, ctxs):
593 raise util.Abort(_('cannot edit history that would orphan nodes'))
596 raise util.Abort(_('cannot edit history that would orphan nodes'))
594 root = min(ctxs)
597 root = min(ctxs)
@@ -60,3 +60,10 b' Run a dummy edit to make sure we get tip'
60 #
60 #
61 0 files updated, 0 files merged, 0 files removed, 0 files unresolved
61 0 files updated, 0 files merged, 0 files removed, 0 files unresolved
62
62
63 Run on a revision not ancestors of the current working directory.
64
65 $ hg up 2
66 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
67 $ hg histedit -r 4
68 nothing to edit
69 [1]
General Comments 0
You need to be logged in to leave comments. Login now