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

« back to all changes in this revision

Viewing changes to subversion/svn/blame-cmd.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:
31
31
#include "svn_pools.h"
32
32
#include "svn_props.h"
33
33
#include "svn_cmdline.h"
 
34
#include "svn_sorts.h"
34
35
#include "svn_xml.h"
35
36
#include "svn_time.h"
36
37
#include "cl.h"
42
43
  svn_cl__opt_state_t *opt_state;
43
44
  svn_stream_t *out;
44
45
  svn_stringbuf_t *sbuf;
 
46
 
 
47
  int rev_maxlength;
45
48
} blame_baton_t;
46
49
 
47
50
 
63
66
                   svn_boolean_t local_change,
64
67
                   apr_pool_t *pool)
65
68
{
66
 
  svn_cl__opt_state_t *opt_state =
67
 
    ((blame_baton_t *) baton)->opt_state;
68
 
  svn_stringbuf_t *sb = ((blame_baton_t *) baton)->sbuf;
 
69
  blame_baton_t *bb = baton;
 
70
  svn_cl__opt_state_t *opt_state = bb->opt_state;
 
71
  svn_stringbuf_t *sb = bb->sbuf;
69
72
 
70
73
  /* "<entry ...>" */
71
74
  /* line_no is 0-based, but the rest of the world is probably Pascal
74
77
                        "line-number",
75
78
                        apr_psprintf(pool, "%" APR_INT64_T_FMT,
76
79
                                     line_no + 1),
77
 
                        NULL);
 
80
                        SVN_VA_NULL);
78
81
 
79
82
  if (SVN_IS_VALID_REVNUM(revision))
80
83
    svn_cl__print_xml_commit(&sb, revision,
88
91
    {
89
92
      /* "<merged>" */
90
93
      svn_xml_make_open_tag(&sb, pool, svn_xml_normal, "merged",
91
 
                            "path", merged_path, NULL);
 
94
                            "path", merged_path, SVN_VA_NULL);
92
95
 
93
96
      svn_cl__print_xml_commit(&sb, merged_revision,
94
97
                             svn_prop_get_value(merged_rev_props,
119
122
                const char *date,
120
123
                const char *path,
121
124
                svn_boolean_t verbose,
122
 
                svn_revnum_t end_revnum,
 
125
                int rev_maxlength,
123
126
                apr_pool_t *pool)
124
127
{
125
128
  const char *time_utf8;
126
129
  const char *time_stdout;
127
130
  const char *rev_str;
128
 
  int rev_maxlength;
129
131
 
130
 
  /* The standard column width for the revision number is 6 characters.
131
 
     If the revision number can potentially be larger (i.e. if the end_revnum
132
 
     is larger than 1000000), we increase the column width as needed. */
133
 
  rev_maxlength = 6;
134
 
  while (end_revnum >= 1000000)
135
 
    {
136
 
      rev_maxlength++;
137
 
      end_revnum = end_revnum / 10;
138
 
    }
139
132
  rev_str = SVN_IS_VALID_REVNUM(revision)
140
133
    ? apr_psprintf(pool, "%*ld", rev_maxlength, revision)
141
134
    : apr_psprintf(pool, "%*s", rev_maxlength, "-");
189
182
               svn_boolean_t local_change,
190
183
               apr_pool_t *pool)
191
184
{
192
 
  svn_cl__opt_state_t *opt_state =
193
 
    ((blame_baton_t *) baton)->opt_state;
194
 
  svn_stream_t *out = ((blame_baton_t *)baton)->out;
 
185
  blame_baton_t *bb = baton;
 
186
  svn_cl__opt_state_t *opt_state = bb->opt_state;
 
187
  svn_stream_t *out = bb->out;
195
188
  svn_boolean_t use_merged = FALSE;
196
189
 
 
190
  if (!bb->rev_maxlength)
 
191
    {
 
192
      svn_revnum_t max_revnum = MAX(start_revnum, end_revnum);
 
193
      /* The standard column width for the revision number is 6 characters.
 
194
         If the revision number can potentially be larger (i.e. if the end_revnum
 
195
          is larger than 1000000), we increase the column width as needed. */
 
196
 
 
197
      bb->rev_maxlength = 6;
 
198
      while (max_revnum >= 1000000)
 
199
        {
 
200
          bb->rev_maxlength++;
 
201
          max_revnum = max_revnum / 10;
 
202
        }
 
203
    }
 
204
 
197
205
  if (opt_state->use_merge_history)
198
206
    {
199
207
      /* Choose which revision to use.  If they aren't equal, prefer the
216
224
                                               SVN_PROP_REVISION_AUTHOR),
217
225
                            svn_prop_get_value(merged_rev_props,
218
226
                                               SVN_PROP_REVISION_DATE),
219
 
                            merged_path, opt_state->verbose, end_revnum,
 
227
                            merged_path, opt_state->verbose,
 
228
                            bb->rev_maxlength,
220
229
                            pool));
221
230
  else
222
231
    SVN_ERR(print_line_info(out, revision,
224
233
                                               SVN_PROP_REVISION_AUTHOR),
225
234
                            svn_prop_get_value(rev_props,
226
235
                                               SVN_PROP_REVISION_DATE),
227
 
                            NULL, opt_state->verbose, end_revnum,
 
236
                            NULL, opt_state->verbose,
 
237
                            bb->rev_maxlength,
228
238
                            pool));
229
239
 
230
240
  return svn_stream_printf(out, pool, "%s%s", line, APR_EOL_STR);
286
296
    bl.sbuf = svn_stringbuf_create_empty(pool);
287
297
 
288
298
  bl.opt_state = opt_state;
 
299
  bl.rev_maxlength = 0;
289
300
 
290
301
  subpool = svn_pool_create(pool);
291
302
 
350
361
          if (! svn_path_is_url(target))
351
362
            outpath = svn_dirent_local_style(truepath, subpool);
352
363
          svn_xml_make_open_tag(&bl.sbuf, pool, svn_xml_normal, "target",
353
 
                                "path", outpath, NULL);
 
364
                                "path", outpath, SVN_VA_NULL);
354
365
 
355
366
          receiver = blame_receiver_xml;
356
367
        }