1/*
2 * revision_status.c: report the revision range and status of a working copy
3 *
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
12 *
13 *      http://www.apache.org/licenses/LICENSE-2.0
14 *
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
20 *    under the License.
21 * ====================================================================
22 */
23
24#include "svn_wc.h"
25#include "svn_dirent_uri.h"
26#include "wc_db.h"
27#include "wc.h"
28#include "props.h"
29
30#include "private/svn_wc_private.h"
31
32#include "svn_private_config.h"
33
34svn_error_t *
35svn_wc_revision_status2(svn_wc_revision_status_t **result_p,
36                        svn_wc_context_t *wc_ctx,
37                        const char *local_abspath,
38                        const char *trail_url,
39                        svn_boolean_t committed,
40                        svn_cancel_func_t cancel_func,
41                        void *cancel_baton,
42                        apr_pool_t *result_pool,
43                        apr_pool_t *scratch_pool)
44{
45  svn_wc_revision_status_t *result = apr_pcalloc(result_pool, sizeof(*result));
46
47  *result_p = result;
48
49  SVN_ERR_ASSERT(svn_dirent_is_absolute(local_abspath));
50
51  /* set result as nil */
52  result->min_rev  = SVN_INVALID_REVNUM;
53  result->max_rev  = SVN_INVALID_REVNUM;
54  result->switched = FALSE;
55  result->modified = FALSE;
56  result->sparse_checkout = FALSE;
57
58  SVN_ERR(svn_wc__db_revision_status(&result->min_rev, &result->max_rev,
59                                     &result->sparse_checkout,
60                                     &result->modified,
61                                     &result->switched,
62                                     wc_ctx->db, local_abspath, trail_url,
63                                     committed,
64                                     scratch_pool));
65
66  if (!result->modified)
67    SVN_ERR(svn_wc__node_has_local_mods(&result->modified, NULL,
68                                        wc_ctx->db, local_abspath, TRUE,
69                                        cancel_func, cancel_baton,
70                                        scratch_pool));
71
72  return SVN_NO_ERROR;
73}
74