fileserverclient: add newlines on log messages

This fixes blackbox.log to not have two messages on the same line. This might be
undesirable if there's some other system using ui.log and this was *expected* to
be creating a single line. In that case, this might instead be a feature request
for blackbox to not insert time/user/node/etc. if it's a consecutive log from
the same 'service'. Currently, the docstring for ui.log says "*msg should be a
newline-terminated format string to log", so this is bringing these uses in
line with that.

Sample blackbox.log without this fix:

2017/11/06 14:41:23 spectral @a659d684cdf40d442d38f1ea65ee618f8b21d4b6 (25545)> remote cache hit rate is 0 of 9 2017/11/06 14:41:23 spectral @a659d684cdf40d442d38f1ea65ee618f8b21d4b6 (25545)> Success2017/11/06 14:45:24 spectral @dcbd198c160cfc8fc6d4a877aa5ed9296f98ee3c (25545)> pythonhook-update: remotefilelog.wcpprefetch finished in 0.00 seconds
This commit is contained in:
Kyle Lippincott 2017-11-09 10:16:44 -08:00
parent 3d4b814451
commit 707ab29ae4

View File

@ -339,7 +339,7 @@ class fileserverclient(object):
count = [total - len(missed)]
fromcache = count[0]
self.ui.progress(_downloading, count[0], total=total)
self.ui.log("remotefilelog", "remote cache hit rate is %r of %r ",
self.ui.log("remotefilelog", "remote cache hit rate is %r of %r\n",
count[0], total, hit=count[0], total=total)
oldumask = os.umask(0o002)
@ -382,12 +382,12 @@ class fileserverclient(object):
" does not support remotefilelog")
self.ui.log("remotefilefetchlog",
"Success",
"Success\n",
fetched_files = count[0] - fromcache,
total_to_fetch = total - fromcache)
except Exception:
self.ui.log("remotefilefetchlog",
"Fail",
"Fail\n",
fetched_files = count[0] - fromcache,
total_to_fetch = total - fromcache)
raise
@ -443,12 +443,12 @@ class fileserverclient(object):
rcvd = len(receiveddata)
self.ui.log("remotefilefetchlog",
"Success(pack)" if (rcvd==total) else "Fail(pack)",
"Success(pack)\n" if (rcvd==total) else "Fail(pack)\n",
fetched_files = rcvd,
total_to_fetch = total)
except Exception:
self.ui.log("remotefilefetchlog",
"Fail(pack)",
"Fail(pack)\n",
fetched_files = rcvd,
total_to_fetch = total)
raise
@ -612,5 +612,5 @@ class fileserverclient(object):
def logstacktrace(self):
import traceback
self.ui.log('remotefilelog', 'excess remotefilelog fetching:\n%s',
self.ui.log('remotefilelog', 'excess remotefilelog fetching:\n%s\n',
''.join(traceback.format_stack()))