• Stars
    star
    215
  • Rank 182,856 (Top 4 %)
  • Language
    Python
  • License
    GNU General Publi...
  • Created over 10 years ago
  • Updated 5 months ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Lightweight Subversion library for Python.

Build_Status Coverage_Status

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+.

The library wraps the svn commandline client, which should consequently be installed on the local system.

Functions currently implemented:

  • list
  • info
  • log
  • checkout
  • export
  • cat
  • diff (with raw and summary support)
  • status
  • add
  • commit
  • update
  • cleanup
  • remove (i.e. rm, del, delete)

In addition, there is also an "admin" class (svn.admin.Admin) that provides a create method with which to create repositories.

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.

You may pass username and password as optional arguments to both the constructor and utility function.

LocalClient

LocalClient allows access to a local working copy.

RemoteClient

RemoteClient allows access to a remote repository.

SvnException

SvnException is raised whenever there is an issue with the svn repository. We are no longer supporting catching ValueError.

checkout(path)

Checkout a remote repository:

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(rel_path=None)

Get information about the directory.

import pprint

import svn.local

r = svn.local.LocalClient('/tmp/test_repo.co')
info = r.info()
pprint.pprint(info)

#{'commit#revision': 0,
# 'commit/author': None,
# 'commit/date': datetime.datetime(2015, 4, 24, 2, 53, 21, 874970, tzinfo=tzutc()),
# 'commit_author': None,
# 'commit_date': datetime.datetime(2015, 4, 24, 2, 53, 21, 874970, tzinfo=tzutc()),
# 'commit_revision': 0,
# 'entry#kind': 'dir',
# 'entry#path': '/tmp/test_repo.co',
# 'entry#revision': 0,
# 'entry_kind': 'dir',
# 'entry_path': '/tmp/test_repo.co',
# 'entry_revision': 0,
# 'relative_url': None,
# 'repository/root': 'file:///tmp/test_repo',
# 'repository/uuid': '7446d4e9-8846-46c0-858a-34a2a1739d1c',
# 'repository_root': 'file:///tmp/test_repo',
# 'repository_uuid': '7446d4e9-8846-46c0-858a-34a2a1739d1c',
# 'url': 'file:///tmp/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}

NOTE: The keys named with dashes, slashes, and hashes are considered obsolete, and only available for backwards compatibility. We have since moved to using only underscores to separate words.

cat(rel_filepath)

Get file-data as string.

import svn.local

l = svn.local.LocalClient('/tmp/test_repo')
content = l.cat('test_file')

log_default(timestamp_from_dt=None, timestamp_to_dt=None, limit=None, rel_filepath='', stop_on_copy=False, revision_from=None, revision_to=None, changelist=False)

Perform a log-listing that can be bounded by time or revision number and/or take a maximum-count.

import svn.local

l = svn.local.LocalClient('/tmp/test_repo.co')

for e in l.log_default():
    print(e)

#LogEntry(date=datetime.datetime(2015, 4, 24, 3, 2, 39, 895975, tzinfo=tzutc()), msg='Added second file.', revision=2, author='dustin')
#LogEntry(date=datetime.datetime(2015, 4, 24, 2, 54, 2, 136170, tzinfo=tzutc()), msg='Initial commit.', revision=1, author='dustin')

export(to_path, revision=None, force=False)

Checkout the tree without embedding an meta-information.

import svn.remote

r = svn.remote.RemoteClient('file:///tmp/test_repo')
r.export('/tmp/test_export')

We can also use force option to force the svn export.

list(extended=False, rel_path=None)

Return either a flat-list of filenames or a list of objects describing even more information about each.

import pprint

import svn.local

l = svn.local.LocalClient('/tmp/test_repo.co')

# Flat list.

entries = l.list()
for filename in entries:
    print(filename)

#aa
#bb

# Extended information.

entries = l.list(extended=True)
for entry in entries:
    pprint.pprint(entry)

