comparison mercurial/sshpeer.py @ 46663:a4c19a162615

sshpeer: enable+fix warning about sshpeers not being closed explicitly I recommend looking at this with a diff that ignores indentation. The test changes are because localrepo.close() updates some cache, which appears happens earlier now on rollbacks or strips or something. The http changes are because httppeer.close() prints stats with --verbose. Differential Revision: https://phab.mercurial-scm.org/D9999
author Valentin Gatien-Baron <valentin.gatienbaron@gmail.com>
date Mon, 15 Feb 2021 14:48:36 -0500
parents db8037e38085
children fa30292b680b
comparison
equal deleted inserted replaced
46662:db8037e38085 46663:a4c19a162615
173 # Encourage explicit close of sshpeers. Closing via __del__ is 173 # Encourage explicit close of sshpeers. Closing via __del__ is
174 # not very predictable when exceptions are thrown, which has led 174 # not very predictable when exceptions are thrown, which has led
175 # to deadlocks due to a peer get gc'ed in a fork 175 # to deadlocks due to a peer get gc'ed in a fork
176 # We add our own stack trace, because the stacktrace when called 176 # We add our own stack trace, because the stacktrace when called
177 # from __del__ is useless. 177 # from __del__ is useless.
178 if False: # enabled in next commit 178 ui.develwarn(b'missing close on SSH connection created at:\n%s' % warn)
179 ui.develwarn(
180 b'missing close on SSH connection created at:\n%s' % warn
181 )
182 179
183 180
184 def _makeconnection(ui, sshcmd, args, remotecmd, path, sshenv=None): 181 def _makeconnection(ui, sshcmd, args, remotecmd, path, sshenv=None):
185 """Create an SSH connection to a server. 182 """Create an SSH connection to a server.
186 183