wok diff rapidsvn/stuff/client_ls.cpp @ rev 20701

updated airgeddon (3.31 -> 8.12)
author Hans-G?nter Theisgen
date Tue Feb 05 17:16:21 2019 +0100 (2019-02-05)
parents
children
line diff
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/rapidsvn/stuff/client_ls.cpp	Tue Feb 05 17:16:21 2019 +0100
     1.3 @@ -0,0 +1,89 @@
     1.4 +/*
     1.5 + * ====================================================================
     1.6 + * Copyright (c) 2002-2012 The RapidSVN Group.  All rights reserved.
     1.7 + *
     1.8 + * This program is free software: you can redistribute it and/or modify
     1.9 + * it under the terms of the GNU General Public License as published by
    1.10 + * the Free Software Foundation, either version 3 of the License, or
    1.11 + * (at your option) any later version.
    1.12 + *
    1.13 + * This program is distributed in the hope that it will be useful,
    1.14 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
    1.15 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    1.16 + * GNU General Public License for more details.
    1.17 + *
    1.18 + * You should have received a copy of the GNU General Public License
    1.19 + * along with this program (in the file GPL.txt.
    1.20 + * If not, see <http://www.gnu.org/licenses/>.
    1.21 + *
    1.22 + * This software consists of voluntary contributions made by many
    1.23 + * individuals.  For exact contribution history, see the revision
    1.24 + * history and logs, available at http://rapidsvn.tigris.org/.
    1.25 + * ====================================================================
    1.26 + */
    1.27 +// subversion api
    1.28 +#include "svn_client.h"
    1.29 +#include "svn_path.h"
    1.30 +#include "svn_sorts.h"
    1.31 +//#include "svn_utf.h"
    1.32 +
    1.33 +// svncpp
    1.34 +#include "svncpp/client.hpp"
    1.35 +#include "svncpp/dirent.hpp"
    1.36 +#include "svncpp/exception.hpp"
    1.37 +
    1.38 +static bool isEmpty(const char * str)
    1.39 +{
    1.40 +	if (0 == str)
    1.41 +		return true;
    1.42 +	return 0 == *str;
    1.43 +}
    1.44 +
    1.45 +namespace svn
    1.46 +{
    1.47 +  static svn_error_t*
    1.48 +  listEntriesFunc(void *baton, const char *path,
    1.49 +        const svn_dirent_t *dirent, const svn_lock_t *lock,
    1.50 +        const char *abs_path, apr_pool_t *pool)
    1.51 +  {
    1.52 +    if (!isEmpty(path))
    1.53 +    {
    1.54 +      DirEntries * entries = static_cast<DirEntries *>(baton);
    1.55 +      entries->push_back(
    1.56 +        DirEntry(path, const_cast<svn_dirent_t *>(dirent)));
    1.57 +    }
    1.58 +    return 0;
    1.59 +  }
    1.60 +
    1.61 +  DirEntries
    1.62 +  Client::list(const char * pathOrUrl,
    1.63 +               svn_opt_revision_t * revision,
    1.64 +               bool recurse) throw(ClientException)
    1.65 +  {
    1.66 +    Pool pool;
    1.67 +
    1.68 +    DirEntries entries;
    1.69 +    svn_error_t * error =
    1.70 +      svn_client_list2(pathOrUrl,
    1.71 +                       revision,
    1.72 +                       revision,
    1.73 +                       recurse ? svn_depth_infinity : svn_depth_immediates,
    1.74 +                       SVN_DIRENT_ALL,
    1.75 +                       true,
    1.76 +                       listEntriesFunc,
    1.77 +                       &entries,
    1.78 +                       *m_context,
    1.79 +                       pool);
    1.80 +
    1.81 +    if (error != 0)
    1.82 +      throw ClientException(error);
    1.83 +
    1.84 +    return entries;
    1.85 +  }
    1.86 +}
    1.87 +
    1.88 +/* -----------------------------------------------------------------
    1.89 + * local variables:
    1.90 + * eval: (load-file "../../rapidsvn-dev.el")
    1.91 + * end:
    1.92 + */