def node_info(n, name, show_hash = False, long_fmt = False, classification = None, numeric_ids = False, human_readable = False): """Return a string containing the information to display for the node n. Classification may be "all", "type", or None.""" result = '' if show_hash: result += "%s " % n.hash.encode('hex') if long_fmt: meta = copy.copy(n.metadata()) if meta: meta.path = name meta.size = n.size() else: # Fake it -- summary_str() is designed to handle a fake. meta = metadata.Metadata() meta.size = n.size() meta.mode = n.mode meta.path = name meta.atime, meta.mtime, meta.ctime = n.atime, n.mtime, n.ctime if stat.S_ISLNK(meta.mode): meta.symlink_target = n.readlink() result += metadata.summary_str(meta, numeric_ids = numeric_ids, classification = classification, human_readable = human_readable) else: result += name if classification: mode = n.metadata() and n.metadata().mode or n.mode result += xstat.classification_str(mode, classification == 'all') return result
def item_info(item, name, show_hash = False, commit_hash=False, long_fmt = False, classification = None, numeric_ids = False, human_readable = False): """Return a string containing the information to display for the VFS item. Classification may be "all", "type", or None. """ result = '' if show_hash: oid = item_hash(item, commit_hash) result += '%s ' % (oid.encode('hex') if oid else '0000000000000000000000000000000000000000') if long_fmt: meta = item.meta.copy() meta.path = name # FIXME: need some way to track fake vs real meta items? result += metadata.summary_str(meta, numeric_ids=numeric_ids, classification=classification, human_readable=human_readable) else: result += name if classification: result += xstat.classification_str(vfs.item_mode(item), classification == 'all') return result
def item_info(item, name, show_hash=False, commit_hash=False, long_fmt=False, classification=None, numeric_ids=False, human_readable=False): """Return a string containing the information to display for the VFS item. Classification may be "all", "type", or None. """ result = '' if show_hash: oid = item_hash(item, commit_hash) result += '%s ' % (oid.encode('hex') if oid else '0000000000000000000000000000000000000000') if long_fmt: meta = item.meta.copy() meta.path = name # FIXME: need some way to track fake vs real meta items? result += metadata.summary_str(meta, numeric_ids=numeric_ids, classification=classification, human_readable=human_readable) else: result += name if classification: result += xstat.classification_str(vfs.item_mode(item), classification == 'all') return result
def node_info(n, name, show_hash = False, long_fmt = False, classification = None, numeric_ids = False, human_readable = False): """Return a string containing the information to display for the node n. Classification may be "all", "type", or None. """ result = '' if show_hash: result += "%s " % n.hash.encode('hex') if long_fmt: meta = copy.copy(n.metadata()) meta.size = n.size() result += metadata.summary_str(meta, numeric_ids = numeric_ids, human_readable = human_readable) + ' ' result += name if classification: if n.metadata(): mode = n.metadata().mode else: mode = n.mode if stat.S_ISREG(mode): if classification == 'all' \ and stat.S_IMODE(mode) & (stat.S_IXUSR | stat.S_IXGRP | stat.S_IXOTH): result += '*' elif stat.S_ISDIR(mode): result += '/' elif stat.S_ISLNK(mode): result += '@' elif stat.S_ISFIFO(mode): result += '|' elif stat.S_ISSOCK(mode): result += '=' return result