2
2
* cl.h: shared stuff in the command line program
4
4
* ====================================================================
5
* Copyright (c) 2000-2007 CollabNet. All rights reserved.
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.
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
13
* http://www.apache.org/licenses/LICENSE-2.0
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
16
21
* ====================================================================
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'.
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;
139
144
/* These are simply a copy of the range start and end values present
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
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;
236
typedef struct svn_cl__cmd_baton_t
223
238
svn_cl__opt_state_t *opt_state;
224
239
svn_client_ctx_t *ctx;
276
294
* invoked on an unversioned, nonexistent, or otherwise innocuously
277
295
* errorful resource. Meant to be wrapped with SVN_ERR().
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.
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
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.
287
* Else return ERR, setting *SUCCESS to FALSE if SUCCESS is not NULL.
289
306
* Typically, error codes like SVN_ERR_UNVERSIONED_RESOURCE,
290
307
* SVN_ERR_ENTRY_NOT_FOUND, etc, are supplied in varargs. Don't
367
388
unversioned items found in the working copy.
369
390
When DETAILED is set, and REPOS_LOCKS is set, treat missing repository locks
370
as broken WC locks. */
393
Increment *TEXT_CONFLICTS, *PROP_CONFLICTS, or *TREE_CONFLICTS if
394
a conflict was encountered.
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);
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);
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.
424
If OUT is not NULL, then write to it rather than stdout.
394
426
If NAMES_ONLY is true, print just names, else print names and
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);
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. */
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);
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. */
413
446
svn_cl__print_xml_commit(svn_stringbuf_t **outstr,
416
449
const char *date,
417
450
apr_pool_t *pool);
452
/* Output an XML "<lock>" element describing LOCK to *OUTSTR. If *OUTSTR is
453
NULL, allocate it first from POOL, otherwise append to it. */
455
svn_cl__print_xml_lock(svn_stringbuf_t **outstr,
456
const svn_lock_t *lock,
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
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);
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.
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
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
522
556
* If don't want a summary line at the end of notifications, set
523
557
* SUPPRESS_FINAL_LINE.
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,
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,
565
/* Make the notifier for use with BATON print the appropriate summary
566
* line at the end of the output.
569
svn_cl__notifier_mark_checkout(void *baton);
571
/* Make the notifier for use with BATON print the appropriate summary
572
* line at the end of the output.
575
svn_cl__notifier_mark_export(void *baton);
577
/* Make the notifier for use with BATON print the appropriate notifications
578
* for a wc to repository copy
581
svn_cl__notifier_mark_wc_to_repos_copy(void *baton);
583
/* Baton for use with svn_cl__check_externals_failed_notify_wrapper(). */
584
struct svn_cl__check_externals_failed_notify_baton
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? */
591
/* Notification function wrapper (implements `svn_wc_notify_func2_t').
592
Use with an svn_cl__check_externals_failed_notify_baton BATON. */
594
svn_cl__check_externals_failed_notify_wrapper(void *baton,
595
const svn_wc_notify_t *n,
598
/* Print conflict stats accumulated in NOTIFY_BATON.
599
* Return any error encountered during printing.
600
* Do all allocations in POOL.*/
602
svn_cl__print_conflict_stats(void *notify_baton, apr_pool_t *pool);
533
605
/*** Log message callback stuffs. ***/
597
672
const char *string);
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. */
602
677
svn_cl__xml_print_header(const char *tagname, apr_pool_t *pool);
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. */
607
682
svn_cl__xml_print_footer(const char *tagname, apr_pool_t *pool);
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
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,
734
apr_pool_t *result_pool,
735
apr_pool_t *scratch_pool);
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. */
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);
666
748
/* Return a string allocated in POOL that is a copy of STR but with each
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. */
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);
769
/* Return, in @a *true_targets_p, a copy of @a targets with peg revision
770
* specifiers snipped off the end of each element.
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.
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.
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
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.
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.
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.
805
* It is safe to pass the address of @a targets as @a true_targets_p.
807
* Do all allocations in @a pool. */
809
svn_cl__eat_peg_revisions(apr_array_header_t **true_targets_p,
810
const apr_array_header_t *targets,
813
/* Return an error if TARGETS contains a mixture of URLs and paths; otherwise
814
* return SVN_NO_ERROR. */
816
svn_cl__assert_homogeneous_target_type(const apr_array_header_t *targets);
818
/* Return an error if TARGETS contains a URL; otherwise return SVN_NO_ERROR. */
820
svn_cl__check_targets_are_local_paths(const apr_array_header_t *targets);
822
/* Return an error if TARGET is a URL; otherwise return SVN_NO_ERROR. */
824
svn_cl__check_target_is_local_path(const char *target);
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.
829
* This function assumes PARENT_PATH and PATH are both absolute "dirents"
830
* or both relative "dirents". */
832
svn_cl__local_style_skip_ancestor(const char *parent_path,
681
836
#ifdef __cplusplus
683
838
#endif /* __cplusplus */