wok-6.x view rapidsvn/stuff/client_ls.cpp @ rev 20661

Up slitaz-base-files (339)
author Pascal Bellard <pascal.bellard@slitaz.org>
date Mon Jan 14 10:40:58 2019 +0100 (2019-01-14)
parents
children
line source
1 /*
2 * ====================================================================
3 * Copyright (c) 2002-2012 The RapidSVN Group. All rights reserved.
4 *
5 * This program is free software: you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation, either version 3 of the License, or
8 * (at your option) any later version.
9 *
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
14 *
15 * You should have received a copy of the GNU General Public License
16 * along with this program (in the file GPL.txt.
17 * If not, see <http://www.gnu.org/licenses/>.
18 *
19 * This software consists of voluntary contributions made by many
20 * individuals. For exact contribution history, see the revision
21 * history and logs, available at http://rapidsvn.tigris.org/.
22 * ====================================================================
23 */
24 // subversion api
25 #include "svn_client.h"
26 #include "svn_path.h"
27 #include "svn_sorts.h"
28 //#include "svn_utf.h"
30 // svncpp
31 #include "svncpp/client.hpp"
32 #include "svncpp/dirent.hpp"
33 #include "svncpp/exception.hpp"
35 static bool isEmpty(const char * str)
36 {
37 if (0 == str)
38 return true;
39 return 0 == *str;
40 }
42 namespace svn
43 {
44 static svn_error_t*
45 listEntriesFunc(void *baton, const char *path,
46 const svn_dirent_t *dirent, const svn_lock_t *lock,
47 const char *abs_path, apr_pool_t *pool)
48 {
49 if (!isEmpty(path))
50 {
51 DirEntries * entries = static_cast<DirEntries *>(baton);
52 entries->push_back(
53 DirEntry(path, const_cast<svn_dirent_t *>(dirent)));
54 }
55 return 0;
56 }
58 DirEntries
59 Client::list(const char * pathOrUrl,
60 svn_opt_revision_t * revision,
61 bool recurse) throw(ClientException)
62 {
63 Pool pool;
65 DirEntries entries;
66 svn_error_t * error =
67 svn_client_list2(pathOrUrl,
68 revision,
69 revision,
70 recurse ? svn_depth_infinity : svn_depth_immediates,
71 SVN_DIRENT_ALL,
72 true,
73 listEntriesFunc,
74 &entries,
75 *m_context,
76 pool);
78 if (error != 0)
79 throw ClientException(error);
81 return entries;
82 }
83 }
85 /* -----------------------------------------------------------------
86 * local variables:
87 * eval: (load-file "../../rapidsvn-dev.el")
88 * end:
89 */