~ubuntu-branches/ubuntu/trusty/subversion/trusty-proposed

« back to all changes in this revision

Viewing changes to subversion/svn/cl.h

  • Committer: Package Import Robot
  • Author(s): Andy Whitcroft
  • Date: 2012-06-21 15:36:36 UTC
  • mfrom: (0.4.13 sid)
  • Revision ID: package-import@ubuntu.com-20120621153636-amqqmuidgwgxz1ly
Tags: 1.7.5-1ubuntu1
* Merge from Debian unstable.  Remaining changes:
  - Create pot file on build.
  - Build a python-subversion-dbg package.
  - Build-depend on python-dbg.
  - Build-depend on default-jre-headless/-jdk.
  - Do not apply java-build patch.
  - debian/rules: Manually create the doxygen output directory, otherwise
    we get weird build failures when running parallel builds.

Show diffs side-by-side

added added

removed removed

Lines of Context:
2
2
 * cl.h:  shared stuff in the command line program
3
3
 *
4
4
 * ====================================================================
5
 
 * Copyright (c) 2000-2007 CollabNet.  All rights reserved.
6
 
 *
7
 
 * This software is licensed as described in the file COPYING, which
8
 
 * you should have received as part of this distribution.  The terms
9
 
 * are also available at http://subversion.tigris.org/license-1.html.
10
 
 * If newer versions of this license are posted there, you may use a
11
 
 * newer version instead, at your option.
12
 
 *
13
 
 * This software consists of voluntary contributions made by many
14
 
 * individuals.  For exact contribution history, see the revision
15
 
 * history and logs, available at http://subversion.tigris.org/.
 
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.
16
21
 * ====================================================================
17
22
 */
18
23
 
42
47
/*** Option processing ***/
43
48
 
44
49
/* --accept actions */
45
 
typedef enum
 
