~svn/ubuntu/oneiric/subversion/ppa

« back to all changes in this revision

Viewing changes to subversion/libsvn_subr/mergeinfo.c

  • Committer: Max Bowsher
  • Date: 2010-07-01 22:34:24 UTC
  • mfrom: (0.4.3 sid)
  • Revision ID: maxb@f2s.com-20100701223424-b2astfwbpjwg5rwh
Tags: 1.6.12dfsg-1svn1
* Merge from debian testing, remaining changes:
  - Create pot file on build.
  - Build a python-subversion-dbg package.
  - (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.
  - Disable the serf backend because serf is in universe.
  - Amend the XS-Python-Version line to ">= 2.4" rather than explicit
    versions (only building for 2.6 in Lucid since that is the only Python
    in Lucid).
* Urgency medium, as it (probably) fixes some FTBFS.
* New upstream version.
  - Fixes some or all cases of inappropriate need for read access to the
    root of the repository.  (Closes: #510883)
* Disable parallel mode for 'make check', which appears to have made
  some build daemons sad.
* svn-bisect: use pegs to support bisecting in deleted branches.
  Thanks Nikita Borodikhin.  (Closes: #582344)
* patches/ruby-test-info: expand for more failures nobody can figure
  out.  Sigh.
* Upgrade from source format 1.0 to 1.0.
* New upstream version.  Rediff a patch or two.
  - Mergeinfo queries no longer require access to repository root.
    (Ref: #510883)
  - Ignores errors reading .svn/ in parent directories.  (Closes: #570271)
* rules: Run 'check' target in parallel mode.

Show diffs side-by-side

added added

removed removed

Lines of Context:
817
817
  return SVN_NO_ERROR;
818
818
}
819
819
 
820
 
/* Either remove any overlapping ranges described by ERASER from
821
 
   WHITEBOARD (when DO_REMOVE is TRUE), or capture the overlap, and
822
 
   place the remaining or overlapping ranges in OUTPUT. */
823
 
/*  ### FIXME: Some variables names and inline comments for this method
824
 
    ### are legacy from when it was solely the remove() impl. */
 
820
void
 
821
svn_rangelist__set_inheritance(apr_array_header_t *rangelist,
 
822
                               svn_boolean_t inheritable)
 
823
{
 
824
  if (rangelist)
 
825
    {
 
826
      int i;
 
827
      svn_merge_range_t *range;
 
828
 
 
829
      for (i = 0; i < rangelist->nelts; i++)
 
830
        {
 
831
          range = APR_ARRAY_IDX(rangelist, i, svn_merge_range_t *);
 
832
          range->inheritable = inheritable;
 
833
        }
 
834
    }
 
835
  return;
 
836
}
 
837
 
 
838
/* If DO_REMOVE is true, then remove any overlapping ranges described by
 
839
   RANGELIST1 from RANGELIST2 and place the results in *OUTPUT.  When
 
840
   DO_REMOVE is true, RANGELIST1 is effectively the "eraser" and RANGELIST2
 
841
   the "whiteboard".
 
842
 
 
843
   If DO_REMOVE is false, then capture the intersection between RANGELIST1
 
844
   and RANGELIST2 and place the results in *OUTPUT.  The ordering of
 
845
   RANGELIST1 and RANGELIST2 doesn't matter when DO_REMOVE is false.
 
846
 
 
847
   If CONSIDER_INHERITANCE is true, then take the inheritance of the
 
848
   ranges in RANGELIST1 and RANGELIST2 into account when comparing them
 
849
   for intersection, see the doc string for svn_rangelist_intersection().
 
850
 
 
851
   If CONSIDER_INHERITANCE is true, then ranges with differing inheritance
 
852
   may intersect, but the resulting intersection is non-inheritable only
 
853
   if both ranges were non-inheritable, e.g.:
 
854
 
 
855
   RANGELIST1  RANGELIST2  CONSIDER     DO_REMOVE  *OUTPUT
 
856
                           INHERITANCE
 
857
   ----------  ------      -----------  ---------  -------
 
858
 
 
859
   90-420*     1-100       TRUE         FALSE      Empty Rangelist
 
860
   90-420      1-100*      TRUE         FALSE      Empty Rangelist
 
861
   90-420      1-100       TRUE         FALSE      90-100
 
862
   90-420*     1-100*      TRUE         FALSE      90-100*
 
863
 
 
864
   90-420*     1-100       FALSE        FALSE      90-100
 
865
   90-420      1-100*      FALSE        FALSE      90-100
 
866
   90-420      1-100       FALSE        FALSE      90-100
 
867
   90-420*     1-100*      FALSE        FALSE      90-100*
 
868
 
 
869
   Allocate the contents of *OUTPUT in POOL. */
825
870
static svn_error_t *
826
871
rangelist_intersect_or_remove(apr_array_header_t **output,
827
 
                              apr_array_header_t *eraser,
828
 
                              apr_array_header_t *whiteboard,
 
872
                              const apr_array_header_t *rangelist1,
 
873
                              const apr_array_header_t *rangelist2,
829
874
                              svn_boolean_t do_remove,
830
875
                              svn_boolean_t consider_inheritance,
831
876
                              apr_pool_t *pool)
840
885
  j = 0;
841
886
  lasti = -1;  /* Initialized to a value that "i" will never be. */
842
887
 
843
 
  while (i < whiteboard->nelts && j < eraser->nelts)
 
888
  while (i < rangelist2->nelts && j < rangelist1->nelts)
844
889
    {
845
890
      svn_merge_range_t *elt1, *elt2;
846
891
 
847
 
      elt2 = APR_ARRAY_IDX(eraser, j, svn_merge_range_t *);
 
892
      elt2 = APR_ARRAY_IDX(rangelist1, j, svn_merge_range_t *);
848
893
 
849
 
      /* Instead of making a copy of the entire array of whiteboard
850
 
         elements, we just keep a copy of the current whiteboard element
 
894
      /* Instead of making a copy of the entire array of rangelist2
 
895
         elements, we just keep a copy of the current rangelist2 element
851
896
         that needs to be used, and modify our copy if necessary. */
852
897
      if (i != lasti)
853
898
        {
854
 
          wboardelt = *(APR_ARRAY_IDX(whiteboard, i, svn_merge_range_t *));
 
899
          wboardelt = *(APR_ARRAY_IDX(rangelist2, i, svn_merge_range_t *));
855
900
          lasti = i;
856
901
        }
857
902
 
858
903
      elt1 = &wboardelt;
859
904
 
860
 
      /* If the whiteboard range is contained completely in the
861
 
         eraser, we increment the whiteboard.
 
905
      /* If the rangelist2 range is contained completely in the
 
906
         rangelist1, we increment the rangelist2.
862
907
         If the ranges intersect, and match exactly, we increment both
863
 
         eraser and whiteboard.
 
908
         rangelist1 and rangelist2.
864
909
         Otherwise, we have to generate a range for the left part of
865
 
         the removal of eraser from whiteboard, and possibly change
866
 
         the whiteboard to the remaining portion of the right part of
 
910
         the removal of rangelist1 from rangelist2, and possibly change
 
911
         the rangelist2 to the remaining portion of the right part of
867
912
         the removal, to test against. */
868
913
      if (range_contains(elt2, elt1, consider_inheritance))
869
914
        {
870
915
          if (!do_remove)
871
 
            SVN_ERR(combine_with_lastrange(&lastrange, elt1, *output,
872
 
                                           consider_inheritance, pool,
873
 
                                           pool));
 
916
            {
 
917
              svn_merge_range_t tmp_range;
 
918
              tmp_range.start = elt1->start;
 
919
              tmp_range.end = elt1->end;
 
920
              /* The intersection of two ranges is non-inheritable only
 
921
                 if both ranges are non-inheritable. */
 
922
              tmp_range.inheritable =
 
923
                (elt1->inheritable || elt2->inheritable);
 
924
              SVN_ERR(combine_with_lastrange(&lastrange, &tmp_range, *output,
 
925
                                             consider_inheritance, pool,
 
926
                                             pool));
 
927
            }
874
928
 
875
929
          i++;
876
930
 
881
935
        {
882
936
          if (elt1->start < elt2->start)
883
937
            {
884
 
              /* The whiteboard range starts before the eraser range. */
 
938
              /* The rangelist2 range starts before the rangelist1 range. */
885
939
              svn_merge_range_t tmp_range;
886
 
              tmp_range.inheritable = elt1->inheritable;
887
940
              if (do_remove)
888
941
                {
889
 
                  /* Retain the range that falls before the eraser start. */
 
942
                  /* Retain the range that falls before the rangelist1
 
943
                     start. */
890
944
                  tmp_range.start = elt1->start;
891
945
                  tmp_range.end = elt2->start;
 
946
                  tmp_range.inheritable = elt1->inheritable;
892
947
                }
893
948
              else
894
949
                {
895
 
                  /* Retain the range that falls between the eraser
896
 
                     start and whiteboard end. */
 
950
                  /* Retain the range that falls between the rangelist1
 
951
                     start and rangelist2 end. */
897
952
                  tmp_range.start = elt2->start;
898
953
                  tmp_range.end = MIN(elt1->end, elt2->end);
 
954
                  /* The intersection of two ranges is non-inheritable only
 
955
                     if both ranges are non-inheritable. */
 
956
                  tmp_range.inheritable =
 
957
                    (elt1->inheritable || elt2->inheritable);
899
958
                }
900
959
 
901
960
              SVN_ERR(combine_with_lastrange(&lastrange, &tmp_range,
903
962
                                             pool, pool));
904
963
            }
905
964
 
906
 
          /* Set up the rest of the whiteboard range for further
 
965
          /* Set up the rest of the rangelist2 range for further
907
966
             processing.  */
908
967
          if (elt1->end > elt2->end)
909
968
            {
910
 
              /* The whiteboard range ends after the eraser range. */
 
969
              /* The rangelist2 range ends after the rangelist1 range. */
911
970
              if (!do_remove)
912
971
                {
913
972
                  /* Partial overlap. */
914
973
                  svn_merge_range_t tmp_range;
915
974
                  tmp_range.start = MAX(elt1->start, elt2->start);
916
975
                  tmp_range.end = elt2->end;
917
 
                  tmp_range.inheritable = elt1->inheritable;
 
976
                  /* The intersection of two ranges is non-inheritable only
 
977
                     if both ranges are non-inheritable. */
 
978
                  tmp_range.inheritable =
 
979
                    (elt1->inheritable || elt2->inheritable);
918
980
                  SVN_ERR(combine_with_lastrange(&lastrange, &tmp_range,
919
981
                                                 *output,
920
982
                                                 consider_inheritance,
929
991
        }
930
992
      else  /* ranges don't intersect */
931
993
        {
932
 
          /* See which side of the whiteboard the eraser is on.  If it
933
 
             is on the left side, we need to move the eraser.
 
994
          /* See which side of the rangelist2 the rangelist1 is on.  If it
 
995
             is on the left side, we need to move the rangelist1.
934
996
 
935
 
             If it is on past the whiteboard on the right side, we
936
 
             need to output the whiteboard and increment the
937
 
             whiteboard.  */
 
997
             If it is on past the rangelist2 on the right side, we
 
998
             need to output the rangelist2 and increment the
 
999
             rangelist2.  */
938
1000
          if (svn_sort_compare_ranges(&elt2, &elt1) < 0)
939
1001
            j++;
940
1002
          else
953
1015
 
954
1016
  if (do_remove)
955
1017
    {
956
 
      /* Copy the current whiteboard element if we didn't hit the end
957
 
         of the whiteboard, and we still had it around.  This element
958
 
         may have been touched, so we can't just walk the whiteboard
 
1018
      /* Copy the current rangelist2 element if we didn't hit the end
 
1019
         of the rangelist2, and we still had it around.  This element
 
1020
         may have been touched, so we can't just walk the rangelist2
959
1021
         array, we have to use our copy.  This case only happens when
960
 
         we ran out of eraser before whiteboard, *and* we had changed
961
 
         the whiteboard element. */
962
 
      if (i == lasti && i < whiteboard->nelts)
 
1022
         we ran out of rangelist1 before rangelist2, *and* we had changed
 
1023
         the rangelist2 element. */
 
1024
      if (i == lasti && i < rangelist2->nelts)
963
1025
        {
964
1026
          SVN_ERR(combine_with_lastrange(&lastrange, &wboardelt, *output,
965
1027
                                         consider_inheritance, pool, pool));
966
1028
          i++;
967
1029
        }
968
1030
 
969
 
      /* Copy any other remaining untouched whiteboard elements.  */
970
 
      for (; i < whiteboard->nelts; i++)
 
1031
      /* Copy any other remaining untouched rangelist2 elements.  */
 
1032
      for (; i < rangelist2->nelts; i++)
971
1033
        {
972
 
          svn_merge_range_t *elt = APR_ARRAY_IDX(whiteboard, i,
 
1034
          svn_merge_range_t *elt = APR_ARRAY_IDX(rangelist2, i,
973
1035
                                                 svn_merge_range_t *);
974
1036
 
975
1037
          SVN_ERR(combine_with_lastrange(&lastrange, elt, *output,