#{'author': 'dustin',
# 'commit_revision': 1,
# 'date': datetime.datetime(2015, 4, 24, 2, 54, 2, 136170, tzinfo=tzutc()),
# 'is_directory': False,
# 'kind': 'file',
# 'name': 'aa',
# 'size': 0,
# 'timestamp': datetime.datetime(2015, 4, 24, 2, 54, 2, 136170, tzinfo=tzutc())}
#{'author': 'dustin',
# 'commit_revision': 2,
# 'date': datetime.datetime(2015, 4, 24, 3, 2, 39, 895975, tzinfo=tzutc()),
# 'is_directory': False,
# 'kind': 'file',
# 'name': 'bb',
# 'size': 0,
# 'timestamp': datetime.datetime(2015, 4, 24, 3, 2, 39, 895975, tzinfo=tzutc())}

list_recursive(rel_path=None, yield_dirs=False, path_filter_cb=None)

List all entries at and beneath the root or given relative-path.

import pprint

import svn.local

l = svn.local.LocalClient('/tmp/test_repo.co')

for rel_path, e in l.list_recursive():
    print('')
    print('[' + rel_path + ']')
    print('')

    pprint.pprint(e)

#[]
#
#{'author': 'dustin',
# 'commit_revision': 1,
# 'date': datetime.datetime(2015, 4, 24, 2, 54, 2, 136170, tzinfo=tzutc()),
# 'is_directory': False,
# 'kind': 'file',
# 'name': 'aa',
# 'size': 0,
# 'timestamp': datetime.datetime(2015, 4, 24, 2, 54, 2, 136170, tzinfo=tzutc())}
#
#[]
#
#{'author': 'dustin',
# 'commit_revision': 2,
# 'date': datetime.datetime(2015, 4, 24, 3, 2, 39, 895975, tzinfo=tzutc()),
# 'is_directory': False,
# 'kind': 'file',
# 'name': 'bb',
# 'size': 0,
# 'timestamp': datetime.datetime(2015, 4, 24, 3, 2, 39, 895975, tzinfo=tzutc())}
#
#[dir1]
#
#{'author': 'dustin',
# 'commit_revision': 3,
# 'date': datetime.datetime(2015, 4, 24, 3, 25, 13, 479212, tzinfo=tzutc()),
# 'is_directory': False,
# 'kind': 'file',
# 'name': 'cc',
# 'size': 0,
# 'timestamp': datetime.datetime(2015, 4, 24, 3, 25, 13, 479212, tzinfo=tzutc())}

diff_summary(start_revision, end_revision)

A lower-level diff summary that doesn't actually provide the content differences.

import svn.remote

l = svn.remote.RemoteClient('http://svn.apache.org/repos/asf')
print l.diff_summary(1760022, 1760023)

# [{'item': 'modified',
#  'kind': 'file',
#  'path': 'http://svn.apache.org/repos/asf/sling/trunk/pom.xml'},
# {'item': 'added',
#  'kind': 'file',
#  'path': 'http://svn.apache.org/repos/asf/sling/trunk/bundles/extensions/models/pom.xml'}]

diff(start_revision, end_revision)

Diffs between start and end revisions

Notice of Diff Reimplementation in 1.0.0

There was a previous contribution to the diff implementation that has been reported and confirmed to often throw an exception due to shoddy handling of the file-paths in the output. It also made secondary shell calls and mixed both text and XML output in the response. As a result of this, the decision has been made to just reimplement it and reshape the output in a backwards-incompatible way at the same time. If you need to stick to the older implementation, tie your dependencies to the 0.3.46 release.

More Repositories

1

GDriveFS

An innovative FUSE wrapper for Google Drive.
Python
663
star
2

go-exif

A very complete, highly tested, standards-driven (but customizable) EXIF reader/writer lovingly written in Go.
Go
491
star
3

PyInotify

An efficient and elegant inotify (Linux filesystem activity monitor) library for Python. Python 2 and 3 compatible.
Python
240
star
4

