ra.c (251886) | ra.c (253734) |
---|---|
1/* 2 * ra.c : routines for interacting with the RA layer 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 --- 848 unchanged lines hidden (view full) --- 857 SVN_ERR(repos_locations(start_url, end_url, 858 ra_session, url, peg_revnum, 859 start_revnum, end_revnum, 860 pool, subpool)); 861 svn_pool_destroy(subpool); 862 return SVN_NO_ERROR; 863} 864 | 1/* 2 * ra.c : routines for interacting with the RA layer 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 --- 848 unchanged lines hidden (view full) --- 857 SVN_ERR(repos_locations(start_url, end_url, 858 ra_session, url, peg_revnum, 859 start_revnum, end_revnum, 860 pool, subpool)); 861 svn_pool_destroy(subpool); 862 return SVN_NO_ERROR; 863} 864 |
865 | |
866svn_error_t * | 865svn_error_t * |
867svn_client__get_youngest_common_ancestor(svn_client__pathrev_t **ancestor_p, 868 const svn_client__pathrev_t *loc1, 869 const svn_client__pathrev_t *loc2, 870 svn_ra_session_t *session, 871 svn_client_ctx_t *ctx, 872 apr_pool_t *result_pool, 873 apr_pool_t *scratch_pool) | 866svn_client__calc_youngest_common_ancestor(svn_client__pathrev_t **ancestor_p, 867 const svn_client__pathrev_t *loc1, 868 apr_hash_t *history1, 869 svn_boolean_t has_rev_zero_history1, 870 const svn_client__pathrev_t *loc2, 871 apr_hash_t *history2, 872 svn_boolean_t has_rev_zero_history2, 873 apr_pool_t *result_pool, 874 apr_pool_t *scratch_pool) |
874{ | 875{ |
875 apr_pool_t *sesspool = NULL; 876 apr_hash_t *history1, *history2; | |
877 apr_hash_index_t *hi; 878 svn_revnum_t yc_revision = SVN_INVALID_REVNUM; 879 const char *yc_relpath = NULL; | 876 apr_hash_index_t *hi; 877 svn_revnum_t yc_revision = SVN_INVALID_REVNUM; 878 const char *yc_relpath = NULL; |
880 svn_boolean_t has_rev_zero_history1; 881 svn_boolean_t has_rev_zero_history2; | |
882 883 if (strcmp(loc1->repos_root_url, loc2->repos_root_url) != 0) 884 { 885 *ancestor_p = NULL; 886 return SVN_NO_ERROR; 887 } 888 | 879 880 if (strcmp(loc1->repos_root_url, loc2->repos_root_url) != 0) 881 { 882 *ancestor_p = NULL; 883 return SVN_NO_ERROR; 884 } 885 |
889 /* Open an RA session for the two locations. */ 890 if (session == NULL) 891 { 892 sesspool = svn_pool_create(scratch_pool); 893 SVN_ERR(svn_client_open_ra_session2(&session, loc1->url, NULL, ctx, 894 sesspool, sesspool)); 895 } 896 897 /* We're going to cheat and use history-as-mergeinfo because it 898 saves us a bunch of annoying custom data comparisons and such. */ 899 SVN_ERR(svn_client__get_history_as_mergeinfo(&history1, 900 &has_rev_zero_history1, 901 loc1, 902 SVN_INVALID_REVNUM, 903 SVN_INVALID_REVNUM, 904 session, ctx, scratch_pool)); 905 SVN_ERR(svn_client__get_history_as_mergeinfo(&history2, 906 &has_rev_zero_history2, 907 loc2, 908 SVN_INVALID_REVNUM, 909 SVN_INVALID_REVNUM, 910 session, ctx, scratch_pool)); 911 /* Close the ra session if we opened one. */ 912 if (sesspool) 913 svn_pool_destroy(sesspool); 914 | |
915 /* Loop through the first location's history, check for overlapping 916 paths and ranges in the second location's history, and 917 remembering the youngest matching location. */ 918 for (hi = apr_hash_first(scratch_pool, history1); hi; hi = apr_hash_next(hi)) 919 { 920 const char *path = svn__apr_hash_index_key(hi); 921 apr_ssize_t path_len = svn__apr_hash_index_klen(hi); 922 svn_rangelist_t *ranges1 = svn__apr_hash_index_val(hi); --- 37 unchanged lines hidden (view full) --- 960 else 961 { 962 *ancestor_p = NULL; 963 } 964 return SVN_NO_ERROR; 965} 966 967svn_error_t * | 886 /* Loop through the first location's history, check for overlapping 887 paths and ranges in the second location's history, and 888 remembering the youngest matching location. */ 889 for (hi = apr_hash_first(scratch_pool, history1); hi; hi = apr_hash_next(hi)) 890 { 891 const char *path = svn__apr_hash_index_key(hi); 892 apr_ssize_t path_len = svn__apr_hash_index_klen(hi); 893 svn_rangelist_t *ranges1 = svn__apr_hash_index_val(hi); --- 37 unchanged lines hidden (view full) --- 931 else 932 { 933 *ancestor_p = NULL; 934 } 935 return SVN_NO_ERROR; 936} 937 938svn_error_t * |
939svn_client__get_youngest_common_ancestor(svn_client__pathrev_t **ancestor_p, 940 const svn_client__pathrev_t *loc1, 941 const svn_client__pathrev_t *loc2, 942 svn_ra_session_t *session, 943 svn_client_ctx_t *ctx, 944 apr_pool_t *result_pool, 945 apr_pool_t *scratch_pool) 946{ 947 apr_pool_t *sesspool = NULL; 948 apr_hash_t *history1, *history2; 949 svn_boolean_t has_rev_zero_history1; 950 svn_boolean_t has_rev_zero_history2; 951 952 if (strcmp(loc1->repos_root_url, loc2->repos_root_url) != 0) 953 { 954 *ancestor_p = NULL; 955 return SVN_NO_ERROR; 956 } 957 958 /* Open an RA session for the two locations. */ 959 if (session == NULL) 960 { 961 sesspool = svn_pool_create(scratch_pool); 962 SVN_ERR(svn_client_open_ra_session2(&session, loc1->url, NULL, ctx, 963 sesspool, sesspool)); 964 } 965 966 /* We're going to cheat and use history-as-mergeinfo because it 967 saves us a bunch of annoying custom data comparisons and such. */ 968 SVN_ERR(svn_client__get_history_as_mergeinfo(&history1, 969 &has_rev_zero_history1, 970 loc1, 971 SVN_INVALID_REVNUM, 972 SVN_INVALID_REVNUM, 973 session, ctx, scratch_pool)); 974 SVN_ERR(svn_client__get_history_as_mergeinfo(&history2, 975 &has_rev_zero_history2, 976 loc2, 977 SVN_INVALID_REVNUM, 978 SVN_INVALID_REVNUM, 979 session, ctx, scratch_pool)); 980 /* Close the ra session if we opened one. */ 981 if (sesspool) 982 svn_pool_destroy(sesspool); 983 984 SVN_ERR(svn_client__calc_youngest_common_ancestor(ancestor_p, 985 loc1, history1, 986 has_rev_zero_history1, 987 loc2, history2, 988 has_rev_zero_history2, 989 result_pool, 990 scratch_pool)); 991 992 return SVN_NO_ERROR; 993} 994 995svn_error_t * |
|
968svn_client__youngest_common_ancestor(const char **ancestor_url, 969 svn_revnum_t *ancestor_rev, 970 const char *path_or_url1, 971 const svn_opt_revision_t *revision1, 972 const char *path_or_url2, 973 const svn_opt_revision_t *revision2, 974 svn_client_ctx_t *ctx, 975 apr_pool_t *result_pool, --- 172 unchanged lines hidden --- | 996svn_client__youngest_common_ancestor(const char **ancestor_url, 997 svn_revnum_t *ancestor_rev, 998 const char *path_or_url1, 999 const svn_opt_revision_t *revision1, 1000 const char *path_or_url2, 1001 const svn_opt_revision_t *revision2, 1002 svn_client_ctx_t *ctx, 1003 apr_pool_t *result_pool, --- 172 unchanged lines hidden --- |