1 --- a/src/svncpp/client_ls.cpp
2 +++ b/src/svncpp/client_ls.cpp
4 #include "svn_client.h"
7 +#include "svn_version.h"
12 #include "m_is_empty.hpp"
15 +#if SVN_VER_MAJOR == 1 && SVN_VER_MINOR < 8
17 compare_items_as_paths(const svn_sort__item_t *a, const svn_sort__item_t *b)
19 @@ -84,6 +86,72 @@ namespace svn
27 +static svn_error_t* store_entry(
30 + const svn_dirent_t *dirent,
32 + const char *abs_path,
35 + apr_pool_t *scratch_pool)
37 + svn::DirEntries *entries = reinterpret_cast<svn::DirEntries*>(baton);
38 + if (path[0] == '\0') {
39 + if (dirent->kind == svn_node_file) {
40 + // for compatibility with svn_client_ls behaviour, listing a file
41 + // stores that file name
42 + entries->push_back(svn::DirEntry(svn_path_basename(abs_path, scratch_pool), dirent));
45 + entries->push_back(svn::DirEntry(path, dirent));
47 + return SVN_NO_ERROR;
50 +static bool sort_by_path(svn::DirEntry const& a, svn::DirEntry const& b)
52 + return svn_path_compare_paths(a.name(), b.name()) < 0;
58 + Client::list(const char * pathOrUrl,
59 + svn_opt_revision_t * revision,
60 + bool recurse) throw(ClientException)
65 + svn_error_t * error =
66 + svn_client_list3(pathOrUrl,
69 + SVN_DEPTH_INFINITY_OR_IMMEDIATES(recurse),
71 + FALSE, // fetch locks
72 + FALSE, // include externals
78 + if (error != SVN_NO_ERROR)
79 + throw ClientException(error);
81 + std::sort(entries.begin(), entries.end(), &sort_by_path);
89 /* -----------------------------------------------------------------
91 * eval: (load-file "../../rapidsvn-dev.el")
92 --- a/src/svncpp/dirent.cpp 2017-03-19 15:48:58.956827337 +0100
93 +++ b/src/svncpp/dirent.cpp 2017-03-19 15:50:19.111527279 +0100
98 - Data(const char * _name, svn_dirent_t * dirEntry)
99 + Data(const char * _name, const svn_dirent_t * dirEntry)
100 : name(_name), kind(dirEntry->kind), size(dirEntry->size),
101 hasProps(dirEntry->has_props != 0),
102 createdRev(dirEntry->created_rev), time(dirEntry->time)
107 - DirEntry::DirEntry(const char * name, svn_dirent_t * DirEntry)
108 + DirEntry::DirEntry(const char * name, const svn_dirent_t * DirEntry)
109 : m(new Data(name, DirEntry))
112 --- a/include/svncpp/dirent.hpp 2017-03-19 15:50:54.860506116 +0100
113 +++ b/include/svncpp/dirent.hpp 2017-03-19 15:50:58.314407598 +0100
116 * constructor for existing @a svn_dirent_t entries
118 - DirEntry(const char * name, svn_dirent_t * dirEntry);
119 + DirEntry(const char * name, const svn_dirent_t * dirEntry);