50
typedef enum svn_cl__accept_t
46
51
{
47
52
  /* invalid accept action */
48
53
  svn_cl__accept_invalid = -2,
107
112
/*** Mergeinfo flavors. ***/
108
113
 
109
114
/* --show-revs values */
110
 
typedef enum {
 
115
typedef enum svn_cl__show_revs_t {
111
116
  svn_cl__show_revs_invalid = -1,
112
117
  svn_cl__show_revs_merged,
113
118
  svn_cl__show_revs_eligible
131
136
  /* An array of svn_opt_revision_range_t *'s representing revisions
132
137
     ranges indicated on the command-line via the -r and -c options.
133
138
     For each range in the list, if only one revision was provided
134
 
     (-rN), its 'end' member remains `svn_opt_revision_unspecified'.
135
 
 
136
 
     NOTE: This is currently used only by merge subcommand. */
 
139
     (-rN), its 'end' member remains 'svn_opt_revision_unspecified'.
 
140
     This array always has at least one element, even if that is a
 
141
     null range in which both ends are 'svn_opt_revision_unspecified'. */
137
142
  apr_array_header_t *revision_ranges;
138
143
 
139
144
  /* These are simply a copy of the range start and end values present
179
184
  svn_boolean_t no_ignore;       /* disregard default ignores & svn:ignore's */
180
185
  svn_boolean_t no_auth_cache;   /* do not cache authentication information */
181
186
  svn_boolean_t no_diff_deleted; /* do not show diffs for deleted files */
 
187
  svn_boolean_t show_copies_as_adds; /* do not diff copies with their source */
182
188
  svn_boolean_t notice_ancestry; /* notice ancestry for diff-y operations */
183
189
  svn_boolean_t ignore_ancestry; /* ignore ancestry for merge-y operations */
184
190
  svn_boolean_t ignore_externals;/* ignore externals definitions */
187
193
  svn_boolean_t revprop;         /* operate on a revision property */
188
194
  const char *diff_cmd;          /* the external diff command to use */
189
195
  const char *merge_cmd;         /* the external merge command to use */
190
 
  const char *editor_cmd;        /* external editor command. */
 
196
  const char *editor_cmd;        /* the external editor command to use */
191
197
  svn_boolean_t record_only;     /* whether to record mergeinfo */
192
198
  const char *old_target;        /* diff target */
193
199
  const char *new_target;        /* diff target */
215
221
  svn_boolean_t reintegrate;     /* use "reintegrate" merge-source heuristic */
216
222
  svn_boolean_t trust_server_cert; /* trust server SSL certs that would
217
223
                                      otherwise be rejected as "untrusted" */
 
224
  int strip; /* number of leading path components to strip */
 
225
  svn_boolean_t ignore_keywords;  /* do not expand keywords */
 
226
  svn_boolean_t reverse_diff;     /* reverse a diff (e.g. when patching) */
 
227
  svn_boolean_t ignore_whitespace; /* don't account for whitespace when
 
228
                                      patching */
 
229
  svn_boolean_t show_diff;        /* produce diff output (maps to --diff) */
 
230
  svn_boolean_t internal_diff;    /* override diff_cmd in config file */
 
231
  svn_boolean_t use_git_diff_format; /* Use git's extended diff format */
 
232
  svn_boolean_t allow_mixed_rev; /* Allow operation on mixed-revision WC */
218
233
} svn_cl__opt_state_t;
219
234
 
220
235
 
221
 
typedef struct
 
236
typedef struct svn_cl__cmd_baton_t
222
237
{
223
238
  svn_cl__opt_state_t *opt_state;
224
239
  svn_client_ctx_t *ctx;
248
263
  svn_cl__mergeinfo,
249
264
  svn_cl__mkdir,
250
265
  svn_cl__move,
 
266
  svn_cl__patch,
251
267
  svn_cl__propdel,
252
268
  svn_cl__propedit,
253
269
  svn_cl__propget,
254
270
  svn_cl__proplist,
255
271
  svn_cl__propset,
 
272
  svn_cl__relocate,
256
273
  svn_cl__revert,
257
274
  svn_cl__resolve,
258
275
  svn_cl__resolved,
259
276
  svn_cl__status,
260
277
  svn_cl__switch,
261
278
  svn_cl__unlock,
262
 
  svn_cl__update;
 
279
  svn_cl__update,
 
280
  svn_cl__upgrade;
263
281
 
264
282
 
265
283
/* See definition in main.c for documentation. */
276
294
 * invoked on an unversioned, nonexistent, or otherwise innocuously
277
295
 * errorful resource.  Meant to be wrapped with SVN_ERR().
278
296
 *
279
 
 * If ERR is null, return SVN_NO_ERROR, setting *SUCCESS to TRUE
280
 
 * if SUCCESS is not NULL.
 
297
 * If ERR is null, return SVN_NO_ERROR.
281
298
 *
282
299
 * Else if ERR->apr_err is one of the error codes supplied in varargs,
283
300
 * then handle ERR as a warning (unless QUIET is true), clear ERR, and
284
 
 * return SVN_NO_ERROR, setting *SUCCESS to FALSE if SUCCESS is not
285
 
 * NULL.
 
301
 * return SVN_NO_ERROR, and push the value of ERR->apr_err into the
 
302
 * ERRORS_SEEN array, if ERRORS_SEEN is not NULL.
286
303
 *
287
 
 * Else return ERR, setting *SUCCESS to FALSE if SUCCESS is not NULL.
 
304
 * Else return ERR.
288
305
 *
289
306
 * Typically, error codes like SVN_ERR_UNVERSIONED_RESOURCE,
290
307
 * SVN_ERR_ENTRY_NOT_FOUND, etc, are supplied in varargs.  Don't
292
309
 */
293
310
svn_error_t *
294
311
svn_cl__try(svn_error_t *err,
295
 
            svn_boolean_t *success,
 
312
            apr_array_header_t *errors_seen,
296
313
            svn_boolean_t quiet,
297
314
            ...);
298
315
 
305
322
 
306
323
/* Various conflict-resolution callbacks. */
307
324
 
308
 
typedef struct {
 
325
typedef struct svn_cl__conflict_baton_t {
309
326
  svn_cl__accept_t accept_which;
310
327
  apr_hash_t *config;
311
328
  const char *editor_cmd;
340
357
/* Print out commit information found in COMMIT_INFO to the console.
341
358
 * POOL is used for temporay allocations.
342
359
 * COMMIT_INFO should not be NULL.
 
360
 *
 
361
 * This function implements svn_commit_callback2_t.
343
362
 */
344
363
svn_error_t *
345
 
svn_cl__print_commit_info(svn_commit_info_t *commit_info, apr_pool_t *pool);
 
364
svn_cl__print_commit_info(const svn_commit_info_t *commit_info,
 
365
                          void *baton,
 
366
                          apr_pool_t *pool);
346
367
 
347
368
 
348
369
/* Convert the date in DATA to a human-readable UTF-8-encoded string
367
388
   unversioned items found in the working copy.
368
389
 
369
390
   When DETAILED is set, and REPOS_LOCKS is set, treat missing repository locks
370
 
   as broken WC locks. */
 
391
   as broken WC locks.
 
392
 
 
393
   Increment *TEXT_CONFLICTS, *PROP_CONFLICTS, or *TREE_CONFLICTS if
 
394
   a conflict was encountered.
 
395
   */
371
396
svn_error_t *
372
397
svn_cl__print_status(const char *path,
373
 
                     const svn_wc_status2_t *status,
 
398
                     const svn_client_status_t *status,
374
399
                     svn_boolean_t detailed,
375
400
                     svn_boolean_t show_last_committed,
376
401
                     svn_boolean_t skip_unrecognized,
377
402
                     svn_boolean_t repos_locks,
 
403
                     unsigned int *text_conflicts,
 
404
                     unsigned int *prop_conflicts,
 
405
                     unsigned int *tree_conflicts,
 
406
                     svn_client_ctx_t *ctx,
378
407
                     apr_pool_t *pool);
379
408
 
380
409
 
382
411
   allocations. */
383
412
svn_error_t *
384
413
svn_cl__print_status_xml(const char *path,
385
 
                         const svn_wc_status2_t *status,
 
414
                         const svn_client_status_t *status,
 
415
                         svn_client_ctx_t *ctx,
386
416
                         apr_pool_t *pool);
387
417
 
388
418
 
389
 
/* Print a hash that maps property names (char *) to property values
390
 
   (svn_string_t *).  The names are assumed to be in UTF-8 format;
 
419
/* Print to stdout a hash that maps property names (char *) to property
 
420
   values (svn_string_t *).  The names are assumed to be in UTF-8 format;
391
421
   the values are either in UTF-8 (the special Subversion props) or
392
422
   plain binary values.
393
423
 
 
424
   If OUT is not NULL, then write to it rather than stdout.
 
425
 
394
426
   If NAMES_ONLY is true, print just names, else print names and
395
427
   values. */
396
428
svn_error_t *
397
 
svn_cl__print_prop_hash(apr_hash_t *prop_hash,
 
429
svn_cl__print_prop_hash(svn_stream_t *out,
 
430
                        apr_hash_t *prop_hash,
398
431
                        svn_boolean_t names_only,
399
432
                        apr_pool_t *pool);
400
433
 
401
 
/* Same as svn_cl__print_prop_hash(), only output xml to OUTSTR.  If OUTSTR is
402
 
   NULL, allocate it first from pool, otherwise append the xml to it. */
 
434
/* Same as svn_cl__print_prop_hash(), only output xml to *OUTSTR.  If *OUTSTR is
 
435
   NULL, allocate it first from POOL, otherwise append to it. */
403
436
svn_error_t *
404
437
svn_cl__print_xml_prop_hash(svn_stringbuf_t **outstr,
405
438
                            apr_hash_t *prop_hash,
406
439
                            svn_boolean_t names_only,
407
440
                            apr_pool_t *pool);
408
441
 
409
 
/* Output a commit xml element to OUTSTR.  IF OUTSTR is NULL, allocate it
410
 
   first from pool, otherwise appen the xml to it.  If AUTHOR or DATE is
 
442
/* Output a commit xml element to *OUTSTR.  If *OUTSTR is NULL, allocate it
 
443
   first from POOL, otherwise append to it.  If AUTHOR or DATE is
411
444
   NULL, it will be omitted. */
412
445
void
413
446
svn_cl__print_xml_commit(svn_stringbuf_t **outstr,
416
449
                         const char *date,
417
450
                         apr_pool_t *pool);
418
451
 
 
452
/* Output an XML "<lock>" element describing LOCK to *OUTSTR.  If *OUTSTR is
 
453
   NULL, allocate it first from POOL, otherwise append to it. */
 
454
void
 
455
svn_cl__print_xml_lock(svn_stringbuf_t **outstr,
 
456
                       const svn_lock_t *lock,
 
457
                       apr_pool_t *pool);
 
458
 
419
459
/* Do the following things that are commonly required before accessing revision
420
460
   properties.  Ensure that REVISION is specified explicitly and is not
421
461
   relative to a working-copy item.  Ensure that exactly one target is
422
462
   specified in TARGETS.  Set *URL to the URL of the target.  Return an
423
 
   appropriate error if any of those checks or operations fail.
 
463
   appropriate error if any of those checks or operations fail. Use CTX for
 
464
   accessing the working copy
424
465
 */
425
466
svn_error_t *
426
467
svn_cl__revprop_prepare(const svn_opt_revision_t *revision,
427
 
                        apr_array_header_t *targets,
 
468
                        const apr_array_header_t *targets,
428
469
                        const char **URL,
 
470
                        svn_client_ctx_t *ctx,
429
471
                        apr_pool_t *pool);
430
472
 
431
473
/* Search for a text editor command in standard environment variables,
511
553
/* Set *NOTIFY_FUNC_P and *NOTIFY_BATON_P to a notifier/baton for all
512
554
 * operations, allocated in POOL.
513
555
 *
514
 
 * If this is a checkout, set IS_CHECKOUT to true, so that the
515
 
 * notifier will print the appropriate summary line at the end of the
516
 
 * output.
517
 
 *
518
 
 * If this is an export, set IS_EXPORT to true, so that the
519
 
 * notifier will print the appropriate summary line at the end of the
520
 
 * output.
521
 
 *
522
556
 * If don't want a summary line at the end of notifications, set
523
557
 * SUPPRESS_FINAL_LINE.
524
558
 */
525
 
void svn_cl__get_notifier(svn_wc_notify_func2_t *notify_func_p,
526
 
                          void **notify_baton_p,
527
 
                          svn_boolean_t is_checkout,
528
 
                          svn_boolean_t is_export,
529
 
                          svn_boolean_t suppress_final_line,
530
 
                          apr_pool_t *pool);
 
559
svn_error_t *
 
560
svn_cl__get_notifier(svn_wc_notify_func2_t *notify_func_p,
 
561
                     void **notify_baton_p,
 
562
                     svn_boolean_t suppress_final_line,
 
563
                     apr_pool_t *pool);
 
564
 
 
565
/* Make the notifier for use with BATON print the appropriate summary
 
566
 * line at the end of the output.
 
567
 */
 
568
svn_error_t *
 
569
svn_cl__notifier_mark_checkout(void *baton);
 
570
 
 
571
/* Make the notifier for use with BATON print the appropriate summary
 
572
 * line at the end of the output.
 
573
 */
 
574
svn_error_t *
 
575
svn_cl__notifier_mark_export(void *baton);
 
576
 
 
577
/* Make the notifier for use with BATON print the appropriate notifications
 
578
 * for a wc to repository copy
 
579
 */
 
580
svn_error_t *
 
581
svn_cl__notifier_mark_wc_to_repos_copy(void *baton);
 
582
 
 
583
/* Baton for use with svn_cl__check_externals_failed_notify_wrapper(). */
 
584
struct svn_cl__check_externals_failed_notify_baton
 
585
{
 
586
  svn_wc_notify_func2_t wrapped_func; /* The "real" notify_func2. */
 
587
  void *wrapped_baton;                /* The "real" notify_func2 baton. */
 
588
  svn_boolean_t had_externals_error;  /* Did something fail in an external? */
 
589
};
 
590
 
 
591
/* Notification function wrapper (implements `svn_wc_notify_func2_t').
 
592
   Use with an svn_cl__check_externals_failed_notify_baton BATON. */
 
593
void
 
594
svn_cl__check_externals_failed_notify_wrapper(void *baton,
 
595
                                              const svn_wc_notify_t *n,
 
596
                                              apr_pool_t *pool);
 
597
 
 
598
/* Print conflict stats accumulated in NOTIFY_BATON.
 
599
 * Return any error encountered during printing.
 
600
 * Do all allocations in POOL.*/
 
601
svn_error_t *
 
602
svn_cl__print_conflict_stats(void *notify_baton, apr_pool_t *pool);
531
603
 
532
604
 
533
605
/*** Log message callback stuffs. ***/
584
656
svn_error_t *
585
657
svn_cl__may_need_force(svn_error_t *err);
586
658
 
587
 
/* Write the STRING to the stdio STREAM, returning an error if it fails. */
 
659
/* Write the STRING to the stdio STREAM, returning an error if it fails.
 
660
 
 
661
   This function is equal to svn_cmdline_fputs() minus the utf8->local
 
662
   encoding translation.  */
588
663
svn_error_t *
589
664
svn_cl__error_checked_fputs(const char *string, FILE* stream);
590
665
 
597
672
                         const char *string);
598
673
 
599
674
/* Print the XML prolog and document root element start-tag to stdout, using
600
 
   TAGNAME as the root element name.  Use pool for temporary allocations. */
 
675
   TAGNAME as the root element name.  Use POOL for temporary allocations. */
601
676
svn_error_t *
602
677
svn_cl__xml_print_header(const char *tagname, apr_pool_t *pool);
603
678
 
604
679
/* Print the XML document root element end-tag to stdout, using TAGNAME as the
605
 
   root element name.  Use pool for temporary allocations. */
 
680
   root element name.  Use POOL for temporary allocations. */
606
681
svn_error_t *
607
682
svn_cl__xml_print_footer(const char *tagname, apr_pool_t *pool);
608
683
 
647
722
 
648
723
/* De-streamifying wrapper around svn_client_get_changelists(), which
649
724
   is called for each target in TARGETS to populate *PATHS (a list of
650
 
   paths assigned to one of the CHANGELISTS. */
 
725
   paths assigned to one of the CHANGELISTS.
 
726
   If all targets are to be included, may set *PATHS to TARGETS without
 
727
   reallocating. */
651
728
svn_error_t *
652
729
svn_cl__changelist_paths(apr_array_header_t **paths,
653
730
                         const apr_array_header_t *changelists,
654
731
                         const apr_array_header_t *targets,
655
732
                         svn_depth_t depth,
656
733
                         svn_client_ctx_t *ctx,
657
 
                         apr_pool_t *pool);
 
734
                         apr_pool_t *result_pool,
 
735
                         apr_pool_t *scratch_pool);
658
736
 
 
737
/* Like svn_client_args_to_target_array() but, if the only error is that some
 
738
 * arguments are reserved file names, then print warning messages for those
 
739
 * targets, store the rest of the targets in TARGETS_P and return success. */
659
740
svn_error_t *
660
741
svn_cl__args_to_target_array_print_reserved(apr_array_header_t **targets_p,
661
742
                                            apr_getopt_t *os,
662
 
                                            apr_array_header_t *known_targets,
 
743
                                            const apr_array_header_t *known_targets,
663
744
                                            svn_client_ctx_t *ctx,
 
745
                                            svn_boolean_t keep_dest_origpath_on_truepath_collision,
664
746
                                            apr_pool_t *pool);
665
747
 
666
748
/* Return a string allocated in POOL that is a copy of STR but with each
673
755
 
674
756
 
675
757
/* Return a string showing NODE's kind, URL and revision, to the extent that
676
 
 * that information is available in NODE. */
 
758
 * that information is available in NODE. If NODE itself is NULL, this prints
 
759
 * just a 'none' node kind.
 
760
 * WC_REPOS_ROOT_URL should reflect the target working copy's repository
 
761
 * root URL. If NODE is from that same URL, the printed URL is abbreviated
 
762
 * to caret notation (^/). WC_REPOS_ROOT_URL may be NULL, in which case
 
763
 * this function tries to print the conflicted node's complete URL. */
677
764
const char *
678
765
svn_cl__node_description(const svn_wc_conflict_version_t *node,
 
766
                         const char *wc_repos_root_URL,
679
767
                         apr_pool_t *pool);
680
768
 
 
769
/* Return, in @a *true_targets_p, a copy of @a targets with peg revision
 
770
 * specifiers snipped off the end of each element.
 
771
 *
 
772
 * ### JAF TODO: This function is not good because it does not allow the
 
773
 * ### caller to detect if an invalid peg revision was specified.
 
774
 * ###
 
775
 * ### Callers should never have a need to silently *discard* all peg
 
776
 * ### revisions, even if they are doing this *after* saving any peg
 
777
 * ### revisions that might be of interest on certain arguments: I don't
 
778
 * ### think it can ever be correct to silently ignore a peg revision that
 
779
 * ### is specified, whether it makes semantic sense or not.
 
780
 * ###
 
781
 * ### Instead, callers should parse all the arguments and silently
 
782
 * ### ignore an *empty* peg revision part (just an "@", which can be
 
783
 * ### used to escape an earlier "@" in the argument) on any argument,
 
784
 * ### even an argument on which a peg revision does not make sense,
 
785
 * ### but should not silently ignore a non-empty peg when it does not
 
786
 * ### make sense.
 
787
 * ###
 
788
 * ### Something like:
 
789
 * ###   For each (URL-like?) argument that doesn't accept a peg rev:
 
790
 * ###     Parse into peg-rev and true-path parts;
 
791
 * ###     If (peg rev != unspecified)
 
792
 * ###       Error("This arg doesn't accept a peg rev.").
 
793
 * ###     Use the true-path part.
 
794
 *
 
795
 * This function is useful for subcommands for which peg revisions
 
796
 * do not make any sense. Such subcommands still need to allow peg
 
797
 * revisions to be specified on the command line so that users of
 
798
 * the command line client can consistently escape '@' characters
 
799
 * in filenames by appending an '@' character, regardless of the
 
800
 * subcommand being used.
 
801
 *
 
802
 * If a peg revision is present but cannot be parsed, an error is thrown.
 
803
 * The user has likely forgotten to escape an '@' character in a filename.
 
804
 *
 
805
 * It is safe to pass the address of @a targets as @a true_targets_p.
 
806
 *
 
807
 * Do all allocations in @a pool. */
 
808
svn_error_t *
 
809
svn_cl__eat_peg_revisions(apr_array_header_t **true_targets_p,
 
810
                          const apr_array_header_t *targets,
 
811
                          apr_pool_t *pool);
 
812
 
 
813
/* Return an error if TARGETS contains a mixture of URLs and paths; otherwise
 
814
 * return SVN_NO_ERROR. */
 
815
svn_error_t *
 
816
svn_cl__assert_homogeneous_target_type(const apr_array_header_t *targets);
 
817
 
 
818
/* Return an error if TARGETS contains a URL; otherwise return SVN_NO_ERROR. */
 
819
svn_error_t *
 
820
svn_cl__check_targets_are_local_paths(const apr_array_header_t *targets);
 
821
 
 
822
/* Return an error if TARGET is a URL; otherwise return SVN_NO_ERROR. */
 
823
svn_error_t *
 
824
svn_cl__check_target_is_local_path(const char *target);
 
825
 
 
826
/* Return a copy of PATH, converted to the local path style, skipping
 
827
 * PARENT_PATH if it is non-null and is a parent of or equal to PATH.
 
828
 *
 
829
 * This function assumes PARENT_PATH and PATH are both absolute "dirents"
 
830
 * or both relative "dirents". */
 
831
const char *
 
832
svn_cl__local_style_skip_ancestor(const char *parent_path,
 
833
                                  const char *path,
 
834
                                  apr_pool_t *pool);
 
835
 
681
836
#ifdef __cplusplus
682
837
}
683
838
#endif /* __cplusplus */