~ubuntu-branches/debian/sid/kdesvn/sid

« back to all changes in this revision

Viewing changes to src/svncpp/client_status.cpp

  • Committer: Bazaar Package Importer
  • Author(s): Michael Biebl
  • Date: 2006-01-13 04:31:54 UTC
  • mfrom: (1.1.2 upstream)
  • Revision ID: james.westby@ubuntu.com-20060113043154-6drk4qesrslf3jhm
Tags: 0.7.2-1
* New upstream release.
  + Removed patch context_menu.diff, merged upstream.
* Added patch store_passwords_config.diff. Closes: #345518
* Added patch settings_icons.diff for more distinct icons in the settings
  dialog.

Show diffs side-by-side

added added

removed removed

Lines of Context:
33
33
//#include "svn_utf.h"
34
34
 
35
35
// svncpp
36
 
#include "svncpp/client.hpp"
37
 
#include "svncpp/dirent.hpp"
38
 
#include "svncpp/exception.hpp"
39
 
#include "svncpp/pool.hpp"
40
 
#include "svncpp/status.hpp"
41
 
#include "svncpp/targets.hpp"
42
 
#include "svncpp/info_entry.hpp"
43
 
#include "svncpp/url.hpp"
 
36
#include "client.hpp"
 
37
#include "dirent.hpp"
 
38
#include "exception.hpp"
 
39
#include "pool.hpp"
 
40
#include "status.hpp"
 
41
#include "targets.hpp"
 
42
#include "info_entry.hpp"
 
43
#include "url.hpp"
 
44
#include "svncpp_defines.hpp"
 
45
#include "context_listener.hpp"
44
46
 
45
47
namespace svn
46
48
{
132
134
    baton.pool = pool;
133
135
    error = svn_client_status2 (
134
136
      &revnum,      // revnum
135
 
      path.utf8(),         // path
 
137
      path.TOUTF8(),         // path
136
138
      rev,
137
139
      StatusEntriesFunc, // status func
138
140
      &baton,        // status baton
173
175
  static Status
174
176
  dirEntryToStatus (const QString& path, const DirEntry & dirEntry)
175
177
  {
176
 
    Pool pool;
177
 
    svn_wc_entry_t * e =
178
 
      static_cast<svn_wc_entry_t *> (
179
 
        apr_pcalloc (pool, sizeof (svn_wc_entry_t)));
180
 
 
181
178
    QString url = path;
182
179
    url += "/";
183
180
    url += dirEntry.name();
184
 
 
185
 
    e->name = apr_pstrdup(pool,dirEntry.name().utf8());
186
 
    e->revision = dirEntry.createdRev ();
187
 
    e->url = apr_pstrdup(pool,url.utf8());
188
 
    e->kind = dirEntry.kind ();
189
 
    e->schedule = svn_wc_schedule_normal;
190
 
    e->text_time = dirEntry.time ();
191
 
    e->prop_time = dirEntry.time ();
192
 
    e->cmt_rev = dirEntry.createdRev ();
193
 
    e->cmt_date = dirEntry.time ();
194
 
    e->cmt_author = dirEntry.lastAuthor ();
195
 
 
196
 
    svn_wc_status2_t * s =
197
 
      static_cast<svn_wc_status2_t *> (
198
 
        apr_pcalloc (pool, sizeof (svn_wc_status2_t)));
199
 
    s->entry = e;
200
 
    s->text_status = svn_wc_status_normal;
201
 
    s->prop_status = svn_wc_status_normal;
202
 
    s->locked = 0;
203
 
    s->switched = 0;
204
 
    s->repos_text_status = svn_wc_status_normal;
205
 
    s->repos_prop_status = svn_wc_status_normal;
206
 
    s->repos_lock = 0;
207
 
    return Status (url, s);
 
181
    return Status (url, dirEntry);
208
182
  }
209
183
 
210
184
  static Status
211
185
  infoEntryToStatus(const QString&path,const InfoEntry&infoEntry)
212
186
  {
213
 
    Pool pool;
214
 
    svn_wc_entry_t * e =
215
 
      static_cast<svn_wc_entry_t *> (
216
 
        apr_pcalloc (pool, sizeof (svn_wc_entry_t)));
217
 
 
218
 
    QString url = path;
219
 
    url += "/";
220
 
    url += infoEntry.Name();
221
 
 
222
 
    e->name = apr_pstrdup(pool,infoEntry.Name().utf8());
223
 
    e->revision = infoEntry.revision();
224
 
    e->url = apr_pstrdup(pool,url.utf8());
225
 
    e->kind = infoEntry.kind ();
226
 
    e->schedule = svn_wc_schedule_normal;
227
 
    e->text_time = infoEntry.textTime ();
228
 
    e->prop_time = infoEntry.propTime ();
229
 
    e->cmt_rev = infoEntry.cmtRev ();
230
 
    e->cmt_date = infoEntry.cmtDate();
231
 
    e->cmt_author = infoEntry.cmtAuthor();
232
 
    svn_wc_status2_t * s =
233
 
      static_cast<svn_wc_status2_t *> (
234
 
        apr_pcalloc (pool, sizeof (svn_wc_status2_t)));
235
 
    s->entry = e;
236
 
    s->text_status = svn_wc_status_normal;
237
 
    s->prop_status = svn_wc_status_normal;
238
 
    s->locked = infoEntry.lockEntry().Locked();
239
 
    if (s->locked) {
240
 
        svn_lock_t*l =
241
 
            static_cast<svn_lock_t *> (
242
 
            apr_pcalloc (pool, sizeof (svn_lock_t)));
243
 
        l->token = apr_pstrdup(pool,infoEntry.lockEntry().Token().utf8());
244
 
        l->path = apr_pstrdup(pool,path.utf8());
245
 
        l->owner = apr_pstrdup(pool,infoEntry.lockEntry().Owner().utf8());
246
 
        l->comment = apr_pstrdup(pool,infoEntry.lockEntry().Comment().utf8());
247
 
        l->creation_date = infoEntry.lockEntry().Date();
248
 
        l->expiration_date = infoEntry.lockEntry().Expiration();
249
 
    } else {
250
 
        s->repos_lock = 0;
251
 
    }
252
 
    s->switched = 0;
253
 
    s->repos_text_status = svn_wc_status_normal;
254
 
    s->repos_prop_status = svn_wc_status_normal;
255
 
 
256
 
    return Status (url, s);
 
187
    return Status(infoEntry.url(),infoEntry);
257
188
  }
258
189
 
259
190
  static StatusEntries
264
195
                const bool update,
265
196
                const bool no_ignore,
266
197
                Revision revision,
267
 
                Context * context)
 
198
                Context * context,
 
199
                bool detailed_remote)
