mirror of
https://github.com/facebook/sapling.git
synced 2024-10-11 17:27:53 +03:00
13718aed04
Summary: Whenever fastmanifest needs an ui object, we pass it a global proxy object. Whenever someone calls `reposetup(..)`, we update the backing object. Test Plan: 1) pass existing unit tests 2) enable chg, then run `hg diff -c . --debug`. saw fastmanifest debug output in the console. Reviewers: lcharignon, quark Reviewed By: lcharignon Subscribers: trunkagent, mitrandir, mjpieters Differential Revision: https://phabricator.intern.facebook.com/D3510966 Signature: t1:3510966:1467410140:88fe810d03b9a9aa6818f17eb605a70eee931364
32 lines
927 B
Python
32 lines
927 B
Python
# debug.py
|
|
#
|
|
# Copyright 2016 Facebook, Inc.
|
|
#
|
|
# This software may be used and distributed according to the terms of the
|
|
# GNU General Public License version 2 or any later version.
|
|
|
|
class manifestaccesslogger(object):
|
|
"""Class to log manifest access and confirm our assumptions"""
|
|
def __init__(self, ui):
|
|
self._ui = ui
|
|
|
|
def revwrap(self, orig, *args, **kwargs):
|
|
"""Wraps manifest.rev and log access"""
|
|
r = orig(*args, **kwargs)
|
|
logfile = self._ui.config("fastmanifest", "logfile", "")
|
|
if logfile:
|
|
try:
|
|
with open(logfile, "a") as f:
|
|
f.write("%s\n" % r)
|
|
except EnvironmentError:
|
|
pass
|
|
return r
|
|
|
|
class fixedcachelimit(object):
|
|
"""A fix cache limit expressed as a number of bytes"""
|
|
def __init__(self, bytes):
|
|
self._bytes = bytes
|
|
|
|
def bytes(self):
|
|
return self._bytes
|