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

« back to all changes in this revision

Viewing changes to subversion/libsvn_client/checkout.c

  • Committer: Package Import Robot
  • Author(s): James McCoy
  • Date: 2015-08-07 21:32:47 UTC
  • mfrom: (0.2.15) (4.1.7 experimental)
  • Revision ID: package-import@ubuntu.com-20150807213247-ozyewtmgsr6tkewl
Tags: 1.9.0-1
* Upload to unstable
* New upstream release.
  + Security fixes
    - CVE-2015-3184: Mixed anonymous/authenticated path-based authz with
      httpd 2.4
    - CVE-2015-3187: svn_repos_trace_node_locations() reveals paths hidden
      by authz
* Add >= 2.7 requirement for python-all-dev Build-Depends, needed to run
  tests.
* Remove Build-Conflicts against ruby-test-unit.  (Closes: #791844)
* Remove patches/apache_module_dependency in favor of expressing the
  dependencies in authz_svn.load/dav_svn.load.
* Build-Depend on apache2-dev (>= 2.4.16) to ensure ap_some_authn_required()
  is available when building mod_authz_svn and Depend on apache2-bin (>=
  2.4.16) for runtime support.

Show diffs side-by-side

added added

removed removed

Lines of Context:
67
67
 
68
68
svn_error_t *
69
69
svn_client__checkout_internal(svn_revnum_t *result_rev,
 
70
                              svn_boolean_t *timestamp_sleep,
70
71
                              const char *url,
71
72
                              const char *local_abspath,
72
73
                              const svn_opt_revision_t *peg_revision,
74
75
                              svn_depth_t depth,
75
76
                              svn_boolean_t ignore_externals,
76
77
                              svn_boolean_t allow_unver_obstructions,
77
 
                              svn_boolean_t *timestamp_sleep,
 
78
                              svn_ra_session_t *ra_session,
78
79
                              svn_client_ctx_t *ctx,
79
 
                              apr_pool_t *pool)
 
80
                              apr_pool_t *scratch_pool)
80
81
{
81
82
  svn_node_kind_t kind;
82
 
  apr_pool_t *session_pool = svn_pool_create(pool);
83
 
  svn_ra_session_t *ra_session;
84
83
  svn_client__pathrev_t *pathrev;
85
84
 
86
85
  /* Sanity check.  Without these, the checkout is meaningless. */
87
86
  SVN_ERR_ASSERT(local_abspath != NULL);
88
 
  SVN_ERR_ASSERT(svn_uri_is_canonical(url, pool));
 
87
  SVN_ERR_ASSERT(svn_uri_is_canonical(url, scratch_pool));
89
88
  SVN_ERR_ASSERT(svn_dirent_is_absolute(local_abspath));
90
89
 
91
90
  /* Fulfill the docstring promise of svn_client_checkout: */
94
93
      && (revision->kind != svn_opt_revision_head))
95
94
    return svn_error_create(SVN_ERR_CLIENT_BAD_REVISION, NULL, NULL);
96
95
 
97
 
  /* Get the RA connection. */
98
 
  SVN_ERR(svn_client__ra_session_from_path2(&ra_session, &pathrev,
99
 
                                            url, NULL, peg_revision, revision,
100
 
                                            ctx, session_pool));
101
 
 
102
 
  pathrev = svn_client__pathrev_dup(pathrev, pool);
103
 
  SVN_ERR(svn_ra_check_path(ra_session, "", pathrev->rev, &kind, pool));
104
 
 
105
 
  svn_pool_destroy(session_pool);
 
96
  /* Get the RA connection, if needed. */
 
97
  if (ra_session)
 
98
    {
 
99
      svn_error_t *err = svn_ra_reparent(ra_session, url, scratch_pool);
 
100
 
 
101
      if (err)
 
102
        {
 
103
          if (err->apr_err == SVN_ERR_RA_ILLEGAL_URL)
 
104
            {
 
105
              svn_error_clear(err);
 
106
              ra_session = NULL;
 
107
            }
 
108
          else
 
109
            return svn_error_trace(err);
 
110
        }
 
111
      else
 
112
        {
 
113
          SVN_ERR(svn_client__resolve_rev_and_url(&pathrev,
 
114
                                                  ra_session, url,
 
115
                                                  peg_revision, revision,
 
116
                                                  ctx, scratch_pool));
 
117
        }
 
118
    }
 
119
 
 
120
  if (!ra_session)
 
121
    {
 
122
      SVN_ERR(svn_client__ra_session_from_path2(&ra_session, &pathrev,
 
123
                                                url, NULL, peg_revision,
 
124
                                                revision, ctx, scratch_pool));
 
125
    }
 
126
 
 
127
  SVN_ERR(svn_ra_check_path(ra_session, "", pathrev->rev, &kind, scratch_pool));
