1289177Speter/* 2289177Speter * util.c: Subversion command line client utility functions. Any 3289177Speter * functions that need to be shared across subcommands should be put 4289177Speter * in here. 5289177Speter * 6289177Speter * ==================================================================== 7289177Speter * Licensed to the Apache Software Foundation (ASF) under one 8289177Speter * or more contributor license agreements. See the NOTICE file 9289177Speter * distributed with this work for additional information 10289177Speter * regarding copyright ownership. The ASF licenses this file 11289177Speter * to you under the Apache License, Version 2.0 (the 12289177Speter * "License"); you may not use this file except in compliance 13289177Speter * with the License. You may obtain a copy of the License at 14289177Speter * 15289177Speter * http://www.apache.org/licenses/LICENSE-2.0 16289177Speter * 17289177Speter * Unless required by applicable law or agreed to in writing, 18289177Speter * software distributed under the License is distributed on an 19289177Speter * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 20289177Speter * KIND, either express or implied. See the License for the 21289177Speter * specific language governing permissions and limitations 22289177Speter * under the License. 23289177Speter * ==================================================================== 24289177Speter */ 25289177Speter 26289177Speter/* ==================================================================== */ 27289177Speter 28289177Speter 29289177Speter 30289177Speter/*** Includes. ***/ 31289177Speter 32289177Speter#include <string.h> 33289177Speter#include <ctype.h> 34289177Speter#include <assert.h> 35289177Speter 36289177Speter#include "svn_private_config.h" 37289177Speter#include "svn_error.h" 38289177Speter#include "svn_path.h" 39289177Speter 40289177Speter#include "cl.h" 41289177Speter 42289177Speter 43289177Speter 44289177Spetersvn_error_t * 45289177Spetersvn_cl__args_to_target_array_print_reserved(apr_array_header_t **targets, 46289177Speter apr_getopt_t *os, 47289177Speter const apr_array_header_t *known_targets, 48289177Speter svn_client_ctx_t *ctx, 49289177Speter svn_boolean_t keep_last_origpath_on_truepath_collision, 50289177Speter apr_pool_t *pool) 51289177Speter{ 52289177Speter svn_error_t *err = svn_client_args_to_target_array2(targets, 53289177Speter os, 54289177Speter known_targets, 55289177Speter ctx, 56289177Speter keep_last_origpath_on_truepath_collision, 57289177Speter pool); 58289177Speter if (err) 59289177Speter { 60289177Speter if (err->apr_err == SVN_ERR_RESERVED_FILENAME_SPECIFIED) 61289177Speter { 62289177Speter svn_handle_error2(err, stderr, FALSE, "svn: Skipping argument: "); 63289177Speter svn_error_clear(err); 64289177Speter } 65289177Speter else 66289177Speter return svn_error_trace(err); 67289177Speter } 68289177Speter return SVN_NO_ERROR; 69289177Speter} 70289177Speter 71289177Spetersvn_error_t * 72289177Spetersvn_cl__check_target_is_local_path(const char *target) 73289177Speter{ 74289177Speter if (svn_path_is_url(target)) 75289177Speter return svn_error_createf(SVN_ERR_CL_ARG_PARSING_ERROR, NULL, 76289177Speter _("'%s' is not a local path"), target); 77289177Speter return SVN_NO_ERROR; 78289177Speter} 79289177Speter 80289177Speterconst char * 81289177Spetersvn_cl__local_style_skip_ancestor(const char *parent_path, 82289177Speter const char *path, 83289177Speter apr_pool_t *pool) 84289177Speter{ 85289177Speter const char *relpath = NULL; 86289177Speter 87289177Speter if (parent_path) 88289177Speter relpath = svn_dirent_skip_ancestor(parent_path, path); 89289177Speter 90289177Speter return svn_dirent_local_style(relpath ? relpath : path, pool); 91289177Speter} 92289177Speter 93