~ubuntu-branches/debian/sid/subversion/sid

« back to all changes in this revision

Viewing changes to subversion/libsvn_subr/kitchensink.c

  • Committer: Package Import Robot
  • Author(s): James McCoy, Peter Samuelson, James McCoy
  • Date: 2014-01-12 19:48:33 UTC
  • mfrom: (0.2.10)
  • Revision ID: package-import@ubuntu.com-20140112194833-w3axfwksn296jn5x
Tags: 1.8.5-1
[ Peter Samuelson ]
* New upstream release.  (Closes: #725787) Rediff patches:
  - Remove apr-abi1 (applied upstream), rename apr-abi2 to apr-abi
  - Remove loosen-sqlite-version-check (shouldn't be needed)
  - Remove java-osgi-metadata (applied upstream)
  - svnmucc prompts for a changelog if none is provided. (Closes: #507430)
  - Remove fix-bdb-version-detection, upstream uses "apu-config --dbm-libs"
  - Remove ruby-test-wc (applied upstream)
  - Fix “svn diff -r N file” when file has svn:mime-type set.
    (Closes: #734163)
  - Support specifying an encoding for mod_dav_svn's environment in which
    hooks are run.  (Closes: #601544)
  - Fix ordering of “svnadmin dump” paths with certain APR versions.
    (Closes: #687291)
  - Provide a better error message when authentication fails with an
    svn+ssh:// URL.  (Closes: #273874)
  - Updated Polish translations.  (Closes: #690815)

[ James McCoy ]
* Remove all traces of libneon, replaced by libserf.
* patches/sqlite_3.8.x_workaround: Upstream fix for wc-queries-test test
  failurse.
* Run configure with --with-apache-libexecdir, which allows removing part of
  patches/rpath.
* Re-enable auth-test as upstream has fixed the problem of picking up
  libraries from the environment rather than the build tree.
  (Closes: #654172)
* Point LD_LIBRARY_PATH at the built auth libraries when running the svn
  command during the build.  (Closes: #678224)
* Add a NEWS entry describing how to configure mod_dav_svn to understand
  UTF-8.  (Closes: #566148)
* Remove ancient transitional package, libsvn-ruby.
* Enable compatibility with Sqlite3 versions back to Wheezy.
* Enable hardening flags.  (Closes: #734918)
* patches/build-fixes: Enable verbose build logs.
* Build against the default ruby version.  (Closes: #722393)

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
/*
2
 
 * kitchensink.c :  When no place else seems to fit...
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 <apr_pools.h>
25
 
#include <apr_uuid.h>
26
 
 
27
 
#include "svn_types.h"
28
 
#include "svn_error.h"
29
 
#include "svn_mergeinfo.h"
30
 
#include "svn_private_config.h"
31
 
 
32
 
svn_error_t *
33
 
svn_revnum_parse(svn_revnum_t *rev,
34
 
                 const char *str,
35
 
                 const char **endptr)
36
 
{
37
 
  char *end;
38
 
 
39
 
  svn_revnum_t result = strtol(str, &end, 10);
40
 
 
41
 
  if (endptr)
42
 
    *endptr = end;
43
 
 
44
 
  if (str == end)
45
 
    return svn_error_createf(SVN_ERR_REVNUM_PARSE_FAILURE, NULL,
46
 
                             _("Invalid revision number found parsing '%s'"),
47
 
                             str);
48
 
 
49
 
  if (result < 0)
50
 
    {
51
 
      /* The end pointer from strtol() is valid, but a negative revision
52
 
         number is invalid, so move the end pointer back to the
53
 
         beginning of the string. */
54
 
      if (endptr)
55
 
        *endptr = str;
56
 
 
57
 
      return svn_error_createf(SVN_ERR_REVNUM_PARSE_FAILURE, NULL,
58
 
                               _("Negative revision number found parsing '%s'"),
59
 
                               str);
60
 
    }
61
 
 
62
 
  *rev = result;
63
 
 
64
 
  return SVN_NO_ERROR;
65
 
}
66
 
 
67
 
const char *
68
 
svn_uuid_generate(apr_pool_t *pool)
69
 
{
70
 
  apr_uuid_t uuid;
71
 
  char *uuid_str = apr_pcalloc(pool, APR_UUID_FORMATTED_LENGTH + 1);
72
 
  apr_uuid_get(&uuid);
73
 
  apr_uuid_format(uuid_str, &uuid);
74
 
  return uuid_str;
75
 
}
76
 
 
77
 
const char *
78
 
svn_depth_to_word(svn_depth_t depth)
79
 
{
80
 
  switch (depth)
81
 
    {
82
 
    case svn_depth_exclude:
83
 
      return "exclude";
84
 
    case svn_depth_unknown:
85
 
      return "unknown";
86
 
    case svn_depth_empty:
87
 
      return "empty";
88
 
    case svn_depth_files:
89
 
      return "files";
90
 
    case svn_depth_immediates:
91
 
      return "immediates";
92
 
    case svn_depth_infinity:
93
 
      return "infinity";
94
 
    default:
95
 
      return "INVALID-DEPTH";
96
 
    }
97
 
}
98
 
 
99
 
 
100
 
svn_depth_t
101
 
svn_depth_from_word(const char *word)
102
 
{
103
 
  if (strcmp(word, "exclude") == 0)
104
 
    return svn_depth_exclude;
105
 
  if (strcmp(word, "unknown") == 0)
106
 
    return svn_depth_unknown;
107
 
  if (strcmp(word, "empty") == 0)
108
 
    return svn_depth_empty;
109
 
  if (strcmp(word, "files") == 0)
110
 
    return svn_depth_files;
111
 
  if (strcmp(word, "immediates") == 0)
112
 
    return svn_depth_immediates;
113
 
  if (strcmp(word, "infinity") == 0)
114
 
    return svn_depth_infinity;
115
 
  /* There's no special value for invalid depth, and no convincing
116
 
     reason to make one yet, so just fall back to unknown depth.
117
 
     If you ever change that convention, check callers to make sure
118
 
     they're not depending on it (e.g., option parsing in main() ).
119
 
  */
120
 
  return svn_depth_unknown;
121
 
}
122
 
 
123
 
const char *
124
 
svn_inheritance_to_word(svn_mergeinfo_inheritance_t inherit)
125
 
{
126
 
  switch (inherit)
127
 
    {
128
 
    case svn_mergeinfo_inherited:
129
 
      return "inherited";
130
 
    case svn_mergeinfo_nearest_ancestor:
131
 
      return "nearest-ancestor";
132
 
    default:
133
 
      return "explicit";
134
 
    }
135
 
}
136
 
 
137
 
 
138
 
svn_mergeinfo_inheritance_t
139
 
svn_inheritance_from_word(const char *word)
140
 
{
141
 
  if (strcmp(word, "inherited") == 0)
142
 
    return svn_mergeinfo_inherited;
143
 
  if (strcmp(word, "nearest-ancestor") == 0)
144
 
    return svn_mergeinfo_nearest_ancestor;
145
 
  return svn_mergeinfo_explicit;
146
 
}
147
 
 
148
 
const char *
149
 
svn_node_kind_to_word(svn_node_kind_t kind)
150
 
{
151
 
  switch (kind)
152
 
    {
153
 
    case svn_node_none:
154
 
      return "none";
155
 
    case svn_node_file:
156
 
      return "file";
157
 
    case svn_node_dir:
158
 
      return "dir";
159
 
    case svn_node_unknown:
160
 
    default:
161
 
      return "unknown";
162
 
    }
163
 
}
164
 
 
165
 
 
166
 
svn_node_kind_t
167
 
svn_node_kind_from_word(const char *word)
168
 
{
169
 
  if (word == NULL)
170
 
    return svn_node_unknown;
171
 
 
172
 
  if (strcmp(word, "none") == 0)
173
 
    return svn_node_none;
174
 
  else if (strcmp(word, "file") == 0)
175
 
    return svn_node_file;
176
 
  else if (strcmp(word, "dir") == 0)
177
 
    return svn_node_dir;
178
 
  else
179
 
    /* This also handles word == "unknown" */
180
 
    return svn_node_unknown;
181
 
}
182
 
 
183
 
const char *
184
 
svn_tristate__to_word(svn_tristate_t tristate)
185
 
{
186
 
  switch (tristate)
187
 
    {
188
 
      case svn_tristate_false:
189
 
        return "false";
190
 
      case svn_tristate_true:
191
 
        return "true";
192
 
      case svn_tristate_unknown:
193
 
      default:
194
 
        return NULL;
195
 
    }
196
 
}
197
 
 
198
 
svn_tristate_t
199
 
svn_tristate__from_word(const char *word)
200
 
{
201
 
  if (word == NULL)
202
 
    return svn_tristate_unknown;
203
 
  else if (0 == svn_cstring_casecmp(word, "true")
204
 
           || 0 == svn_cstring_casecmp(word, "yes")
205
 
           || 0 == svn_cstring_casecmp(word, "on")
206
 
           || 0 == strcmp(word, "1"))
207
 
    return svn_tristate_true;
208
 
  else if (0 == svn_cstring_casecmp(word, "false")
209
 
           || 0 == svn_cstring_casecmp(word, "no")
210
 
           || 0 == svn_cstring_casecmp(word, "off")
211
 
           || 0 == strcmp(word, "0"))
212
 
    return svn_tristate_false;
213
 
 
214
 
  return svn_tristate_unknown;
215
 
}