Skip to main content

Intuitive Subversion wrapper.

Project description

Introduction

svn is a simple Subversion library for Python. I wrote it so that there could be a lightweight and accessible library that was also available on PyPI. It is compatible with both Python 2.7 and 3.3+.

I’ve only implemented the functionality that I have required:

  • Listing entries

  • Getting info

  • Getting log

  • Checking-out

  • Exporting

You are more than welcome to submit pull-requests to add more support for additional subcommands.

Usage

Usage is divided between two clients that either allow for access to a local working-directory or a remote repository.

Both clients inherit a common set of methods that work with both local working- directories and remote repositories.

svn.utility.get_client is provided for convenience. If you provide a location that starts with a backslash, it will return a LocalClient instance. Otherwise, it will return a RemoteClient instance.

LocalClient

LocalClient allows access to a local working copy.

  • export(path)

Example LocalClient usage:

import svn.local
import pprint

r = svn.local.LocalClient('/dev/repo')
r.export('/tmp/export')

pprint.pprint(r.info())

Output:

{ 'commit#revision': 0,
  'commit/author': None,
  'commit/date': datetime.datetime(2014, 4, 1, 5, 50, 27, 826988, tzinfo=tzutc()),
  'commit_author': None,
  'commit_date': datetime.datetime(2014, 4, 1, 5, 50, 27, 826988, tzinfo=tzutc()),
  'commit_revision': 0,
  'entry#kind': 'dir',
  'entry#path': 'working_copy',
  'entry#revision': 0,
  'entry_kind': 'dir',
  'entry_path': 'working_copy',
  'entry_revision': 0,
  'relative_url': '^/',
  'repository/root': 'file:///Users/dustin/development/python/svn/test/repo',
  'repository/uuid': '48195b71-8d94-4528-a019-ec81ebc7e65a',
  'repository_root': 'file:///Users/dustin/development/python/svn/test/repo',
  'repository_uuid': '48195b71-8d94-4528-a019-ec81ebc7e65a',
  'url': 'file:///Users/dustin/development/python/svn/test/repo',
  'wc-info/depth': None,
  'wc-info/schedule': None,
  'wc-info/wcroot-abspath': None,
  'wcinfo_depth': None,
  'wcinfo_schedule': None,
  'wcinfo_wcroot_abspath': None }

RemoteClient

RemoteClient allows access to a remote repository.

  • checkout(path)

  • export(path)

Example RemoteClient usage:

import svn.remote

r = svn.remote.RemoteClient('https://repo.local/svn')
r.checkout('/tmp/working')

Common Functionality

These methods are available on both clients.

  • info()

  • cat(rel_filepath)

  • log_default(timestamp_from_dt=None, timestamp_to_dt=None, limit=None)

Important

Previously, the LocalClient and RemoteClient classes were exposed at the package level:

  • svn.LocalClient

  • svn.RemoteClient

Unfortunately, this interfered with dependency management during installation. The imports will now have to be, respectively:

  • svn.local (for LocalClient)

  • svn.remote (for RemoteClient)

We’re sorry for the inconvenience.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

svn-0.3.25.tar.gz (5.2 kB view details)

Uploaded Source

Built Distribution

svn-0.3.25-py2-none-any.whl (13.2 kB view details)

Uploaded Python 2

File details

Details for the file svn-0.3.25.tar.gz.

File metadata

  • Download URL: svn-0.3.25.tar.gz
  • Upload date:
  • Size: 5.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No

File hashes

Hashes for svn-0.3.25.tar.gz
Algorithm Hash digest
SHA256 a6e1cd9cd98344dffb269a4553180f6d7a78476449049731112d2d475a6129c4
MD5 ce96f880072ec2121d64a48a36299f82
BLAKE2b-256 db9c36e26fa2b1591b2ef8bff66865aa4d0c6e9334f12e168ecdda2a6ed8c15e

See more details on using hashes here.

File details

Details for the file svn-0.3.25-py2-none-any.whl.

File metadata

File hashes

Hashes for svn-0.3.25-py2-none-any.whl
Algorithm Hash digest
SHA256 71bde41fbf282f77e8387b446cff9358b67a78b42832765b0c26d5252c7f073d
MD5 1651fc779544f41c799097bb86005a8b
BLAKE2b-256 7817a8eda4b88caffbcdd6b8ad59398f64c4eef4f905dbb82e572637f5d133eb

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page