1251881Speter/* 2251881Speter * upgrade-cmd.c -- Upgrade a working copy. 3251881Speter * 4251881Speter * ==================================================================== 5251881Speter * Licensed to the Apache Software Foundation (ASF) under one 6251881Speter * or more contributor license agreements. See the NOTICE file 7251881Speter * distributed with this work for additional information 8251881Speter * regarding copyright ownership. The ASF licenses this file 9251881Speter * to you under the Apache License, Version 2.0 (the 10251881Speter * "License"); you may not use this file except in compliance 11251881Speter * with the License. You may obtain a copy of the License at 12251881Speter * 13251881Speter * http://www.apache.org/licenses/LICENSE-2.0 14251881Speter * 15251881Speter * Unless required by applicable law or agreed to in writing, 16251881Speter * software distributed under the License is distributed on an 17251881Speter * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 18251881Speter * KIND, either express or implied. See the License for the 19251881Speter * specific language governing permissions and limitations 20251881Speter * under the License. 21251881Speter * ==================================================================== 22251881Speter */ 23251881Speter 24251881Speter/* ==================================================================== */ 25251881Speter 26251881Speter 27251881Speter 28251881Speter/*** Includes. ***/ 29251881Speter 30251881Speter#include "svn_pools.h" 31251881Speter#include "svn_client.h" 32251881Speter#include "svn_error_codes.h" 33251881Speter#include "svn_error.h" 34251881Speter#include "svn_path.h" 35251881Speter#include "cl.h" 36251881Speter#include "svn_private_config.h" 37251881Speter 38251881Speter 39251881Speter/*** Code. ***/ 40251881Speter 41251881Speter 42251881Speter/* This implements the `svn_opt_subcommand_t' interface. */ 43251881Spetersvn_error_t * 44251881Spetersvn_cl__upgrade(apr_getopt_t *os, 45251881Speter void *baton, 46251881Speter apr_pool_t *scratch_pool) 47251881Speter{ 48251881Speter svn_cl__opt_state_t *opt_state = ((svn_cl__cmd_baton_t *) baton)->opt_state; 49251881Speter svn_client_ctx_t *ctx = ((svn_cl__cmd_baton_t *) baton)->ctx; 50251881Speter apr_array_header_t *targets; 51251881Speter apr_pool_t *iterpool; 52251881Speter int i; 53251881Speter 54251881Speter SVN_ERR(svn_cl__args_to_target_array_print_reserved(&targets, os, 55251881Speter opt_state->targets, 56251881Speter ctx, FALSE, 57251881Speter scratch_pool)); 58251881Speter 59251881Speter /* Add "." if user passed 0 arguments */ 60251881Speter svn_opt_push_implicit_dot_target(targets, scratch_pool); 61251881Speter 62251881Speter SVN_ERR(svn_cl__eat_peg_revisions(&targets, targets, scratch_pool)); 63251881Speter 64251881Speter SVN_ERR(svn_cl__check_targets_are_local_paths(targets)); 65251881Speter 66251881Speter iterpool = svn_pool_create(scratch_pool); 67251881Speter for (i = 0; i < targets->nelts; i++) 68251881Speter { 69251881Speter const char *target = APR_ARRAY_IDX(targets, i, const char *); 70251881Speter 71251881Speter svn_pool_clear(iterpool); 72251881Speter SVN_ERR(svn_cl__check_cancel(ctx->cancel_baton)); 73251881Speter SVN_ERR(svn_client_upgrade(target, ctx, scratch_pool)); 74251881Speter } 75251881Speter svn_pool_destroy(iterpool); 76251881Speter 77251881Speter return SVN_NO_ERROR; 78251881Speter} 79