106
128
 
107
129
  if (kind == svn_node_none)
108
130
    return svn_error_createf(SVN_ERR_RA_ILLEGAL_URL, NULL,
112
134
      (SVN_ERR_UNSUPPORTED_FEATURE , NULL,
113
135
       _("URL '%s' refers to a file, not a directory"), pathrev->url);
114
136
 
115
 
  SVN_ERR(svn_io_check_path(local_abspath, &kind, pool));
 
137
  SVN_ERR(svn_io_check_path(local_abspath, &kind, scratch_pool));
116
138
 
117
139
  if (kind == svn_node_none)
118
140
    {
119
141
      /* Bootstrap: create an incomplete working-copy root dir.  Its
120
142
         entries file should only have an entry for THIS_DIR with a
121
143
         URL, revnum, and an 'incomplete' flag.  */
122
 
      SVN_ERR(svn_io_make_dir_recursively(local_abspath, pool));
123
 
      SVN_ERR(initialize_area(local_abspath, pathrev, depth, ctx, pool));
 
144
      SVN_ERR(svn_io_make_dir_recursively(local_abspath, scratch_pool));
 
145
      SVN_ERR(initialize_area(local_abspath, pathrev, depth, ctx,
 
146
                              scratch_pool));
124
147
    }
125
148
  else if (kind == svn_node_dir)
126
149
    {
127
150
      int wc_format;
128
151
      const char *entry_url;
129
152
 
130
 
      SVN_ERR(svn_wc_check_wc2(&wc_format, ctx->wc_ctx, local_abspath, pool));
 
153
      SVN_ERR(svn_wc_check_wc2(&wc_format, ctx->wc_ctx, local_abspath,
 
154
                               scratch_pool));
 
155
 
131
156
      if (! wc_format)
132
157
        {
133
 
          SVN_ERR(initialize_area(local_abspath, pathrev, depth, ctx, pool));
 
158
          SVN_ERR(initialize_area(local_abspath, pathrev, depth, ctx,
 
159
                                  scratch_pool));
134
160
        }
135
161
      else
136
162
        {
137
163
          /* Get PATH's URL. */
138
164
          SVN_ERR(svn_wc__node_get_url(&entry_url, ctx->wc_ctx, local_abspath,
139
 
                                       pool, pool));
 
165
                                       scratch_pool, scratch_pool));
140
166
 
141
167
          /* If PATH's existing URL matches the incoming one, then
142
168
             just update.  This allows 'svn co' to restart an
146
172
                          SVN_ERR_WC_OBSTRUCTED_UPDATE, NULL,
147
173
                          _("'%s' is already a working copy for a"
148
174
                            " different URL"),
149
 
                          svn_dirent_local_style(local_abspath, pool));
 
175
                          svn_dirent_local_style(local_abspath, scratch_pool));
150
176
        }
151
177
    }
152
178
  else
153
179
    {
154
180
      return svn_error_createf(SVN_ERR_WC_NODE_KIND_CHANGE, NULL,
155
181
                               _("'%s' already exists and is not a directory"),
156
 
                               svn_dirent_local_style(local_abspath, pool));
 
182
                               svn_dirent_local_style(local_abspath,
 
183
                                                      scratch_pool));
157
184
    }
158
185
 
159
186
  /* Have update fix the incompleteness. */
160
 
  SVN_ERR(svn_client__update_internal(result_rev, local_abspath,
161
 
                                      revision, depth, TRUE,
 
187
  SVN_ERR(svn_client__update_internal(result_rev, timestamp_sleep,
 
188
                                      local_abspath, revision, depth, TRUE,
162
189
                                      ignore_externals,
163
190
                                      allow_unver_obstructions,
164
191
                                      TRUE /* adds_as_modification */,
165
 
                                      FALSE, FALSE,
166
 
                                      timestamp_sleep, ctx, pool));
 
192
                                      FALSE, FALSE, ra_session,
 
193
                                      ctx, scratch_pool));
167
194
 
168
195
  return SVN_NO_ERROR;
169
196
}
186
213
 
187
214
  SVN_ERR(svn_dirent_get_absolute(&local_abspath, path, pool));
188
215
 
189
 
  err = svn_client__checkout_internal(result_rev, URL, local_abspath,
 
216
  err = svn_client__checkout_internal(result_rev, &sleep_here,
 
217
                                      URL, local_abspath,
190
218
                                      peg_revision, revision, depth,
191
219
                                      ignore_externals,
192
 
                                      allow_unver_obstructions, &sleep_here,
 
220
                                      allow_unver_obstructions,
 
221
                                      NULL /* ra_session */,
193
222
                                      ctx, pool);
194
223
  if (sleep_here)
195
224
    svn_io_sleep_for_timestamps(local_abspath, pool);