commitcloud: log sync state to blackbox log

Summary: Improve debugability of cloud sync by logging updated sync state to the blackbox logs.

Reviewed By: mitrandir77

Differential Revision: D15434890

fbshipit-source-id: c5065455985a48777a855997a99e32ce0b31cc72
This commit is contained in:
Mark Thomas 2019-05-21 14:29:10 -07:00 committed by Facebook Github Bot
parent 30e5b3eb26
commit 1eaa46bd64

View File

@ -38,6 +38,7 @@ class SyncState(object):
repo.svfs.tryunlink(filename)
def __init__(self, repo, workspacename):
self.workspacename = workspacename
self.filename = self._filename(workspacename)
self.repo = repo
self.prevstate = None
@ -97,6 +98,16 @@ class SyncState(object):
self.omittedheads = newomittedheads
self.omittedbookmarks = newomittedbookmarks
self.maxage = newmaxage
self.repo.ui.log(
"commitcloud_sync",
"synced to workspace %s version %s: %d heads (%d omitted), %d bookmarks (%d omitted)\n",
self.workspacename,
newversion,
len(newheads),
len(newomittedheads),
len(newbookmarks),
len(newomittedbookmarks),
)
def oscillating(self, newheads, newbookmarks):
"""detect oscillating workspaces