2 * changelist.c: implementation of the 'changelist' command
4 * ====================================================================
5 * Licensed to the Apache Software Foundation (ASF) under one
6 * or more contributor license agreements. See the NOTICE file
7 * distributed with this work for additional information
8 * regarding copyright ownership. The ASF licenses this file
9 * to you under the Apache License, Version 2.0 (the
10 * "License"); you may not use this file except in compliance
11 * with the License. You may obtain a copy of the License at
13 * http://www.apache.org/licenses/LICENSE-2.0
15 * Unless required by applicable law or agreed to in writing,
16 * software distributed under the License is distributed on an
17 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
18 * KIND, either express or implied. See the License for the
19 * specific language governing permissions and limitations
21 * ====================================================================
24 /* ==================================================================== */
30 #include "svn_client.h"
32 #include "svn_pools.h"
33 #include "svn_dirent_uri.h"
38 #include "private/svn_wc_private.h"
39 #include "svn_private_config.h"
45 svn_client_add_to_changelist(const apr_array_header_t *paths,
46 const char *changelist,
48 const apr_array_header_t *changelists,
49 svn_client_ctx_t *ctx,
52 apr_pool_t *iterpool = svn_pool_create(pool);
55 if (changelist[0] == '\0')
56 return svn_error_create(SVN_ERR_BAD_CHANGELIST_NAME, NULL,
57 _("Target changelist name must not be empty"));
59 for (i = 0; i < paths->nelts; i++)
61 const char *path = APR_ARRAY_IDX(paths, i, const char *);
63 if (svn_path_is_url(path))
64 return svn_error_createf(SVN_ERR_ILLEGAL_TARGET, NULL,
65 _("'%s' is not a local path"), path);
68 for (i = 0; i < paths->nelts; i++)
70 const char *path = APR_ARRAY_IDX(paths, i, const char *);
71 const char *local_abspath;
73 svn_pool_clear(iterpool);
74 SVN_ERR(svn_dirent_get_absolute(&local_abspath, path, iterpool));
76 SVN_ERR(svn_wc_set_changelist2(ctx->wc_ctx, local_abspath, changelist,
78 ctx->cancel_func, ctx->cancel_baton,
79 ctx->notify_func2, ctx->notify_baton2,
83 svn_pool_destroy(iterpool);
89 svn_client_remove_from_changelists(const apr_array_header_t *paths,
91 const apr_array_header_t *changelists,
92 svn_client_ctx_t *ctx,
95 apr_pool_t *iterpool = svn_pool_create(pool);
98 for (i = 0; i < paths->nelts; i++)
100 const char *path = APR_ARRAY_IDX(paths, i, const char *);
102 if (svn_path_is_url(path))
103 return svn_error_createf(SVN_ERR_ILLEGAL_TARGET, NULL,
104 _("'%s' is not a local path"), path);
107 for (i = 0; i < paths->nelts; i++)
109 const char *path = APR_ARRAY_IDX(paths, i, const char *);
110 const char *local_abspath;
112 svn_pool_clear(iterpool);
113 SVN_ERR(svn_dirent_get_absolute(&local_abspath, path, iterpool));
115 SVN_ERR(svn_wc_set_changelist2(ctx->wc_ctx, local_abspath, NULL,
117 ctx->cancel_func, ctx->cancel_baton,
118 ctx->notify_func2, ctx->notify_baton2,
122 svn_pool_destroy(iterpool);
128 svn_client_get_changelists(const char *path,
129 const apr_array_header_t *changelists,
131 svn_changelist_receiver_t callback_func,
132 void *callback_baton,
133 svn_client_ctx_t *ctx,
136 const char *local_abspath;
138 SVN_ERR(svn_dirent_get_absolute(&local_abspath, path, pool));
140 SVN_ERR(svn_wc_get_changelists(ctx->wc_ctx, local_abspath, depth, changelists,
141 callback_func, callback_baton,
142 ctx->cancel_func, ctx->cancel_baton, pool));