Commit dcef6bbd authored by Georges Racinet's avatar Georges Racinet 🦑
Browse files

CommitService logging all incoming requests

In some cases this replaces existing logs with the more complete
dump of the request.

Again, it's not useful to put the name of the method in the message:
the name of the request class fulfills that purpose easily.
parent 06e62bed644b
Pipeline #23907 passed with stages
in 1 minute and 18 seconds
......@@ -97,6 +97,7 @@
def CommitIsAncestor(self,
request: CommitIsAncestorRequest,
context) -> CommitIsAncestorResponse:
logger.debug("Processing %r", message.Logging(request))
# The question is legit for filtered changesets and that
# happens in MR rebase scenarios, before the Rails app realizes
# the MR has to be updated.
......@@ -126,7 +127,7 @@
Actually, it always yields one response message, using the empty
response in case the given path does not resolve.
"""
logger.info("TreeEntry request=%r", message.Logging(request))
logger.debug("Processing %r", message.Logging(request))
repo = self.load_repo(request.repository, context).unfiltered()
changeset = gitlab_revision_changeset(repo, request.revision)
if changeset is None:
......@@ -236,6 +237,7 @@
TODO: find out if there are default values to apply for ``from`` and
``to``
"""
logger.debug("Processing %r", message.Logging(request))
repo = self.load_repo(request.repository, context)
unfi = repo.unfiltered()
rev_from = gitlab_revision_changeset(repo, getattr(request, 'from'))
......@@ -261,6 +263,7 @@
def CountCommits(self,
request: CountCommitsRequest,
context) -> CountCommitsResponse:
logger.debug("Processing %r", message.Logging(request))
# TODO: yet to finish this method to support all lookups
repo = self.load_repo(request.repository, context)
revision = request.revision
......@@ -304,6 +307,7 @@
def CountDivergingCommits(self,
request: CountDivergingCommitsRequest,
context) -> CountDivergingCommitsResponse:
logger.debug("Processing %r", message.Logging(request))
repo = self.load_repo(request.repository, context)
rev_from = gitlab_revision_changeset(repo, getattr(request, 'from'))
rev_to = gitlab_revision_changeset(repo, getattr(request, 'to'))
......@@ -336,7 +340,7 @@
def GetTreeEntries(self, request: GetTreeEntriesRequest,
context) -> GetTreeEntriesResponse:
logger.info("GetTreeEntries request=%r", message.Logging(request))
logger.debug("Processing %r", message.Logging(request))
repo = self.load_repo(request.repository, context).unfiltered()
revision = request.revision
changeset = gitlab_revision_changeset(repo, revision)
......@@ -374,5 +378,6 @@
def ListFiles(self, request: ListFilesRequest,
context) -> ListFilesResponse:
logger.debug("Processing %r", message.Logging(request))
repo = self.load_repo(request.repository, context)
revision = pycompat.sysbytes(request.revision)
......@@ -377,6 +382,5 @@
repo = self.load_repo(request.repository, context)
revision = pycompat.sysbytes(request.revision)
logger.debug("ListFiles revision=%r", revision)
ctx = gitlab_revision_changeset(repo, revision)
if ctx is None:
return
......@@ -386,5 +390,6 @@
def CommitStats(self, request: CommitStatsRequest,
context) -> CommitStatsResponse:
logger.debug("Processing %r", message.Logging(request))
repo = self.load_repo(request.repository, context)
revision = pycompat.sysbytes(request.revision)
......@@ -389,6 +394,5 @@
repo = self.load_repo(request.repository, context)
revision = pycompat.sysbytes(request.revision)
logger.debug("CommitStats revision=%r", revision)
ctx = gitlab_revision_changeset(repo, revision)
if ctx is None:
return internal_error(
......@@ -412,6 +416,6 @@
def FindCommit(self,
request: FindCommitRequest, context) -> FindCommitResponse:
logger.debug("Request %r", message.Logging(request))
logger.debug("Processing %r", message.Logging(request))
repo = self.load_repo(request.repository, context)
revision = request.revision
......@@ -416,6 +420,5 @@
repo = self.load_repo(request.repository, context)
revision = request.revision
logger.debug("FindCommit revision=%r", revision)
ctx = gitlab_revision_changeset(repo, revision)
if ctx is None:
......@@ -429,9 +432,9 @@
def FindAllCommits(self, request: FindAllCommitsRequest,
context) -> FindAllCommitsResponse:
logger.debug("Request %r", message.Logging(request))
logger.debug("Processing %r", message.Logging(request))
repo = self.load_repo(request.repository, context)
revision = request.revision
opts = {}
if revision:
# If false, return all commits reachable by any branch in the repo
......@@ -433,9 +436,8 @@
repo = self.load_repo(request.repository, context)
revision = request.revision
opts = {}
if revision:
# If false, return all commits reachable by any branch in the repo
logger.debug("FindAllCommits revision=%r", revision)
ctx = gitlab_revision_changeset(repo, revision)
if ctx is None:
logger.debug(
......@@ -474,7 +476,8 @@
context) -> FindCommitsResponse:
req_log = message.Logging(request)
logger.debug("Request %r", req_log)
logger.debug("Processing %r", message.Logging(request))
if request.limit == 0:
return
......@@ -521,6 +524,7 @@
def RawBlame(self, request: RawBlameRequest,
context) -> RawBlameResponse:
logger.debug("Processing %r", message.Logging(request))
repo = self.load_repo(request.repository, context)
filepath = request.path
if not filepath:
......@@ -538,5 +542,6 @@
def LastCommitForPath(self,
request: LastCommitForPathRequest,
context) -> LastCommitForPathResponse:
logger.debug("Processing %r", message.Logging(request))
repo = self.load_repo(request.repository, context)
revision, path = request.revision, request.path
......@@ -541,9 +546,8 @@
repo = self.load_repo(request.repository, context)
revision, path = request.revision, request.path
logger.debug("LastCommitForPath revision=%r, path=%r", revision, path)
ctx = gitlab_revision_changeset(repo, revision)
changeset = latest_changeset_for_path(path, ctx)
return LastCommitForPathResponse(commit=message.commit(changeset))
def ListLastCommitsForTree(self, request: ListLastCommitsForTreeRequest,
context) -> ListLastCommitsForTreeResponse:
......@@ -544,9 +548,10 @@
ctx = gitlab_revision_changeset(repo, revision)
changeset = latest_changeset_for_path(path, ctx)
return LastCommitForPathResponse(commit=message.commit(changeset))
def ListLastCommitsForTree(self, request: ListLastCommitsForTreeRequest,
context) -> ListLastCommitsForTreeResponse:
logger.debug("Processing %r", message.Logging(request))
repo = self.load_repo(request.repository, context)
revision = pycompat.sysbytes(request.revision)
from_ctx = gitlab_revision_changeset(repo, revision)
......@@ -597,6 +602,7 @@
def CommitsByMessage(self, request: CommitsByMessageRequest,
context) -> CommitsByMessageResponse:
logger.debug("Processing %r", message.Logging(request))
repo = self.load_repo(request.repository, context)
query = request.query
if not query:
......@@ -638,6 +644,7 @@
def ListCommitsByOid(self, request: ListCommitsByOidRequest,
context) -> ListCommitsByOidResponse:
logger.debug("Processing %r", message.Logging(request))
repo = self.load_repo(request.repository, context)
lookup_error_classes = (error.LookupError, error.RepoLookupError)
for chunk in chunked(pycompat.sysbytes(oid) for oid in request.oid):
......@@ -666,6 +673,7 @@
def ListCommitsByRefName(self, request: ListCommitsByRefNameRequest,
context) -> ListCommitsByRefNameResponse:
logger.debug("Processing %r", message.Logging(request))
repo = self.load_repo(request.repository, context)
ref_names = request.ref_names
......@@ -701,6 +709,7 @@
def GetCommitMessages(self, request: GetCommitMessagesRequest,
context) -> GetCommitMessagesResponse:
logger.debug("Processing %r", message.Logging(request))
repo = self.load_repo(request.repository, context)
results = {}
for commit_id in request.commit_ids:
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment