##// 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 from mercurial import error
158 from mercurial import error
159 from mercurial import copies
159 from mercurial import copies
160 from mercurial import context
160 from mercurial import context
161 from mercurial import extensions
161 from mercurial import hg
162 from mercurial import hg
162 from mercurial import node
163 from mercurial import node
163 from mercurial import repair
164 from mercurial import repair
@@ -674,6 +675,7 b' def _histedit(ui, repo, state, *freeargs'
674 actfunc = actiontable[action]
675 actfunc = actiontable[action]
675 state.parentctx, replacement_ = actfunc(ui, state, ha, opts)
676 state.parentctx, replacement_ = actfunc(ui, state, ha, opts)
676 state.replacements.extend(replacement_)
677 state.replacements.extend(replacement_)
678 state.write()
677
679
678 hg.update(repo, state.parentctx.node())
680 hg.update(repo, state.parentctx.node())
679
681
@@ -971,6 +973,23 b' def cleanupnode(ui, repo, name, nodes):'
971 finally:
973 finally:
972 release(lock)
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 def summaryhook(ui, repo):
993 def summaryhook(ui, repo):
975 if not os.path.exists(repo.join('histedit-state')):
994 if not os.path.exists(repo.join('histedit-state')):
976 return
995 return
@@ -3,6 +3,7 b''
3 $ cat >> $HGRCPATH <<EOF
3 $ cat >> $HGRCPATH <<EOF
4 > [extensions]
4 > [extensions]
5 > histedit=
5 > histedit=
6 > strip=
6 > EOF
7 > EOF
7
8
8 $ initrepo ()
9 $ initrepo ()
@@ -72,6 +73,11 b' Go at a random point and try to continue'
72 (use 'hg histedit --continue' or 'hg histedit --abort')
73 (use 'hg histedit --continue' or 'hg histedit --abort')
73 [255]
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 commit, then edit the revision
81 commit, then edit the revision
76 $ hg ci -m 'wat'
82 $ hg ci -m 'wat'
77 created new head
83 created new head
General Comments 0
You need to be logged in to leave comments. Login now