mirror of
https://github.com/facebook/sapling.git
synced 2024-10-07 23:38:50 +03:00
62e2c05058
Nobody should start a transaction on an unlocked repository. If developer warnings are enabled this will be reported. This use the same config as bad locking order since this is closely related.
66 lines
1.9 KiB
Raku
66 lines
1.9 KiB
Raku
|
|
$ cat << EOF > buggylocking.py
|
|
> """A small extension that acquire locks in the wrong order
|
|
> """
|
|
>
|
|
> from mercurial import cmdutil
|
|
>
|
|
> cmdtable = {}
|
|
> command = cmdutil.command(cmdtable)
|
|
>
|
|
> @command('buggylocking', [], '')
|
|
> def buggylocking(ui, repo):
|
|
> tr = repo.transaction('buggy')
|
|
> lo = repo.lock()
|
|
> wl = repo.wlock()
|
|
> EOF
|
|
|
|
$ cat << EOF >> $HGRCPATH
|
|
> [extensions]
|
|
> buggylocking=$TESTTMP/buggylocking.py
|
|
> [devel]
|
|
> all=1
|
|
> EOF
|
|
|
|
$ hg init lock-checker
|
|
$ cd lock-checker
|
|
$ hg buggylocking
|
|
transaction with no lock
|
|
"lock" taken before "wlock"
|
|
$ cat << EOF >> $HGRCPATH
|
|
> [devel]
|
|
> all=0
|
|
> check-locks=1
|
|
> EOF
|
|
$ hg buggylocking
|
|
transaction with no lock
|
|
"lock" taken before "wlock"
|
|
$ hg buggylocking --traceback
|
|
transaction with no lock
|
|
at:
|
|
*/hg:* in <module> (glob)
|
|
*/mercurial/dispatch.py:* in run (glob)
|
|
*/mercurial/dispatch.py:* in dispatch (glob)
|
|
*/mercurial/dispatch.py:* in _runcatch (glob)
|
|
*/mercurial/dispatch.py:* in _dispatch (glob)
|
|
*/mercurial/dispatch.py:* in runcommand (glob)
|
|
*/mercurial/dispatch.py:* in _runcommand (glob)
|
|
*/mercurial/dispatch.py:* in checkargs (glob)
|
|
*/mercurial/dispatch.py:* in <lambda> (glob)
|
|
*/mercurial/util.py:* in check (glob)
|
|
$TESTTMP/buggylocking.py:* in buggylocking (glob)
|
|
"lock" taken before "wlock"
|
|
at:
|
|
*/hg:* in <module> (glob)
|
|
*/mercurial/dispatch.py:* in run (glob)
|
|
*/mercurial/dispatch.py:* in dispatch (glob)
|
|
*/mercurial/dispatch.py:* in _runcatch (glob)
|
|
*/mercurial/dispatch.py:* in _dispatch (glob)
|
|
*/mercurial/dispatch.py:* in runcommand (glob)
|
|
*/mercurial/dispatch.py:* in _runcommand (glob)
|
|
*/mercurial/dispatch.py:* in checkargs (glob)
|
|
*/mercurial/dispatch.py:* in <lambda> (glob)
|
|
*/mercurial/util.py:* in check (glob)
|
|
$TESTTMP/buggylocking.py:* in buggylocking (glob)
|
|
$ cd ..
|