PyEasyArchive

A very intuitive and useful adapter to libarchive for universal archive access.
Python
97
star
5

go-jpeg-image-structure

Parse JPEG data into segments via code or CLI from pure Go. Read/export/write EXIF data. Read XMP and IPTC metadata.
Go
69
star
6

go-ext4

A pure Go implementation of an ext4 reader with journaling support that does not require the kernel nor privileged access.
Go
43
star
7

Snackwich

A Snack-based Python console UI that reads screen configurations from a file.
Python
27
star
8

TightOCR

A slim, non-SWIG Python adapter to CTesseract (Tesseract OCR for C).
Python
24
star
9

GeonamesRdf

A Python client for the RDF web-services provided by Geonames (http://www.geonames.org).
Python
22
star
10

go-png-image-structure

Read/write PNGs as well as the EXIF in PNGs from pure Go.
Go
22
star
11

go-perceptualhash

Blockhash perceptual-hash algorithm for images. Written in pure Go.
Go
21
star
12

PythonEtcdClient

A simple and efficient etcd client that exposes all functions and just works.
Python
21
star
13

M2CryptoWindows

Binaries for Python 2.7 M2Crypto under Windows
19
star
14

go-exfat

exFAT reader implementation based on Microsoft specifications.
Go
18
star
15

PySecure

A complete Python SSH/SFTP library based on libssh.
Python
18
star
16

go-exif-knife

Perform surgical operations on EXIF data at the command-line with JPG, PNG, HEIC, and TIFF files.
Go
17
star
17

RandomUtility

Disparate tools by published by Dustin.
Python
14
star
18

TinyUntar

A tiny untar library written in C.
C
14
star
19

GeditSafetySave

Automatically store unsaved documents to a temporary location under the current user's home. This keeps your documents, temporary to-do lists, etc.. safe from crashes.
Python
14
star
20

CTesseract

A C adapter for the C++ Tesseract OCR Library (Google).
C++
13
star
21

go-fuse-example

A minimal, browseable, read-only, memory-based filesystem in Go.
Go
12
star
22

RijndaelPbkdf

Pure-Python Rijndael and PBKDF2 package. Python2 and Python3 compatible.
Python
12
star
23

CodeMirrorRemoteValidator

An asynchronous CodeMirror lint plugin that will receive code, send it to a callback (that can send it somewhere via Ajax, etc..), and apply any discovered errors on return.
JavaScript
12
star
24

go-appengine-sessioncascade

Equip Go with session support under Google AppEngine. Implement one or more AppEngine-specific backends, such as Memcache and Datastore, to store your session data.
Go
12
star
25

go-heic-exif-extractor

Parses an HEIC image and returns an EXIF accessor (if an EXIF blob is present).
Go
11
star
26

youtube-autodownloader

Monitor YouTube playlists and automatically download newly-added videos.
Python
11
star
27

PyHdHomeRun

Python interface to HDHomeRun network-attached TV tuners.
Python
10
star
28

ChromeIdGenerator

A tiny tool to generate Google Chrome extension IDs from an extension's public-key.
Python
9
star
29

ApnsPlistCsr

Tool to produce encoded Plists/CSRs for APNS.
Python
9
star
30

PySchedules

Schedules Direct library for Python. Provides event-driven hooks for lineup, station, channel map, schedule, program, cast/crew, and genre data. Also provides QAM map (channels.conf) data. Go wild.
Python
9
star
31

protobufp

Adds the stream-processing to protobuf messaging that you usually need to add yourself.
Python
8
star
32

go-exiftool

List EXIF tags, set EXIF tags, and extract thumbnails in images using Go.
Go
7
star
33

PythonUpstart

An intuitive library interface to Upstart for service and job management.
Python
7
star
34

go-iptc

Parse IPTC metadata with pure Go
Go
6
star
35

JobX

JobExchange is a distributed Python-Based MapReduce solution.
Python
5
star
36

M2CryptoWin64

An installable M2Crypto Python package for 64-bit Windows systems.
Python
5
star
37

SslApi

An SOA certificate authority (CA).
Python
5
star
38

go-time-parse

Parse time phrases into Go durations.
Go
5
star
39

M2CryptoWin32

An installable M2Crypto Python package for 32-bit Windows systems.
Python
5
star
40

go-logging

Useful and awesome logging system for Go with prefixing and stacktraces.
Go
5
star
41

RestPipe

An SSL-authenticated, durable, bidirectional, RESTful, client-server pipe that transports custom events.
Python
5
star
42

ZapLib

A C library of uniform DVB tuning calls for ATSC (US), DVB-C (cable), DVB-S (satellite), DVB-T (terrestrial). Based on dvb-apps.
C
5
star
43

markdown-embedimages

Translate markdown to HTML and encode/embed images into the HTML.
Python
5
star
44

go-parallel-walker

CURRENTLY IN ACTIVE DEVELOPMENT - A simple, tuneable Go package and CLI tool to quickly walk a filesystem using a concurrently-processed job queue.
Go
4
star
45

RelayServer

A service that that acts as a single proxy between many individual clients and many instances of a server. As the clients initiate connections to the relay server, this solution defeats NAT.
Python
4
star
46

heic-exif-samples

Samples of HEIC images with EXIF. At this point in time they're non-trivial to find in the wild.
4
star
47

AwsDynDns

Update your Route53-hosted domain name with your public IP.
Python
4
star
48

CaKit

A light project that conveniently bundles the logic needed to build both example CA certificates and a signed, example certificate.
Python
4
star
49

DtcLookup

A webpage-based database for automotive diagnostic trouble codes (DTC's).
Python
4
star
50

time-to-go

Efficiently store, scan, retrieve, update, and add time-series blobs on a filesystem.
Go
4
star
51

YiiBash

Add Bash command completion to your PHP Yii project.
PHP
4
star
52

GlacierTool

A simple tool to do massive uploads to Amazon Glacier
Python
4
star
53

PyZap

Python wrapper for ZapLib digital television (DVB) tuning library.
Python
4
star
54

go-tiff-image-structure

Parse TIFF data for EXIF metadata
Go
4
star
55

JsonPare

A very simple utility to decode and unwind JSON into JSON from the command-line.
Python
4
star
56

SMARTOnFHIRExample

A working example of how to read FHIR health data from a SMART resource and plot aggregate vital signs (all patients).
Python
4
star
57

go-xmp

Parse XMP documents (for image-metadata) with pure Go.
Go
4
star
58

go-utility

Reusable tools.
Go
3
star
59

go-geographic-attractor

Efficiently identify the nearest major city to a given coordinate.
Go
3
star
60

python-googleautoauth

Dramatically reduces the complexity of the Google API authentication/authorization process in command-line tools.
Python
3
star
61

go-appengine-logging

Configuration-based AppEngine logging library with level control, filters, and pluggable, interface-based writers.
Go
3
star
62

go-geographic-index

An in-memory time-series index that can be populated manually and/or by recursively processing a path.
Go
3
star
63

go-gpx

Easily and efficiently processing GPX (geographic track/log) data from Go.
Go
3
star
64

go-time-index

A simple Go package to manage time-series with data and slices of time-intervals with data.
Go
3
star
65

go-geographic-autogroup-images

A package that knows how to take a list of locations, a list of images, knowledge of EXIF, and some geographic/population data (if any images are not already geotagged), and group images by the major cities that they were taken near.
Go
3
star
66

HuffmanExample

Shows how to build a tree, establish an encoding, encode the data, preorder-serialize the binary tree, combine the tree and data to render complete file-data, and reverse the process.
Python
3
star
67

go-s2

A tool that can convert between coordinates, S2 cells, and S2 tokens, print cell info, and generate KML visualizations of cell parents and boundaries.
Go
2
star
68

go-napster-to-spotify-sync

Install tracks from Napster favorites to a Spotify playlist by one or more artists.
Go
2
star
69

go-pathfingerprint

Recursively calculate a SHA1 or SHA256 hash for a given directory.
Go
2
star
70

PySynchronousGlacier

Execute synchronous workflows against Amazon Glacier.
Python
2
star
71

SvnCl

A one-line command to streamline building a Subversion changelog for tag/release messages.
Python
2
star
72

go-napster

A Go client for Napster/Rhapsody.
Go
2
star
73

TabManiac

Automatically back-up your Chrome tabs, and maintain a history of backups.
JavaScript
2
star
74

go-efficient-json-reader

Easily, efficiently, iteratively parse massive JSON data structures.
Go
2
star
75

RWebApplicationExample

An example Rook-based R web application
HTML
2
star
76

omsa-alert

Send emails or call commands when there are controller/disk problems reported by the Dell OMSA omreport command-line tool.
Python
2
star
77

bracketed-image-finder

Determine groups of images that were produced by bracketed image capture (e.g. Sony cameras)
Python
2
star
78

go-photoshop-info-format

Minimal Photoshop format implementation. Currently only provides parsing functionality to expose embedded IPTC data.
Go
2
star
79

PathScan

A parallellized filesystem scanning, filtering, and processing framework (iteration 3).
Python
2
star
80

go-webp-image-structure

Parse WEBP RIFF stream and expose EXIF data via pure Go.
Go
2
star
81

HookableWebServer

A tiny C++ (mostly C) web-server that calls function pointers for requests and logging. Based on IBM's open-source small "nweb" web server..
C++
2
star
82

RemoteImageBrowser

Allows you to efficiently browse a large image-file hierarchy from a website with thumbnails (cached) and lightboxes.
JavaScript
2
star
83

MpegTsScanner

Library to scan packets from an MPEG-TS file. Also provides a call to grab information on the first program found. This latter feature is useful for getting information (subtitle info, etc..) for a program recorded from an ATSC/DVB television tuner. Depends on the LIBDVBPSI library (from the VLC project).
C
2
star
84

go-github-reminders

A tool that determines what Github issues you are currently involved in and reminds you about issues you are overdue in responding to.
Go
2
star
85

LicensePrepend

Make sure all your source files have the standard licensing stub at the top.
Python
2
star
86

BeanTool

A console tool for querying a beanstalkd queue.
Python
2
star
87

WebsocketServer

A reference implementation for a WebSocket server and two sample clients. Tested under Firefox 13 and Chrome 20.
PHP
2
star
88

go-gpxreader

Easily and efficiently processing GPX (geographic track/log) data from Go. PROJECT IS DEPRECATED. PLEASE USE go-gpx/reader.
Go
2
star
89

tree_partition

Partition a large file tree into several file trees of symlinks having equal file counts
Python
2
star
90

go-index-audit

A tool to wait on the Go Proxy to propagate your recent changes before returning
Go
1
star
91

pathhistogram

Generate a histogram of file-sizes within a path. Can also set constraints and write-out the bins.
Python
1
star
92

go-gpsbabel

A wrapper around GPSBabel to allow idiomatic Go to be used to interact with it.
Go
1
star
93

bingrok

A surgical tool for exploring structured binary data
Python
1
star
94

go-exif-extra

Higher-level EXIF and image functionality that works universally across many image formats.
Go
1
star
95

go-http-lifecycle-router

A simple HTTP handler suite that can trigger lifecycle events before and after requests are handled.
Go
1
star
96

PackageBackupClient

Client for the Package Backup package-list backup service.
Python
1
star
97

elasticbeanstalk-test

Go
1
star
98

PypiStats

A jQuery plugin to display a PyPI package's download statistics.
JavaScript
1
star
99

go-gpx-distance

Count the kilometers traveled in GPX data
Go
1
star
100

PythonScheduler

A multithreaded task scheduler that can schedule Python routines to run either at a particular time or at a particular interval.
Python
1
star