Submitter | phabricator |
---|---|
Date | Jan. 3, 2020, 3:56 a.m. |
Message ID | <differential-rev-PHID-DREV-daoydbdoqihdd7jsl64d-req@mercurial-scm.org> |
Download | mbox | patch |
Permalink | /patch/44144/ |
State | Superseded |
Headers | show |
Comments
martinvonz added a comment. D7729 <https://phab.mercurial-scm.org/D7729> was my attempt at fixing it. Your patch is clearly better since it includes a test. I'll abandon mine. REPOSITORY rHG Mercurial CHANGES SINCE LAST ACTION https://phab.mercurial-scm.org/D7785/new/ REVISION DETAIL https://phab.mercurial-scm.org/D7785 To: spectral, #hg-reviewers Cc: martinvonz, mercurial-devel
pulkit added inline comments. INLINE COMMENTS > test-remotefilelog-prefetch.t:253 > + > repo.fileservice.prefetch([(b'somefile.txt', hexid)]) > + > except: > + > pass `test-check-code.t` fails now: --- /home/pulkitg/repo/hgpush/tests/test-check-code.t +++ /home/pulkitg/repo/hgpush/tests/test-check-code.t.err @@ -32,6 +32,10 @@ Skipping i18n/polib.py it has no-che?k-code (glob) Skipping mercurial/statprof.py it has no-che?k-code (glob) Skipping tests/badserverext.py it has no-che?k-code (glob) + tests/test-remotefilelog-prefetch.t:253: + > except: + naked except clause + [1] @commands in debugcommands.py should be in alphabetical order. ERROR: test-check-code.t output changed Can you send a followup? REPOSITORY rHG Mercurial CHANGES SINCE LAST ACTION https://phab.mercurial-scm.org/D7785/new/ REVISION DETAIL https://phab.mercurial-scm.org/D7785 To: spectral, #hg-reviewers Cc: pulkit, martinvonz, mercurial-devel
Patch
diff --git a/tests/test-remotefilelog-prefetch.t b/tests/test-remotefilelog-prefetch.t --- a/tests/test-remotefilelog-prefetch.t +++ b/tests/test-remotefilelog-prefetch.t @@ -236,3 +236,36 @@ $ hg revert -a -r 1 || true 3 files fetched over 1 fetches - (3 misses, 0.00% hit ratio) over * (glob) abort: z2@109c3a557a73: not found in manifest! (?) + +# warning when we have excess remotefilelog fetching + + $ cat > repeated_fetch.py << EOF + > import binascii + > from mercurial import extensions, registrar + > cmdtable = {} + > command = registrar.command(cmdtable) + > @command(b'repeated-fetch', [], b'', inferrepo=True) + > def repeated_fetch(ui, repo, *args, **opts): + > for i in range(20): + > try: + > hexid = (b'%02x' % (i + 1)) * 20 + > repo.fileservice.prefetch([(b'somefile.txt', hexid)]) + > except: + > pass + > EOF + +We should only output to the user once. We're ignoring most of the output +because we're not actually fetching anything real here, all the hashes are +bogus, so it's just going to be errors and a final summary of all the misses. + $ hg --config extensions.repeated_fetch=repeated_fetch.py \ + > --config remotefilelog.fetchwarning="fetch warning!" \ + > --config extensions.blackbox= \ + > repeated-fetch 2>&1 | grep 'fetch warning' + fetch warning! + +We should output to blackbox three times, with a stack trace on each (though +that isn't tested here). + $ grep 'excess remotefilelog fetching' .hg/blackbox.log + .* excess remotefilelog fetching: (re) + .* excess remotefilelog fetching: (re) + .* excess remotefilelog fetching: (re) diff --git a/hgext/remotefilelog/fileserverclient.py b/hgext/remotefilelog/fileserverclient.py --- a/hgext/remotefilelog/fileserverclient.py +++ b/hgext/remotefilelog/fileserverclient.py @@ -663,5 +663,5 @@ self.ui.log( b'remotefilelog', b'excess remotefilelog fetching:\n%s\n', - b''.join(pycompat.sysbytes(traceback.format_stack())), + b''.join(pycompat.sysbytes(s) for s in traceback.format_stack()), )