~ubuntu-branches/debian/sid/subversion/sid

« back to all changes in this revision

Viewing changes to tools/examples/get-location-segments.py

  • Committer: Package Import Robot
  • Author(s): James McCoy, Peter Samuelson, James McCoy
  • Date: 2014-01-12 19:48:33 UTC
  • mfrom: (0.2.10)
  • Revision ID: package-import@ubuntu.com-20140112194833-w3axfwksn296jn5x
Tags: 1.8.5-1
[ Peter Samuelson ]
* New upstream release.  (Closes: #725787) Rediff patches:
  - Remove apr-abi1 (applied upstream), rename apr-abi2 to apr-abi
  - Remove loosen-sqlite-version-check (shouldn't be needed)
  - Remove java-osgi-metadata (applied upstream)
  - svnmucc prompts for a changelog if none is provided. (Closes: #507430)
  - Remove fix-bdb-version-detection, upstream uses "apu-config --dbm-libs"
  - Remove ruby-test-wc (applied upstream)
  - Fix “svn diff -r N file” when file has svn:mime-type set.
    (Closes: #734163)
  - Support specifying an encoding for mod_dav_svn's environment in which
    hooks are run.  (Closes: #601544)
  - Fix ordering of “svnadmin dump” paths with certain APR versions.
    (Closes: #687291)
  - Provide a better error message when authentication fails with an
    svn+ssh:// URL.  (Closes: #273874)
  - Updated Polish translations.  (Closes: #690815)

[ James McCoy ]
* Remove all traces of libneon, replaced by libserf.
* patches/sqlite_3.8.x_workaround: Upstream fix for wc-queries-test test
  failurse.
* Run configure with --with-apache-libexecdir, which allows removing part of
  patches/rpath.
* Re-enable auth-test as upstream has fixed the problem of picking up
  libraries from the environment rather than the build tree.
  (Closes: #654172)
* Point LD_LIBRARY_PATH at the built auth libraries when running the svn
  command during the build.  (Closes: #678224)
* Add a NEWS entry describing how to configure mod_dav_svn to understand
  UTF-8.  (Closes: #566148)
* Remove ancient transitional package, libsvn-ruby.
* Enable compatibility with Sqlite3 versions back to Wheezy.
* Enable hardening flags.  (Closes: #734918)
* patches/build-fixes: Enable verbose build logs.
* Build against the default ruby version.  (Closes: #722393)

Show diffs side-by-side

added added

removed removed

Lines of Context:
21
21
#
22
22
import sys
23
23
import os
 
24
import getpass
24
25
from svn import client, ra, core
25
26
 
26
27
def printer(segment, pool):
71
72
  return url, peg_revision, start_revision, end_revision
72
73
 
73
74
 
 
75
def prompt_func_ssl_unknown_cert(realm, failures, cert_info, may_save, pool):
 
76
  print "The certficate details are as follows:"
 
77
  print "--------------------------------------"
 
78
  print "Issuer     : " + str(cert_info.issuer_dname)
 
79
  print "Hostname   : " + str(cert_info.hostname)
 
80
  print "ValidFrom  : " + str(cert_info.valid_from)
 
81
  print "ValidUpto  : " + str(cert_info.valid_until)
 
82
  print "Fingerprint: " + str(cert_info.fingerprint)
 
83
  print ""
 
84
  ssl_trust = core.svn_auth_cred_ssl_server_trust_t()
 
85
  if may_save:
 
86
    choice = raw_input( "accept (t)temporarily   (p)permanently: ")
 
87
  else:
 
88
    choice = raw_input( "(r)Reject or accept (t)temporarily: ")
 
89
  if choice[0] == "t" or choice[0] == "T":
 
90
    ssl_trust.may_save = False
 
91
    ssl_trust.accepted_failures = failures
 
92
  elif choice[0] == "p" or choice[0] == "P":
 
93
    ssl_trust.may_save = True
 
94
    ssl_trust.accepted_failures = failures
 
95
  else:
 
96
    ssl_trust = None
 
97
  return ssl_trust
 
98
 
 
99
def prompt_func_simple_prompt(realm, username, may_save, pool):
 
100
  username = raw_input("username: ")
 
101
  password = getpass.getpass(prompt="password: ")
 
102
  simple_cred = core.svn_auth_cred_simple_t()
 
103
  simple_cred.username = username
 
104
  simple_cred.password = password
 
105
  simple_cred.may_save = False
 
106
  return simple_cred
 
107
 
 
108
def prompt_func_gnome_keyring_prompt(keyring, pool):
 
109
  return getpass.getpass(prompt="Password for '%s' GNOME keyring: " % keyring)
 
110
 
74
111
def main():
75
112
  try:
76
113
    url, peg_revision, start_revision, end_revision = parse_args(sys.argv[1:])
90
127
    sys.exit(1)
91
128
 
92
129
  core.svn_config_ensure(None)
93
 
  ctx = client.ctx_t()
 
130
  ctx = client.svn_client_create_context()
 
131
  ctx.config = core.svn_config_get_config(None)
94
132
 
95
133
  # Make sure that these are at the start of the list, so passwords from
96
134
  # gnome-keyring / kwallet are checked before asking for new passwords.
97
 
  # Note that we don't pass our config here, since we can't seem to access
98
 
  # ctx.config.config (ctx.config is opaque).
99
 
  providers = core.svn_auth_get_platform_specific_client_providers(None, None)
 
135
  providers = core.svn_auth_get_platform_specific_client_providers(ctx.config['config'], None)
100
136
  providers.extend([
101
137
    client.get_simple_provider(),
 
138
    core.svn_auth_get_ssl_server_trust_file_provider(),
 
139
    core.svn_auth_get_simple_prompt_provider(prompt_func_simple_prompt, 2),
 
140
    core.svn_auth_get_ssl_server_trust_prompt_provider(prompt_func_ssl_unknown_cert),
102
141
    client.get_username_provider(),
103
142
    client.get_ssl_server_trust_file_provider(),
104
143
    client.get_ssl_client_cert_file_provider(),
106
145
  ])
107
146
 
108
147
  ctx.auth_baton = core.svn_auth_open(providers)
109
 
  ctx.config = core.svn_config_get_config(None)
 
148
 
 
149
  if hasattr(core, 'svn_auth_set_gnome_keyring_unlock_prompt_func'):
 
150
    core.svn_auth_set_gnome_keyring_unlock_prompt_func(ctx.auth_baton, prompt_func_gnome_keyring_prompt)
110
151
 
111
152
  ra_callbacks = ra.callbacks_t()
112
153
  ra_callbacks.auth_baton = ctx.auth_baton