⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 info-cmd.c

📁 subversion-1.4.3-1.tar.gz 配置svn的源码
💻 C
📖 第 1 页 / 共 2 页
字号:
/* * info-cmd.c -- Display information about a resource * * ==================================================================== * Copyright (c) 2000-2004 CollabNet.  All rights reserved. * * This software is licensed as described in the file COPYING, which * you should have received as part of this distribution.  The terms * are also available at http://subversion.tigris.org/license-1.html. * If newer versions of this license are posted there, you may use a * newer version instead, at your option. * * This software consists of voluntary contributions made by many * individuals.  For exact contribution history, see the revision * history and logs, available at http://subversion.tigris.org/. * ==================================================================== *//* ==================================================================== *//*** Includes. ***/#include "svn_cmdline.h"#include "svn_wc.h"#include "svn_pools.h"#include "svn_error.h"#include "svn_path.h"#include "svn_time.h"#include "svn_xml.h"#include "cl.h"#include "svn_private_config.h"/*** Code. ***/static svn_error_t *svn_cl__info_print_time(apr_time_t atime,                        const char *desc,                        apr_pool_t *pool){  const char *time_utf8;  time_utf8 = svn_time_to_human_cstring(atime, pool);  SVN_ERR(svn_cmdline_printf(pool, "%s: %s\n", desc, time_utf8));  return SVN_NO_ERROR;}/* Prints XML header */static svn_error_t *print_header_xml(apr_pool_t *pool){  svn_stringbuf_t *sb = svn_stringbuf_create("", pool);  /* <?xml version="1.0" encoding="utf-8"?> */  svn_xml_make_header(&sb, pool);  /* "<info>" */  svn_xml_make_open_tag(&sb, pool, svn_xml_normal, "info", NULL);  return svn_cl__error_checked_fputs(sb->data, stdout);}/* Prints XML footer */static svn_error_t *print_footer_xml(apr_pool_t *pool){  svn_stringbuf_t *sb = svn_stringbuf_create("", pool);  /* "</info>" */  svn_xml_make_close_tag(&sb, pool, "info");  return svn_cl__error_checked_fputs(sb->data, stdout);}/* Return string representation of SCHEDULE */static const char *schedule_str(svn_wc_schedule_t schedule){  switch (schedule)    {    case svn_wc_schedule_normal:      return "normal";    case svn_wc_schedule_add:      return "add";    case svn_wc_schedule_delete:      return "delete";    case svn_wc_schedule_replace:      return "replace";    default:      return "none";    }}/* prints svn info in xml mode to standard out */static svn_error_t *print_info_xml(const char *target,               const svn_info_t *info,               apr_pool_t *pool){  svn_stringbuf_t *sb = svn_stringbuf_create("", pool);  const char *rev_str;  /* If revision is invalid, assume WC is corrupt. */  if (SVN_IS_VALID_REVNUM(info->rev))    rev_str = apr_psprintf(pool, "%ld", info->rev);  else    return svn_error_createf(SVN_ERR_WC_CORRUPT, NULL,                             _("'%s' has invalid revision"),                             svn_path_local_style(target, pool));  /* "<entry ...>" */  svn_xml_make_open_tag(&sb, pool, svn_xml_normal, "entry",                        "path", svn_path_local_style(target, pool),                        "kind", svn_cl__node_kind_str(info->kind),                        "revision", rev_str,                        NULL);  svn_cl__xml_tagged_cdata(&sb, pool, "url", info->URL);  if (info->repos_root_URL || info->repos_UUID)    {      /* "<repository>" */      svn_xml_make_open_tag(&sb, pool, svn_xml_normal, "repository", NULL);      /* "<root> xx </root>" */      svn_cl__xml_tagged_cdata(&sb, pool, "root", info->repos_root_URL);      /* "<uuid> xx </uuid>" */      svn_cl__xml_tagged_cdata(&sb, pool, "uuid", info->repos_UUID);      /* "</repository>" */      svn_xml_make_close_tag(&sb, pool, "repository");    }  if (info->has_wc_info)    {      /* "<wc-info>" */      svn_xml_make_open_tag(&sb, pool, svn_xml_normal, "wc-info", NULL);      /* "<schedule> xx </schedule>" */      svn_cl__xml_tagged_cdata(&sb, pool, "schedule",                               schedule_str(info->schedule));      /* "<copy-from-url> xx </copy-from-url>" */      svn_cl__xml_tagged_cdata(&sb, pool, "copy-from-url",                               info->copyfrom_url);      /* "<copy-from-rev> xx </copy-from-rev>" */      if (SVN_IS_VALID_REVNUM(info->copyfrom_rev))        svn_cl__xml_tagged_cdata(&sb, pool, "copy-from-rev",                                 apr_psprintf(pool, "%ld",                                              info->copyfrom_rev));      /* "<text-updated> xx </text-updated>" */      if (info->text_time)        svn_cl__xml_tagged_cdata(&sb, pool, "text-updated",                                 svn_time_to_cstring(info->text_time, pool));      /* "<prop-updated> xx </prop-updated>" */      if (info->prop_time)        svn_cl__xml_tagged_cdata(&sb, pool, "prop-updated",                                 svn_time_to_cstring(info->prop_time, pool));      /* "<checksum> xx </checksum>" */      svn_cl__xml_tagged_cdata(&sb, pool, "checksum", info->checksum);      /* "</wc-info>" */      svn_xml_make_close_tag(&sb, pool, "wc-info");    }  if (info->last_changed_author      || SVN_IS_VALID_REVNUM(info->last_changed_rev)      || info->last_changed_date)    {      /* "<commit ...>" */      svn_xml_make_open_tag(&sb, pool, svn_xml_normal, "commit",                            "revision", apr_psprintf(pool, "%ld",                                                     info->last_changed_rev),                            NULL);      /* "<author> xx </author>" */      svn_cl__xml_tagged_cdata(&sb, pool, "author",                               info->last_changed_author);      /* "<date> xx </date>" */      if (info->last_changed_date)        svn_cl__xml_tagged_cdata(&sb, pool, "date",                                 svn_time_to_cstring                                 (info->last_changed_date, pool));      /* "</commit>" */      svn_xml_make_close_tag(&sb, pool, "commit");    }  if (info->conflict_old || info->conflict_wrk      || info->conflict_new || info->prejfile)    {      /* "<conflict>" */      svn_xml_make_open_tag(&sb, pool, svn_xml_normal, "conflict", NULL);      /* "<prev-base-file> xx </prev-base-file>" */      svn_cl__xml_tagged_cdata(&sb, pool, "prev-base-file",                               info->conflict_old);      /* "<prev-wc-file> xx </prev-wc-file>" */      svn_cl__xml_tagged_cdata(&sb, pool, "prev-wc-file",                               info->conflict_wrk);      /* "<cur-base-file> xx </cur-base-file>" */      svn_cl__xml_tagged_cdata(&sb, pool, "cur-base-file",                               info->conflict_new);      /* "<prop-file> xx </prop-file>" */      svn_cl__xml_tagged_cdata(&sb, pool, "prop-file", info->prejfile);      /* "</conflict>" */      svn_xml_make_close_tag(&sb, pool, "conflict");    }  if (info->lock)    {      /* "<lock>" */      svn_xml_make_open_tag(&sb, pool, svn_xml_normal, "lock", NULL);      /* "<token> xx </token>" */      svn_cl__xml_tagged_cdata(&sb, pool, "token", info->lock->token);      /* "<owner> xx </owner>" */      svn_cl__xml_tagged_cdata(&sb, pool, "owner", info->lock->owner);      /* "<comment ...> xxxx </comment>" */      svn_cl__xml_tagged_cdata(&sb, pool, "comment", info->lock->comment);      /* "<created> xx </created>" */      svn_cl__xml_tagged_cdata(&sb, pool, "created",                               svn_time_to_cstring                               (info->lock->creation_date, pool));      /* "<expires> xx </expires>" */      svn_cl__xml_tagged_cdata(&sb, pool, "expires",                               svn_time_to_cstring                               (info->lock->expiration_date, pool));      /* "</lock>" */      svn_xml_make_close_tag(&sb, pool, "lock");    }  /* "</entry>" */  svn_xml_make_close_tag(&sb, pool, "entry");  return svn_cl__error_checked_fputs(sb->data, stdout);}static svn_error_t *print_info(const char *target,           const svn_info_t *info,           apr_pool_t *pool){  SVN_ERR(svn_cmdline_printf(pool, _("Path: %s\n"),                             svn_path_local_style(target, pool)));

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -