comparison tests/test-lfs-serve.t @ 41704:3b0ba4575c8c

exchange: raise error.Abort instead of ValueError Raising ValueError results in an uncaught exception and a traceback being printed. In the context of servers, it can result in an HTTP 500 and an exception being logged in the error log. I don't think this is proper behavior. The bundle2 code paths have a mechanism for translating an error.Abort into an error message reported to the clients. I think we should use that instead. This commit replaces some ValueError with Abort so that servers can error more gracefully. Differential Revision: https://phab.mercurial-scm.org/D5972
author Gregory Szorc <gregory.szorc@gmail.com>
date Fri, 15 Feb 2019 11:31:17 -0800
parents 47c4ac5035a6
children 561cd02c58ff
comparison
equal deleted inserted replaced
41703:47c4ac5035a6 41704:3b0ba4575c8c
54 > for flag, proc in rl._flagprocessors.items(): 54 > for flag, proc in rl._flagprocessors.items():
55 > ui.status(b"registered processor '%#x'\n" % (flag)) 55 > ui.status(b"registered processor '%#x'\n" % (flag))
56 > EOF 56 > EOF
57 57
58 Skip the experimental.changegroup3=True config. Failure to agree on this comes 58 Skip the experimental.changegroup3=True config. Failure to agree on this comes
59 first, and causes a "ValueError: no common changegroup version" or "abort: 59 first, and causes an "abort: no common changegroup version" if the extension is
60 HTTP Error 500: Internal Server Error", if the extension is only loaded on one 60 only loaded on one side. If that *is* enabled, the subsequent failure is "abort:
61 side. If that *is* enabled, the subsequent failure is "abort: missing processor 61 missing processor for flag '0x2000'!" if the extension is only loaded on one side
62 for flag '0x2000'!" if the extension is only loaded on one side (possibly also 62 (possibly also masked by the Internal Server Error message).
63 masked by the Internal Server Error message).
64 $ cat >> $HGRCPATH <<EOF 63 $ cat >> $HGRCPATH <<EOF
65 > [extensions] 64 > [extensions]
66 > debugprocessors = $TESTTMP/debugprocessors.py 65 > debugprocessors = $TESTTMP/debugprocessors.py
67 > [experimental] 66 > [experimental]
68 > lfs.disableusercache = True 67 > lfs.disableusercache = True
318 317
319 $ hg init $TESTTMP/client4_pull 318 $ hg init $TESTTMP/client4_pull
320 $ hg -R $TESTTMP/client4_pull pull http://localhost:$HGPORT 319 $ hg -R $TESTTMP/client4_pull pull http://localhost:$HGPORT
321 pulling from http://localhost:$HGPORT/ 320 pulling from http://localhost:$HGPORT/
322 requesting all changes 321 requesting all changes
323 abort: HTTP Error 500: Internal Server Error 322 remote: abort: no common changegroup version
323 abort: pull failed on remote
324 [255] 324 [255]
325 $ grep 'lfs' $TESTTMP/client4_pull/.hg/requires $SERVER_REQUIRES 325 $ grep 'lfs' $TESTTMP/client4_pull/.hg/requires $SERVER_REQUIRES
326 $TESTTMP/server/.hg/requires:lfs 326 $TESTTMP/server/.hg/requires:lfs
327 327
328 $ hg identify http://localhost:$HGPORT 328 $ hg identify http://localhost:$HGPORT
662 662
663 #endif 663 #endif
664 664
665 $ "$PYTHON" $TESTDIR/killdaemons.py $DAEMON_PIDS 665 $ "$PYTHON" $TESTDIR/killdaemons.py $DAEMON_PIDS
666 666
667 #if lfsremote-on
668 $ cat $TESTTMP/errors.log | grep '^[A-Z]'
669 Traceback (most recent call last):
670 ValueError: no common changegroup version
671 #else
672 $ cat $TESTTMP/errors.log 667 $ cat $TESTTMP/errors.log
673 #endif