Fix broken code to generate file/rev informations.
authorShun-ichi GOTO <shunichi.goto@gmail.com>
Wed Jan 17 16:47:07 2007 +0900 (2007-01-17)
changeset 41e55c921930eb
parent 40 0539b98b2dd2
child 42 3fefbe9a3b1c
Fix broken code to generate file/rev informations.
test/gen-hist.py
     1.1 --- a/test/gen-hist.py	Wed Jan 17 03:27:51 2007 +0900
     1.2 +++ b/test/gen-hist.py	Wed Jan 17 16:47:07 2007 +0900
     1.3 @@ -146,7 +146,7 @@
     1.4          props['author'] = author and unicode(author, 'utf-8')
     1.5          props['date_str'] = date or ''
     1.6          if date:
     1.7 -            date = core.svn_time_from_cstring(date, pool) / 1000000
     1.8 +            date = core.svn_time_from_cstring(date) / 1000000
     1.9          else:
    1.10              date = 0
    1.11          props['date'] = date
    1.12 @@ -167,7 +167,7 @@
    1.13                  print '%3s, %-20s, %s, %s' % (rev, p, cp['action'], copyfrom)
    1.14              print '-' * 70
    1.15  
    1.16 -    ra.get_log(session, [''], rev_start, rev_end, 0, True, False, log_receiver, pool)
    1.17 +    ra.get_log(session, [''], rev_start, rev_end, 0, True, False, log_receiver)
    1.18      for log in history:
    1.19          rev = log['rev']
    1.20          max_rev = max(max_rev, rev)
    1.21 @@ -183,13 +183,10 @@
    1.22              hist.append((rev, action, copyfrom_path, copyfrom_revision))
    1.23              hist.sort(lambda x,y: cmp(x[0],y[0]))
    1.24              path_history_map[path] = hist
    1.25 -    paths = []
    1.26 -    for k, v in path_history_map.items():
    1.27 -        paths.append(k)
    1.28 +    paths = path_history_map.keys()
    1.29      paths.sort()
    1.30 -    min_rev = 65535
    1.31 -    for path in paths:
    1.32 -        min_rev = min(path_history_map[path][0][0], rev)
    1.33 +    min_rev = min([x[0][0] for x in path_history_map.values()])
    1.34 +    min_rev = min(min_rev, rev)
    1.35      line = ['file/dir'] + [str(x) for x in range(min_rev, max_rev+1)]
    1.36      lines = [line]
    1.37  
    1.38 @@ -210,7 +207,6 @@
    1.39              rev += 1
    1.40          lines.append(line)
    1.41      
    1.42 -
    1.43      # final output
    1.44      print r"""# This table is generated by %s using ra.get_log()
    1.45  
    1.46 @@ -221,7 +217,7 @@
    1.47          sys.stderr.write('ERROR: unknown output format: %s' % format)
    1.48          sys.exit(1)
    1.49          
    1.50 -    print formatter(lines, 1)
    1.51 +    print formatter(lines, 1).encode('utf-8')
    1.52  
    1.53  
    1.54  ### ------------------------------------------------------------
    1.55 @@ -247,6 +243,9 @@
    1.56                  ['-r', '--revision',
    1.57                   'rev', None,
    1.58                   'REV', 'Revision or revision range to search.'],
    1.59 +                ['-o','--output',
    1.60 +                 'output', None,
    1.61 +                 'FILE', 'Filename to output'],
    1.62                  ]
    1.63  
    1.64  def usage(msg=None):
    1.65 @@ -270,18 +269,17 @@
    1.66      if  2 < len(args):
    1.67          usage('Too many arguments.')
    1.68  
    1.69 -    callbacks = ra.callbacks2_t()
    1.70 +    callbacks = ra.callbacks_t()
    1.71      providers = [
    1.72          client.get_simple_provider(),
    1.73 -        #client.get_ssl_client_cert_file_provider(),
    1.74 -        #client.get_ssl_client_cert_pw_file_provider(),
    1.75 -        #client.get_ssl_server_trust_file_provider(),
    1.76 +        client.get_ssl_client_cert_file_provider(),
    1.77 +        client.get_ssl_client_cert_pw_file_provider(),
    1.78 +        client.get_ssl_server_trust_file_provider(),
    1.79          client.get_username_provider(),
    1.80          ]
    1.81      callbacks.auth_baton = core.svn_auth_open(providers)
    1.82      config = core.svn_config_get_config(None)
    1.83 -    pool = core.svn_pool_create()
    1.84 -    session = ra.open2(options.url, callbacks, None, config, pool)
    1.85 +    session = ra.open(options.url, callbacks, None, config)
    1.86  
    1.87      # fixup scope
    1.88      scope = options.scope