diff --git a/remotefilelog/remotefilectx.py b/remotefilelog/remotefilectx.py --- a/remotefilelog/remotefilectx.py +++ b/remotefilelog/remotefilectx.py @@ -6,6 +6,7 @@ # GNU General Public License version 2 or any later version. import collections +import os from mercurial.i18n import _ from mercurial.node import bin, hex, nullid, nullrev from mercurial import context, util, error, ancestor, phases, extensions @@ -34,6 +35,18 @@ return False return conduit +def getusername(ui): + try: + return util.shortuser(ui.username()) + except Exception: + return 'unknown' + +def getreponame(ui): + reponame = ui.config('paths', 'default') + if reponame: + return os.path.basename(reponame) + return "unknown" + class remotefilectx(context.filectx): def __init__(self, repo, path, changeid=None, fileid=None, filelog=None, changectx=None, ancestormap=None): @@ -240,6 +253,16 @@ if self._verifylinknode(revs, linknode): return linknode + commonlogkwargs = { + 'revs': ' '.join([repo[rev].hex() for rev in revs]), + 'fnode': hex(fnode), + 'filepath': path, + 'user': getusername(repo.ui), + 'reponame': getreponame(repo.ui), + } + + repo.ui.log('linkrevfixup', 'adjusting linknode', **commonlogkwargs) + pc = repo._phasecache seenpublic = False iteranc = cl.ancestors(revs, inclusive=inclusive) @@ -296,7 +319,7 @@ # commits if repo.ui.configbool('fastlog', 'enabled'): lnode = self._linknodeviafastlog(repo, path, ancrev, fnode, - cl, mfl) + cl, mfl, commonlogkwargs) if lnode: return lnode seenpublic = True @@ -320,7 +343,8 @@ return linknode - def _linknodeviafastlog(self, repo, path, srcrev, fnode, cl, mfl): + def _linknodeviafastlog(self, repo, path, srcrev, fnode, cl, mfl, + commonlogkwargs): reponame = repo.ui.config('fbconduit', 'reponame') logmsg = '' if self._conduit is None: @@ -351,7 +375,7 @@ logmsg = 'fastlog failed (%s)' % e return None finally: - repo.ui.log('linkrevfixup', logmsg) + repo.ui.log('linkrevfixup', logmsg, **commonlogkwargs) def _verifylinknode(self, revs, linknode):