参考 文章
svn_error_t *
svn_client_checkout3(svn_revnum_t *result_rev,
const char *URL,
const char *path,
const svn_opt_revision_t *peg_revision,
const svn_opt_revision_t *revision,
svn_depth_t depth,
svn_boolean_t ignore_externals,
svn_boolean_t allow_unver_obstructions,
svn_client_ctx_t *ctx,
apr_pool_t *pool);
result_rev:如果参数不为空,返回当前版本信息即WC Version;
URL:要checkout的svn url路径;
path:本地目录
peg_revision:根据资料来看,跟extern外部引用trunk有关,跟revision一样即可;
revision:指定要checkout的版本;
depth:checkout目录层数,一般设置svn_depth_infinity全部获取
ignore_externals:忽略外部链接版本,即tsvn客户端的omit externals,一般设置false
allow_unver_obstructions:false即可;
ctx:client ctx;
pool:apr pool;
If neither revision is specified, it is effectively an operative revision of HEAD. In that case, the search starts with the HEAD of the repo, it THEN gets the path. If the path doesn't exist in the HEAD, it won't be found, resulting in a path not found error. The extern needs to start the search with a revision where the path existed - a peg revision can do just that.
I always set the peg revision for my externals to ensure that if I checkout a particular revision of the main repo, I'm always building the same code. Without a specified revision for the extern, checking out the same revision from the main repo at different times will generate different results (because the externs could be different).
As I said, the Subversion Red Book probably explains it better than me, and there's always the risk that I'm wrong. [However, it is based on having a similar issue and trying to overcome it.]
HTH,
Bruce
This email and any attachments or links herein are confidential and may contain Metrol Technology Limited proprietary information that is legally privileged or otherwise protected from disclosure. It is solely intended for the person(s) named above. If you are not the intended recipient, any reading, use, disclosure, copying or distribution of all or parts of this email or associated attachments or links to other web locations, is strictly prohibited. If you are not the intended recipient, please notify the sender immediately by replying to this message or by telephone and delete this email and any attachments or links permanently from your system. Metrol accepts no liability for any damage of whatever nature caused by this email.
设置回调函数notify_func或notify_func2
#
pCtxActual->notify_func = (svn_wc_notify_func_t)CActionCheckout::notify_func;
#
void* CActionCheckout::notify_func(void *baton,
const char *path,
svn_wc_notify_action_t action,
svn_node_kind_t kind,
const char *mime_type,
svn_wc_notify_state_t content_state,
svn_wc_notify_state_t prop_state,
svn_revnum_t revision) {
//打印checkout文件信息
CLogger4Cpp::GetInstance()->Debug("checkout %s", path);
//
return NULL;
}
svn_error_t *
svn_client_update3(apr_array_header_t **result_revs,
const apr_array_header_t *paths,
const svn_opt_revision_t *revision,
svn_depth_t depth,
svn_boolean_t depth_is_sticky,
svn_boolean_t ignore_externals,
svn_boolean_t allow_unver_obstructions,
svn_client_ctx_t *ctx,
apr_pool_t *pool);
设置回调函数notify_func或notify_func2
#
pCtxActual->notify_func = (svn_wc_notify_func_t)checkout::notify_func;
#
void* checkout::notify_func(void *baton,
const char *path,
svn_wc_notify_action_t action,
svn_node_kind_t kind,
const char *mime_type,
svn_wc_notify_state_t content_state,
svn_wc_notify_state_t prop_state,
svn_revnum_t revision) {
//打印Update文件信息
CLogger4Cpp::GetInstance()->Debug("update %s", path);
//
return NULL;
}
svn_error_t *
svn_client_info2(const char *path_or_url,
const svn_opt_revision_t *peg_revision,
const svn_opt_revision_t *revision,
svn_info_receiver_t receiver,
void *receiver_baton,
svn_depth_t depth,
const apr_array_header_t *changelists,
svn_client_ctx_t *ctx,
apr_pool_t *pool);
如果peg_revision跟revision设置为NULL,查询获取的是本地副本的信息,这个也才是一般情况比较关心的,否则就获取svn版本上的信息;
#
svn_error_t *CActionInfo::svn_info_receiver_t
(void *baton,
const char *path,
const svn_info_t *info,
apr_pool_t *pool) {
//
CActionInfo* pParent = NULL;
//
if (baton == NULL) {
goto exit;
}
if (info == NULL) {
goto exit;
}
//
pParent = (CActionInfo*)(baton);
//
pParent->m_workCopyVersion = info->last_changed_rev;
//
exit: return NULL;
}
基于subversion1.6.3动态库实现简单版本管理.rar (访问密码: 1150)