[svn.haxx.se] · SVN Dev · SVN Users · SVN Org · TSVN Dev · TSVN Users · Subclipse Dev · Subclipse Users · this month's index

RE: client side python APIs to access repos over https

From: Aditya Gandhi <agandhi_at_sapient.com>
Date: 2004-07-05 17:04:51 CEST

Hi Michael,
Had a small question on the code you had sent out earlier

Say, If I were to use the sample given below as follows:

RemoteHistoryParser("http://svn.collab.net/repos/svn/trunk/").fetchHisto
ry(1,2,history_cb)

The my question is what should history_cb have. And how do I get access
to the log messages.

Seems like I need to create a log receiver object however, I have no
clue as to how I need to create it. Any help in that or any example of
how this has been used should do the trick for me.
Thanks and regards

- Aditya Gandhi
  -----Original Message-----
  From: cmpilato@localhost.localdomain
  [mailto:cmpilato@localhost.localdomain] On Behalf Of C. Michael Pilato
  Sent: Wednesday, June 30, 2004 8:13 PM
  To: Aditya Gandhi
  Cc: Ben Collins-Sussman; users@subversion.tigris.org
  Subject: Re: client side python APIs to access repos over https
  
  "Aditya Gandhi" <agandhi@sapient.com> writes:
  
> Hi Ben,
> Thanks for this info.
>
> I have also been trying some of this however it does not seem to
have
> worked.
>
> I have two questions.
> 1. What API needs to be used to login (https access). Do we have any
> sample scripts available for the same?
  
  Unfortunately, it's not possible right now to use any of the prompting
  callbacks for auth. You'll need to populate your
  ~/.subversion/servers file with passwords and such, or get your
  authstuffs cached by just using Subversion to commit something against
  your repository.
  
> 2. I am not able to use the svn_client_log method. Do we have some
> examples available for the same? In case examples are not available
if
> somebody can help me complete / correct the code below that will be
> great
  
  Here's a class in a script I've been developing. You might have to
  tweak it a bit, but the general knowledge you need will be there.
  
  class RemoteHistoryParser(HistoryParser):
    """
    Implementation of the HistoryParser class for doing history
    calculations across RA layers (client-side).
    """
    def __init__(self, repos_url):
      # Init the client app.
      core.apr_initialize()
  
      # Create our top-level pool.
      pool = core.svn_pool_create(None)
  
      # Ensure the we have a configuration area.
      core.svn_config_ensure(None, pool)
  
      # Setup the client context baton, complete with non-prompting
  authstuffs.
      ctx = client.svn_client_ctx_t()
      provs = []
      provs.append(client.svn_client_get_simple_provider(pool))
      provs.append(client.svn_client_get_username_provider(pool))
  
 
provs.append(client.svn_client_get_ssl_server_trust_file_provider(pool))
  
 
provs.append(client.svn_client_get_ssl_client_cert_file_provider(pool))
  
 
provs.append(client.svn_client_get_ssl_client_cert_pw_file_provider(pool
))
      ctx.auth_baton = core.svn_auth_open(provs, pool)
      ctx.config = core.svn_config_get_config(None, pool)
  
      # Start populating our members.
      self.pool = pool
      self.repos_url = repos_url
      self.ctx = ctx
  
    def _rev2optrev(self, rev):
      # Turn a revision argument into an svn_opt_revision_t object.
      rt = core.svn_opt_revision_t()
      if rev is not None:
        if str(rev) == 'HEAD':
          rt.kind = core.svn_opt_revision_head
        else:
          rt.kind = core.svn_opt_revision_number
          rt.value.number = int(rev)
      else:
        rt.kind = core.svn_opt_revision_unspecified
      return rt
  
    def fetchHistory(self, start, end, history_cb):
      # Run svn_client_log(START, END) using HISTORY_CB as the callback.
      client.svn_client_log([self.repos_url],
                            self._rev2optrev(start),
                            self._rev2optrev(end),
                            1, 0, history_cb, self.ctx, self.pool)

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@subversion.tigris.org
For additional commands, e-mail: users-help@subversion.tigris.org
Received on Mon Jul 5 17:07:08 2004

This is an archived mail posted to the Subversion Users mailing list.

This site is subject to the Apache Privacy Policy and the Apache Public Forum Archive Policy.