Functions for status reporting. More...
#include <stdio.h>
#include <unistd.h>
#include <time.h>
#include "global.h"
#include "actions.h"
#include "status.h"
#include "helper.h"
#include "direnum.h"
#include "cache.h"
#include "url.h"
#include "cp_mv.h"
#include "ignore.h"
#include "options.h"
#include "est_ops.h"
#include "waa.h"
#include "checksum.h"
Go to the source code of this file.
Data Structures | |
struct | st___bit_info |
Defines | |
#define | BIT_INFO(v, s) { .val=v, .string=s, .str_len=strlen(s) } |
#define | st___string_from_bits(v, a, t) _st___string_from_bits(v, a, sizeof(a)/sizeof(a[0]), t) |
Constructs a string from a bitmask, where one or more bits may be set. | |
Functions | |
char * | st___visible_file_size (struct estat *sts) |
Returns the visible file size. | |
char * | st___meta_string (int status_bits, int flags) |
Meta-data status string. | |
char * | st___color (int status_bits) |
Roses are red, grass is green . | |
int | st__print_status (char *path, int status_bits, int flags, char *size, struct estat *sts) |
Prints the entry in readable form. | |
int | st__status (struct estat *sts) |
-. | |
int | st__action (struct estat *sts) |
-. | |
int | st__rm_status (struct estat *sts) |
-. | |
int | st__work (struct estat *root, int argc, char *argv[]) |
-. | |
int | st__progress (struct estat *sts) |
-. | |
int | st__progress_uninit (void) |
-. | |
volatile char * | _st___string_from_bits (int value, const struct st___bit_info data[], int max, char *text_for_none) |
volatile char * | st__flags_string_fromint (int mask) |
Return the string interpretation of the flags like RF_CHECK. | |
volatile char * | st__status_string_fromint (int mask) |
Same as st__status_string, but directly given an status. | |
char * | st__type_string (mode_t mode) |
Return the type string - cdev, bdev, whatever. | |
volatile char * | st__status_string (const struct estat *const sts) |
Returns a string describing the entry_status bits of struct estat. | |
int | st__print_entry_info (struct estat *sts) |
Shows detailed information about the entry. | |
Variables | |
static FILE * | progress_output = NULL |
static int | max_progress_len = 0 |
Functions for status reporting.
Definition in file status.c.
#define BIT_INFO | ( | v, | |||
s | ) | { .val=v, .string=s, .str_len=strlen(s) } |
Definition at line 584 of file status.c.
Referenced by st__flags_string_fromint(), and st__status_string_fromint().
#define st___string_from_bits | ( | v, | |||
a, | |||||
t | ) | _st___string_from_bits(v, a, sizeof(a)/sizeof(a[0]), t) |
Constructs a string from a bitmask, where one or more bits may be set.
Must not be free()d.
Definition at line 590 of file status.c.
Referenced by st__flags_string_fromint(), and st__status_string_fromint().
volatile char* _st___string_from_bits | ( | int | value, | |
const struct st___bit_info | data[], | |||
int | max, | |||
char * | text_for_none | |||
) |
Definition at line 591 of file status.c.
References cch__add(), cch__entry_set(), DEBUGP, cache_t::entries, cache_t::lru, STOPIF, and st___bit_info::str_len.
char* st___color | ( | int | status_bits | ) |
Roses are red, grass is green .
..
Definition at line 164 of file status.c.
References ANSI__BLUE, ANSI__GREEN, ANSI__RED, FS_CHANGED, FS_NEW, FS_REMOVED, and FS_REPLACED.
Referenced by st__print_status().
char* st___meta_string | ( | int | status_bits, | |
int | flags | |||
) | [inline] |
Meta-data status string.
Definition at line 137 of file status.c.
References FS_META_CHANGED, FS_META_GROUP, FS_META_MTIME, FS_META_OWNER, FS_META_UMODE, FS_PROPERTIES, opt__is_verbose(), and RF_PUSHPROPS.
Referenced by st__print_status().
char* st___visible_file_size | ( | struct estat * | sts | ) |
Returns the visible file size.
For devices the string dev
is printed; for directories dir
; files and symlinks get their actual size printed.
Definition at line 112 of file status.c.
References sstat_t::mode, sstat_t::size, and estat::st.
Referenced by st__rm_status(), and st__status().
int st__action | ( | struct estat * | sts | ) |
-.
Definition at line 345 of file status.c.
References estat::entry_status, OPT__STOP_ON_CHANGE, st__status, and STOPIF.
volatile char* st__flags_string_fromint | ( | int | mask | ) | [inline] |
Return the string interpretation of the flags like RF_CHECK.
Definition at line 648 of file status.c.
References BIT_INFO, RF_ADD, RF_CHECK, RF_CONFLICT, RF_COPY_BASE, RF_COPY_SUB, RF_PUSHPROPS, RF_UNVERSION, and st___string_from_bits.
Referenced by ci__nondir(), DEBUGP_dump_estat(), and st__print_entry_info().
int st__print_entry_info | ( | struct estat * | sts | ) |
Shows detailed information about the entry.
Definition at line 708 of file status.c.
References cm__get_source(), cs__md5tohex_buffered(), sstat_t::ctim, url_t::current_rev, sstat_t::dev, estat::entry_count, estat::entry_status, estat::flags, sstat_t::gid, GWD_CONF, GWD_WAA, hlp__get_grname(), hlp__get_uname(), sstat_t::ino, estat::md5, sstat_t::mode, sstat_t::mtim, ops__build_path(), OPT__VERBOSE, estat::parent, sstat_t::rdev, estat::repos_rev, RF___IS_COPY, RF_PRINT, sstat_t::size, estat::st, st__flags_string_fromint(), st__status_string(), st__type_string(), STOPIF, STOPIF_CODE_EPIPE, sstat_t::uid, url__full_url(), urllist, VERBOSITY_COPYFROM, and waa__get_waa_directory().
Referenced by info__action().
int st__print_status | ( | char * | path, | |
int | status_bits, | |||
int | flags, | |||
char * | size, | |||
struct estat * | sts | |||
) |
Prints the entry in readable form.
This function uses the OPT__VERBOSE
settings.
Definition at line 178 of file status.c.
References ANSI__NORMAL, BUG_ON, cm__get_source(), DEBUGP, FS__CHANGE_MASK, FS_CHANGED, FS_LIKELY, FS_META_CHANGED, FS_NEW, FS_REMOVED, FS_REPLACED, ignore_t::group_name, hlp__format_path(), ign__max_group_name_len, estat::match_pattern, opt__is_verbose(), OPT__STATUS_COLOR, OPT__VERBOSE, opt__verbosity(), RF___IS_COPY, RF_ADD, RF_CHECK, RF_CONFLICT, RF_COPY_BASE, RF_COPY_SUB, RF_UNVERSION, st___color(), st___meta_string(), STOPIF, STOPIF_CODE_EPIPE, estat::url, url__full_url(), VERBOSITY_COPYFROM, VERBOSITY_GROUP, VERBOSITY_QUIET, VERBOSITY_SHOWCHG, VERBOSITY_SHOWNAME, VERBOSITY_SHOWSIZE, and VERBOSITY_TOP_URL.
Referenced by st__rm_status(), and st__status().
int st__progress | ( | struct estat * | sts | ) |
-.
A secondary status function for commit and update (and other functions which run silently through the filesystem), which shows local progress when run on a tty. On larger working copies the stat()ing alone can take some time, and we want to keep the user informed that something happens.
Commit and update themselves print the information send to/received from the repository.
Definition at line 438 of file status.c.
References approx_entry_count, DEBUGP, max_progress_len, progress_output, and STOPIF_CODE_ERR.
int st__progress_uninit | ( | void | ) |
-.
Mostly needed to clear the cursor line, to avoid having part of a progress line mixed with some other output.
Definition at line 552 of file status.c.
References max_progress_len, progress_output, and STOPIF_CODE_ERR.
int st__rm_status | ( | struct estat * | sts | ) |
-.
Definition at line 363 of file status.c.
References ops__build_path(), estat::remote_status, st___visible_file_size(), st__print_status(), and STOPIF.
int st__status | ( | struct estat * | sts | ) |
-.
Definition at line 302 of file status.c.
References BUG_ON, DEBUGP, estat::entry_status, estat::flags, FS_NEW, FS_REPLACED, ign__is_ignore(), ops__build_path(), OPT__VERBOSE, RF_ADD, RF_ISNEW, st___visible_file_size(), st__print_status(), STOPIF, VERBOSITY_GROUP, and estat::was_output.
volatile char* st__status_string | ( | const struct estat *const | sts | ) | [inline] |
Returns a string describing the entry_status bits of struct estat.
Definition at line 702 of file status.c.
References estat::entry_status, and st__status_string_fromint().
Referenced by ci__nondir(), st__print_entry_info(), and waa___finish_directory().
volatile char* st__status_string_fromint | ( | int | mask | ) | [inline] |
Same as st__status_string, but directly given an status.
Definition at line 667 of file status.c.
References BIT_INFO, FS_CHANGED, FS_CHILD_CHANGED, FS_LIKELY, FS_META_GROUP, FS_META_MTIME, FS_META_OWNER, FS_META_UMODE, FS_NEW, FS_PROPERTIES, FS_REMOVED, and st___string_from_bits.
Referenced by DEBUGP_dump_estat(), df___repos_repos(), main(), ops__stat_to_action(), rev___local_revert(), rev___revert_to_base(), st__status_string(), waa___finish_directory(), and waa__find_common_base2().
char* st__type_string | ( | mode_t | mode | ) |
Return the type string - cdev, bdev, whatever.
Definition at line 685 of file status.c.
References S_IFGARBAGE.
Referenced by cb__add_entry(), DEBUGP_dump_estat(), df___diff_wc_remote(), and st__print_entry_info().
int st__work | ( | struct estat * | root, | |
int | argc, | |||
char * | argv[] | |||
) |
-.
Definition at line 384 of file status.c.
References ac__dispatch, action, ign__load_list(), ign__print_group_stats(), actionlist_t::local_callback, actionlist_t::local_uninit, OPT__DIR_SORT, OPT__GROUP_STATS, OPT__STOP_ON_CHANGE, st__progress, st__progress_uninit, st__status, STOPIF, url__load_list(), waa__do_sorted_tree(), waa__find_common_base(), and waa__read_or_build_tree().
int max_progress_len = 0 [static] |
Definition at line 106 of file status.c.
Referenced by st__progress(), and st__progress_uninit().
FILE* progress_output = NULL [static] |
Definition at line 105 of file status.c.
Referenced by st__progress(), and st__progress_uninit().