##// END OF EJS Templates
repair: forbid strip from inside a transaction...
Pierre-Yves David -
r25300:678d0bfd default
parent child Browse files
Show More
@@ -151,6 +151,12 b' def strip(ui, repo, nodelist, backup=Tru'
151
151
152 mfst = repo.manifest
152 mfst = repo.manifest
153
153
154 curtr = repo.currenttransaction()
155 if curtr is not None:
156 del curtr # avoid carrying reference to transaction for nothing
157 msg = _('programming error: cannot strip from inside a transaction')
158 raise util.Abort(msg, hint=_('contact your extension maintainer'))
159
154 tr = repo.transaction("strip")
160 tr = repo.transaction("strip")
155 offset = len(tr.entries)
161 offset = len(tr.entries)
156
162
@@ -3,7 +3,7 b''
3 > """A small extension that acquire locks in the wrong order
3 > """A small extension that acquire locks in the wrong order
4 > """
4 > """
5 >
5 >
6 > from mercurial import cmdutil
6 > from mercurial import cmdutil, repair
7 >
7 >
8 > cmdtable = {}
8 > cmdtable = {}
9 > command = cmdutil.command(cmdtable)
9 > command = cmdutil.command(cmdtable)
@@ -38,6 +38,15 b''
38 > wl = repo.wlock(wait=False)
38 > wl = repo.wlock(wait=False)
39 > wl.release()
39 > wl.release()
40 > lo.release()
40 > lo.release()
41 >
42 > @command('stripintr', [], '')
43 > def stripintr(ui, repo):
44 > lo = repo.lock()
45 > tr = repo.transaction('foobar')
46 > try:
47 > repair.strip(repo.ui, repo, [repo['.'].node()])
48 > finally:
49 > lo.release()
41 > EOF
50 > EOF
42
51
43 $ cat << EOF >> $HGRCPATH
52 $ cat << EOF >> $HGRCPATH
@@ -87,4 +96,14 b''
87 $TESTTMP/buggylocking.py:* in buggylocking (glob)
96 $TESTTMP/buggylocking.py:* in buggylocking (glob)
88 $ hg properlocking
97 $ hg properlocking
89 $ hg nowaitlocking
98 $ hg nowaitlocking
99
100 $ echo a > a
101 $ hg add a
102 $ hg commit -m a
103 $ hg stripintr
104 saved backup bundle to $TESTTMP/lock-checker/.hg/strip-backup/cb9a9f314b8b-cc5ccb0b-backup.hg (glob)
105 abort: programming error: cannot strip from inside a transaction
106 (contact your extension maintainer)
107 [255]
108
90 $ cd ..
109 $ cd ..
General Comments 0
You need to be logged in to leave comments. Login now