-- -- --- --- --- --- --- --- ------- ------- ------- |
"""
-- -- --- --- --- --- --- --- ------- ------- ------- |
Print command.
-- -- --- --- --- --- --- --- ------- ------- ------- |
-- -- --- --- --- --- --- --- ------- ------- ------- |
Print information about the wily cache and what is in the index.
-- -- --- --- --- --- --- --- ------- ------- ------- |
"""
-- -- --- --- --- --- --- --- ------- ------- ------- |
import tabulate
-- -- --- --- --- --- --- --- ------- ------- ------- |
-- -- --- --- --- --- --- --- ------- ------- ------- |
from wily import logger, format_date, format_revision, MAX_MESSAGE_WIDTH
-- -- --- --- --- --- --- --- ------- ------- ------- |
from wily.config import DEFAULT_GRID_STYLE
-- -- --- --- --- --- --- --- ------- ------- ------- |
from wily.state import State
-- -- --- --- --- --- --- --- ------- ------- ------- |
-- -- --- --- --- --- --- --- ------- ------- ------- |
-- 05 000 000 000 000 000 000 0000.00 0000.00 0000.00 |
def index(config, include_message=False):
-- 05 000 000 000 000 000 000 0000.00 0000.00 0000.00 |
"""
-- 05 000 000 000 000 000 000 0000.00 0000.00 0000.00 |
Show information about the cache and runtime.
-- 05 000 000 000 000 000 000 0000.00 0000.00 0000.00 |
-- 05 000 000 000 000 000 000 0000.00 0000.00 0000.00 |
:param config: The wily configuration
-- 05 000 000 000 000 000 000 0000.00 0000.00 0000.00 |
:type config: :namedtuple:`wily.config.WilyConfig`
-- 05 000 000 000 000 000 000 0000.00 0000.00 0000.00 |
-- 05 000 000 000 000 000 000 0000.00 0000.00 0000.00 |
:param include_message: Include revision messages
-- 05 000 000 000 000 000 000 0000.00 0000.00 0000.00 |
:type include_message: ``bool``
-- 05 000 000 000 000 000 000 0000.00 0000.00 0000.00 |
"""
-- 05 000 000 000 000 000 000 0000.00 0000.00 0000.00 |
state = State(config=config)
-- 05 000 000 000 000 000 000 0000.00 0000.00 0000.00 |
logger.debug("Running show command")
-- 05 000 000 000 000 000 000 0000.00 0000.00 0000.00 |
logger.info("--------Configuration---------")
-- 05 000 000 000 000 000 000 0000.00 0000.00 0000.00 |
logger.info(f"Path: {config.path}")
-- 05 000 000 000 000 000 000 0000.00 0000.00 0000.00 |
logger.info(f"Archiver: {config.archiver}")
-- 05 000 000 000 000 000 000 0000.00 0000.00 0000.00 |
logger.info(f"Operators: {config.operators}")
-- 05 000 000 000 000 000 000 0000.00 0000.00 0000.00 |
logger.info("")
-- 05 000 000 000 000 000 000 0000.00 0000.00 0000.00 |
logger.info("-----------History------------")
-- 05 000 000 000 000 000 000 0000.00 0000.00 0000.00 |
-- 05 000 000 000 000 000 000 0000.00 0000.00 0000.00 |
data = []
-- 05 000 000 000 000 000 000 0000.00 0000.00 0000.00 |
for archiver in state.archivers:
-- 05 000 000 000 000 000 000 0000.00 0000.00 0000.00 |
for rev in state.index[archiver].revisions:
-- 05 000 000 000 000 000 000 0000.00 0000.00 0000.00 |
if include_message:
-- 05 000 000 000 000 000 000 0000.00 0000.00 0000.00 |
data.append(
-- 05 000 000 000 000 000 000 0000.00 0000.00 0000.00 |
(
-- 05 000 000 000 000 000 000 0000.00 0000.00 0000.00 |
format_revision(rev.revision.key),
-- 05 000 000 000 000 000 000 0000.00 0000.00 0000.00 |
rev.revision.author_name,
-- 05 000 000 000 000 000 000 0000.00 0000.00 0000.00 |
rev.revision.message[:MAX_MESSAGE_WIDTH],
-- 05 000 000 000 000 000 000 0000.00 0000.00 0000.00 |
format_date(rev.revision.date),
-- 05 000 000 000 000 000 000 0000.00 0000.00 0000.00 |
)
-- 05 000 000 000 000 000 000 0000.00 0000.00 0000.00 |
)
-- 05 000 000 000 000 000 000 0000.00 0000.00 0000.00 |
else:
-- 05 000 000 000 000 000 000 0000.00 0000.00 0000.00 |
data.append(
-- 05 000 000 000 000 000 000 0000.00 0000.00 0000.00 |
(
-- 05 000 000 000 000 000 000 0000.00 0000.00 0000.00 |
format_revision(rev.revision.key),
-- 05 000 000 000 000 000 000 0000.00 0000.00 0000.00 |
rev.revision.author_name,
-- 05 000 000 000 000 000 000 0000.00 0000.00 0000.00 |
format_date(rev.revision.date),
-- 05 000 000 000 000 000 000 0000.00 0000.00 0000.00 |
)
-- 05 000 000 000 000 000 000 0000.00 0000.00 0000.00 |
)
-- 05 000 000 000 000 000 000 0000.00 0000.00 0000.00 |
-- 05 000 000 000 000 000 000 0000.00 0000.00 0000.00 |
if include_message:
-- 05 000 000 000 000 000 000 0000.00 0000.00 0000.00 |
headers = ("Revision", "Author", "Message", "Date")
-- 05 000 000 000 000 000 000 0000.00 0000.00 0000.00 |
else:
-- 05 000 000 000 000 000 000 0000.00 0000.00 0000.00 |
headers = ("Revision", "Author", "Date")
-- 05 000 000 000 000 000 000 0000.00 0000.00 0000.00 |
print(
-- 05 000 000 000 000 000 000 0000.00 0000.00 0000.00 |
tabulate.tabulate(
-- 05 000 000 000 000 000 000 0000.00 0000.00 0000.00 |
headers=headers, tabular_data=data, tablefmt=DEFAULT_GRID_STYLE
-- -- 000 000 000 000 000 000 0000.00 0000.00 0000.00 |
)
-- -- --- --- --- --- --- --- ------- ------- ------- |
)