mirror of
https://github.com/facebook/sapling.git
synced 2024-10-10 00:45:18 +03:00
8699e2ba59
Summary: `fixedcachelimit` is removed by D3355182 so the rest is just debug cruft. Test Plan: pass existing unit tests. Reviewers: lcharignon Reviewed By: lcharignon Subscribers: mitrandir, mjpieters Differential Revision: https://phabricator.intern.facebook.com/D3355456 Signature: t1:3355456:1464304289:07a16dec879f0caa3947fbc4fe5db353149d5209
30 lines
843 B
Python
30 lines
843 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, logfile):
|
|
self._logfile = logfile
|
|
|
|
def revwrap(self, orig, *args, **kwargs):
|
|
"""Wraps manifest.rev and log access"""
|
|
r = orig(*args, **kwargs)
|
|
try:
|
|
with open(self._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
|