##// END OF EJS Templates
histedit: don't allow to strip nodes which are necessary to continue histedit...
Mateusz Kwapich -
r24111:11d72683 default
parent child Browse files
Show More
@@ -158,6 +158,7 b' from mercurial import discovery'
158 158 from mercurial import error
159 159 from mercurial import copies
160 160 from mercurial import context
161 from mercurial import extensions
161 162 from mercurial import hg
162 163 from mercurial import node
163 164 from mercurial import repair
@@ -674,6 +675,7 b' def _histedit(ui, repo, state, *freeargs'
674 675 actfunc = actiontable[action]
675 676 state.parentctx, replacement_ = actfunc(ui, state, ha, opts)
676 677 state.replacements.extend(replacement_)
678 state.write()
677 679
678 680 hg.update(repo, state.parentctx.node())
679 681
@@ -971,6 +973,23 b' def cleanupnode(ui, repo, name, nodes):'
971 973 finally:
972 974 release(lock)
973 975
976 def stripwrapper(orig, ui, repo, nodelist, *args, **kwargs):
977 if isinstance(nodelist, str):
978 nodelist = [nodelist]
979 if os.path.exists(os.path.join(repo.path, 'histedit-state')):
980 state = histeditstate(repo)
981 state.read()
982 histedit_nodes = set([ctx for (action, ctx) in state.rules])
983 strip_nodes = set([repo[n].hex() for n in nodelist])
984 common_nodes = histedit_nodes & strip_nodes
985 if common_nodes:
986 raise util.Abort(_('unable to strip %s. Nodes are '
987 'used by history edit in progress.')
988 % ', '.join(common_nodes))
989 return orig(ui, repo, nodelist, *args, **kwargs)
990
991 extensions.wrapfunction(repair, 'strip', stripwrapper)
992
974 993 def summaryhook(ui, repo):
975 994 if not os.path.exists(repo.join('histedit-state')):
976 995 return
@@ -3,6 +3,7 b''
3 3 $ cat >> $HGRCPATH <<EOF
4 4 > [extensions]
5 5 > histedit=
6 > strip=
6 7 > EOF
7 8
8 9 $ initrepo ()
@@ -72,6 +73,11 b' Go at a random point and try to continue'
72 73 (use 'hg histedit --continue' or 'hg histedit --abort')
73 74 [255]
74 75
76 Try to delete necessary commit
77 $ hg strip -r 652413bf663e
78 abort: unable to strip 652413bf663ef2a641cab26574e46d5f5a64a55a. Nodes are used by history edit in progress.
79 [255]
80
75 81 commit, then edit the revision
76 82 $ hg ci -m 'wat'
77 83 created new head
General Comments 0
You need to be logged in to leave comments. Login now