D5533: remotefilelog: add newlines to ui.log() invocations
spectral (Kyle Lippincott)
phabricator at mercurial-scm.org
Tue Jan 8 22:51:13 UTC 2019
spectral created this revision.
Herald added a subscriber: mercurial-devel.
Herald added a reviewer: hg-reviewers.
REVISION SUMMARY
The comment at the top of ui.log() says that the message should be a
newline-terminated string. When using the blackbox logger, if the string does
not end in a newline, the appearance in the file gets quite messy.
This sometimes leaves a string with just the newline as the message, these are
logged by the blackbox logger just fine. I don't know what other loggers do when
logging structured data and a message that is just the newline.
REPOSITORY
rHG Mercurial
REVISION DETAIL
https://phab.mercurial-scm.org/D5533
AFFECTED FILES
hgext/remotefilelog/remotefilectx.py
hgext/remotefilelog/shallowutil.py
CHANGE DETAILS
diff --git a/hgext/remotefilelog/shallowutil.py b/hgext/remotefilelog/shallowutil.py
--- a/hgext/remotefilelog/shallowutil.py
+++ b/hgext/remotefilelog/shallowutil.py
@@ -106,7 +106,7 @@
def reportpackmetrics(ui, prefix, *stores):
dicts = [s.getmetrics() for s in stores]
dict = prefixkeys(sumdicts(*dicts), prefix + '_')
- ui.log(prefix + "_packsizes", "", **pycompat.strkwargs(dict))
+ ui.log(prefix + "_packsizes", "\n", **pycompat.strkwargs(dict))
def _parsepackmeta(metabuf):
"""parse datapack meta, bytes (<metadata-list>) -> dict
diff --git a/hgext/remotefilelog/remotefilectx.py b/hgext/remotefilelog/remotefilectx.py
--- a/hgext/remotefilelog/remotefilectx.py
+++ b/hgext/remotefilelog/remotefilectx.py
@@ -226,7 +226,7 @@
r'reponame': shallowutil.getreponame(repo.ui),
}
- repo.ui.log('linkrevfixup', 'adjusting linknode', **commonlogkwargs)
+ repo.ui.log('linkrevfixup', 'adjusting linknode\n', **commonlogkwargs)
pc = repo._phasecache
seenpublic = False
@@ -315,7 +315,7 @@
return None
finally:
elapsed = time.time() - start
- repo.ui.log('linkrevfixup', logmsg, elapsed=elapsed * 1000,
+ repo.ui.log('linkrevfixup', logmsg + '\n', elapsed=elapsed * 1000,
**pycompat.strkwargs(commonlogkwargs))
def _verifylinknode(self, revs, linknode):
To: spectral, #hg-reviewers
Cc: mercurial-devel
More information about the Mercurial-devel
mailing list