268
200
  {
269
201
    DirEntries dirEntries = client->list(path, revision, descend);
270
202
    DirEntries::const_iterator it;
271
203
 
272
204
    StatusEntries entries;
 
205
    QString url = path;
 
206
    url+="/";
 
207
    bool _det = detailed_remote;
 
208
 
273
209
 
274
210
    for (it = dirEntries.begin (); it != dirEntries.end (); it++)
275
211
    {
276
212
      const DirEntry & dirEntry = *it;
277
213
 
278
 
      entries.push_back (dirEntryToStatus (path, dirEntry));
 
214
      if (_det && dirEntry.kind()==svn_node_file) {
 
215
        try {
 
216
            InfoEntries infoEntries = client->info(url+dirEntry.name(),false,revision,Revision(Revision::UNDEFINED));
 
217
            entries.push_back(infoEntryToStatus (path, infoEntries[0]));
 
218
        } catch (ClientException) {
 
219
            _det = false;
 
220
            entries.push_back(dirEntryToStatus (path, dirEntry));
 
221
        }
 
222
      } else {
 
223
        entries.push_back(dirEntryToStatus (path, dirEntry));
 
224
      }
 
225
      if (_det && context->getListener()->contextCancel()) {
 
226
        throw ClientException("Canceld");
 
227
      }
279
228
    }
280
229
 
281
230
    return entries;
287
236
                  const bool get_all,
288
237
                  const bool update,
289
238
                  const bool no_ignore,
290
 
                  Revision revision) throw (ClientException)
 
239
                  Revision revision,
 
240
                  bool detailed_remote) throw (ClientException)
291
241
  {
292
242
    if (Url::isValid (path))
293
243
      return remoteStatus (this, path, descend, get_all, update,
294
 
                           no_ignore,revision,m_context);
 
244
                           no_ignore,revision,m_context,detailed_remote);
295
245
    else
296
246
      return localStatus (path, descend, get_all, update,
297
247
                          no_ignore, m_context);
313
263
 
314
264
    error = svn_client_status2 (
315
265
      &revnum,      // revnum
316
 
      path.utf8(),         // path
 
266
      path.TOUTF8(),         // path
317
267
      rev,
318
268
      StatusEntriesFunc, // status func
319
269
      &baton,        // status baton
411
361
    baton.pool = pool;
412
362
    svn_opt_revision_t pegr;
413
363
    const char *truepath;
414
 
    error = svn_opt_parse_path (&pegr, &truepath,path.utf8(), pool);
 
364
    error = svn_opt_parse_path (&pegr, &truepath,
 
365
                                 path.TOUTF8(),
 
366
                                 pool);
415
367
    if (error != NULL)
416
368
      throw ClientException (error);
417
369
 
418
 
    if ((svn_path_is_url (path.utf8())) && (pegr.kind == svn_opt_revision_unspecified))
 
370
    if ((svn_path_is_url (path.TOUTF8())) && (pegr.kind == svn_opt_revision_unspecified))
419
371
        pegr.kind = svn_opt_revision_head;
420
372
 
421
373
    error =