Index: subversion/clients/cmdline/cl.h =================================================================== --- subversion/clients/cmdline/cl.h (revision 9006) +++ subversion/clients/cmdline/cl.h (working copy) @@ -72,7 +72,8 @@ svn_cl__strict_opt, svn_cl__targets_opt, svn_cl__version_opt, - svn_cl__xml_opt + svn_cl__xml_opt, + svn_cl__human_readable_opt } svn_cl__longopt_t; @@ -129,6 +130,7 @@ const char * config_dir; /* over-riding configuration directory */ svn_boolean_t autoprops; /* enable automatic properties */ svn_boolean_t no_autoprops; /* disable automatic properties */ + svn_boolean_t human_readable; /* enable human readable output */ } svn_cl__opt_state_t; @@ -206,6 +208,7 @@ svn_boolean_t detailed, svn_boolean_t show_last_committed, svn_boolean_t skip_unrecognized, + svn_boolean_t human_readable, apr_pool_t *pool); /* Print a hash that maps property names (char *) to property values Index: subversion/clients/cmdline/status.c =================================================================== --- subversion/clients/cmdline/status.c (revision 9006) +++ subversion/clients/cmdline/status.c (working copy) @@ -151,6 +151,150 @@ path); } + +/* Print STATUS and PATH in a format determined by DETAILED and + SHOW_LAST_COMMITTED, in an format easy for humans to + understand */ +static void +human_readable_print_status (const char *path, + svn_boolean_t detailed, + svn_boolean_t show_last_committed, + svn_wc_status_t *status, + apr_pool_t *pool) +{ + char working_rev_buf[21]; /* Enough for 2^64 in base 10 plus '\0' */ + char commit_rev_buf[21]; + const char *working_rev = working_rev_buf; + const char *commit_rev = commit_rev_buf; + const char *commit_author = NULL; /* Silence a gcc uninitialised warning */ + + printf("%s:\n", path); + + switch (status->text_status) + { + case svn_wc_status_none: + case svn_wc_status_normal: + printf("\tFile not modified\n"); + break; + case svn_wc_status_added: + printf("\tFile added\n"); + break; + case svn_wc_status_missing: + printf("\tFile missing\n"); + break; + case svn_wc_status_incomplete: + printf("\tFile incomplete\n"); + break; + case svn_wc_status_deleted: + printf("\tFile deleted\n"); + break; + case svn_wc_status_replaced: + printf("\tFile replaced\n"); + break; + case svn_wc_status_modified: + printf("\tFile modified\n"); + break; + case svn_wc_status_merged: + printf("\tFile merged\n"); + break; + case svn_wc_status_conflicted: + printf("\tFile conflicted\n"); + break; + case svn_wc_status_obstructed: + printf("\tFile obstructed\n"); + break; + case svn_wc_status_ignored: + printf("\tFile status ignored\n"); + break; + case svn_wc_status_external: + printf("\tUnversioned external file\n"); + break; + case svn_wc_status_unversioned: + default: + printf("\tUnversioned file\n"); + break; + } + + switch (status->prop_status) + { + case svn_wc_status_none: + case svn_wc_status_normal: + printf("\tProperties haven't been modified\n"); + break; + case svn_wc_status_conflicted: + printf("\tProperties in conflict\n"); + break; + case svn_wc_status_modified: + printf("\tProperties modified\n"); + break; + default: + printf("\tUnrecognized properties status\n"); + break; + } + + if (status->locked) + printf("\tFile locked\n"); + if (status->copied) + printf("\tFile copied\n"); + if (status->switched) + printf("\tFile switched\n"); + + + if (detailed) + { + if (! status->entry) + printf("\tNo revision number\n"); + else if (! SVN_IS_VALID_REVNUM (status->entry->revision)) + printf("\tInvalid revision number\n"); + else if (status->copied) + printf("\tCopied file: no revision number\n"); + else + printf ("\tRevision number: %" SVN_REVNUM_T_FMT "\n", + status->entry->revision); + + if (status->repos_text_status != svn_wc_status_none + || status->repos_prop_status != svn_wc_status_none) + + printf("\tA newer revision is available on the server\n"); + else + printf("\tWorking copy is up to date\n"); + + if (show_last_committed) + { + if (status->entry && SVN_IS_VALID_REVNUM (status->entry->cmt_rev)) + printf("\tLast commited version: %" SVN_REVNUM_T_FMT "\n", + status->entry->cmt_rev); + else if (status->entry) + printf("\tUnknown last commited version\n"); + else + printf("\tFile has never been commited\n"); + + if (status->entry && status->entry->cmt_author) + { + const char *const author_utf8 = status->entry->cmt_author; + svn_error_t *err = + svn_cmdline_cstring_from_utf8 (&commit_author, author_utf8, + pool); + if (err) + { + svn_error_clear (err); + commit_author = + svn_cmdline_cstring_from_utf8_fuzzy (author_utf8, pool); + } + + printf("\tCommit author: %s\n", commit_author); + } + else if (status->entry) + printf("\tUnknown commit author\n"); + else + printf("\tNo commit author\n"); + + } + } + +} + + /* Called by status-cmd.c */ void svn_cl__print_status (const char *path, @@ -158,6 +302,7 @@ svn_boolean_t detailed, svn_boolean_t show_last_committed, svn_boolean_t skip_unrecognized, + svn_boolean_t human_readable, apr_pool_t *pool) { svn_error_t *err; @@ -176,5 +321,18 @@ svn_error_clear (err); } - print_status (path_stdout, detailed, show_last_committed, status, pool); + if (human_readable) + human_readable_print_status ( + path_stdout, + detailed, + show_last_committed, + status, + pool); + else + print_status ( + path_stdout, + detailed, + show_last_committed, + status, + pool); } Index: subversion/clients/cmdline/main.c =================================================================== --- subversion/clients/cmdline/main.c (revision 9006) +++ subversion/clients/cmdline/main.c (working copy) @@ -56,6 +56,8 @@ * need more, increase that limit first. * * The entire list must be terminated with an entry of nulls. + * + * Fields are: {name, option letter, has args, description} */ const apr_getopt_option_t svn_cl__options[] = { @@ -127,6 +129,8 @@ "enable automatic properties"}, {"no-auto-props", svn_cl__no_autoprops_opt, 0, "disable automatic properties"}, + {"human-readable",svn_cl__human_readable_opt, 0, + "enable human readable output"}, {0, 0, 0, 0} }; @@ -570,7 +574,7 @@ " 965 687 joe wc/zig.c\n" " Head revision: 981\n", { 'u', 'v', 'N', 'q', svn_cl__no_ignore_opt, SVN_CL__AUTH_OPTIONS, - svn_cl__config_dir_opt} }, + svn_cl__config_dir_opt, svn_cl__human_readable_opt} }, { "switch", svn_cl__switch, {"sw"}, "Update the working copy to a different URL.\n" @@ -931,6 +935,9 @@ } opt_state.no_autoprops = TRUE; break; + case svn_cl__human_readable_opt: + opt_state.human_readable = TRUE; + break; default: /* Hmmm. Perhaps this would be a good place to squirrel away opts that commands like svn diff might need. Hmmm indeed. */ Index: subversion/clients/cmdline/status-cmd.c =================================================================== --- subversion/clients/cmdline/status-cmd.c (revision 9006) +++ subversion/clients/cmdline/status-cmd.c (working copy) @@ -41,6 +41,7 @@ svn_boolean_t detailed; svn_boolean_t show_last_committed; svn_boolean_t skip_unrecognized; + svn_boolean_t human_readable; apr_pool_t *pool; }; @@ -53,7 +54,8 @@ { struct status_baton *sb = baton; svn_cl__print_status (path, status, sb->detailed, sb->show_last_committed, - sb->skip_unrecognized, sb->pool); + sb->skip_unrecognized, sb->human_readable, + sb->pool); } @@ -101,6 +103,7 @@ sb.detailed = (opt_state->verbose || opt_state->update); sb.show_last_committed = opt_state->verbose; sb.skip_unrecognized = opt_state->quiet; + sb.human_readable = opt_state->human_readable; sb.pool = subpool; SVN_ERR (svn_client_status (NULL, target, &rev, print_status, &sb, opt_state->nonrecursive ? FALSE : TRUE,