rapidsvn-0.12.1-subversion1.9-private-api.patch 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130
  1. Fix compile errors due to hiding of private API in subversion 1.9.
  2. See also:
  3. https://bugs.gentoo.org/show_bug.cgi?id=558572
  4. https://slackbuilds.org/cgit/slackbuilds/commit/?id=c2df77021b476ca9484772361003df04fa03038a
  5. https://github.com/RapidSVN/RapidSVN/issues/6
  6. --- rapidsvn-0.12.1/src/svncpp/client_ls.cpp
  7. +++ rapidsvn-0.12.1/src/svncpp/client_ls.cpp
  8. @@ -29,6 +29,7 @@
  9. #include "svn_client.h"
  10. #include "svn_path.h"
  11. #include "svn_sorts.h"
  12. +#include "svn_version.h"
  13. //#include "svn_utf.h"
  14. // svncpp
  15. @@ -37,6 +38,8 @@
  16. #include "svncpp/exception.hpp"
  17. +#if SVN_VER_MAJOR == 1 && SVN_VER_MINOR < 8
  18. +
  19. static int
  20. compare_items_as_paths(const svn_sort__item_t *a, const svn_sort__item_t *b)
  21. {
  22. @@ -90,6 +93,72 @@
  23. }
  24. }
  25. +#else
  26. +
  27. +#include <algorithm>
  28. +
  29. +static svn_error_t* store_entry(
  30. + void *baton,
  31. + const char *path,
  32. + const svn_dirent_t *dirent,
  33. + const svn_lock_t *,
  34. + const char *abs_path,
  35. + const char *,
  36. + const char *,
  37. + apr_pool_t *scratch_pool)
  38. +{
  39. + svn::DirEntries *entries = reinterpret_cast<svn::DirEntries*>(baton);
  40. + if (path[0] == '\0') {
  41. + if (dirent->kind == svn_node_file) {
  42. + // for compatibility with svn_client_ls behaviour, listing a file
  43. + // stores that file name
  44. + entries->push_back(svn::DirEntry(svn_path_basename(abs_path, scratch_pool), dirent));
  45. + }
  46. + } else {
  47. + entries->push_back(svn::DirEntry(path, dirent));
  48. + }
  49. + return SVN_NO_ERROR;
  50. +}
  51. +
  52. +static bool sort_by_path(svn::DirEntry const& a, svn::DirEntry const& b)
  53. +{
  54. + return svn_path_compare_paths(a.name(), b.name()) < 0;
  55. +}
  56. +
  57. +namespace svn
  58. +{
  59. + DirEntries
  60. + Client::list(const char * pathOrUrl,
  61. + svn_opt_revision_t * revision,
  62. + bool recurse) throw(ClientException)
  63. + {
  64. + Pool pool;
  65. + DirEntries entries;
  66. +
  67. + svn_error_t * error =
  68. + svn_client_list3(pathOrUrl,
  69. + revision,
  70. + revision,
  71. + SVN_DEPTH_INFINITY_OR_IMMEDIATES(recurse),
  72. + SVN_DIRENT_ALL,
  73. + FALSE, // fetch locks
  74. + FALSE, // include externals
  75. + &store_entry,
  76. + &entries,
  77. + *m_context,
  78. + pool);
  79. +
  80. + if (error != SVN_NO_ERROR)
  81. + throw ClientException(error);
  82. +
  83. + std::sort(entries.begin(), entries.end(), &sort_by_path);
  84. +
  85. + return entries;
  86. + }
  87. +}
  88. +
  89. +#endif
  90. +
  91. /* -----------------------------------------------------------------
  92. * local variables:
  93. * eval: (load-file "../../rapidsvn-dev.el")
  94. --- rapidsvn-0.12.1/include/svncpp/dirent.hpp
  95. +++ rapidsvn-0.12.1/include/svncpp/dirent.hpp
  96. @@ -41,7 +41,7 @@
  97. /**
  98. * constructor for existing @a svn_dirent_t entries
  99. */
  100. - DirEntry(const char * name, svn_dirent_t * dirEntry);
  101. + DirEntry(const char * name, const svn_dirent_t * dirEntry);
  102. /**
  103. * copy constructor
  104. --- rapidsvn-0.12.1/src/svncpp/dirent.cpp
  105. +++ rapidsvn-0.12.1/src/svncpp/dirent.cpp
  106. @@ -47,7 +47,7 @@
  107. {
  108. }
  109. - Data(const char * _name, svn_dirent_t * dirEntry)
  110. + Data(const char * _name, const svn_dirent_t * dirEntry)
  111. : name(_name), kind(dirEntry->kind), size(dirEntry->size),
  112. hasProps(dirEntry->has_props != 0),
  113. createdRev(dirEntry->created_rev), time(dirEntry->time)
  114. @@ -78,7 +78,7 @@
  115. {
  116. }
  117. - DirEntry::DirEntry(const char * name, svn_dirent_t * DirEntry)
  118. + DirEntry::DirEntry(const char * name, const svn_dirent_t * DirEntry)
  119. : m(new Data(name, DirEntry))
  120. {
  121. }