Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions .github/workflows/pythonpackage.yml
Original file line number Diff line number Diff line change
Expand Up @@ -44,10 +44,11 @@ jobs:
- name: Install other dependencies
run: |
python -m pip install --upgrade pip
pip install -U pip flake8 fastimport setuptools pytest pytest-cov
pip install -U pip ruff fastimport setuptools pytest pytest-cov
- name: Style checks
run: |
python -m flake8 subvertpy
python -m ruff check subvertpy
python -m ruff format --check subvertpy
- name: Build (Linux)
run: |
pip install -e .
Expand Down
2 changes: 1 addition & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ script:
- make check
- make style
install:
- travis_retry pip install -U pip coverage codecov flake8
- travis_retry pip install -U pip coverage codecov ruff
before_install:
- wget https://archive.apache.org/dist/subversion/subversion-${SVN_VERSION}.tar.gz
- tar xvfz subversion-${SVN_VERSION}.tar.gz
Expand Down
5 changes: 3 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
PYTHON = python3
FLAKE8 ?= flake8
RUFF ?= ruff
PYDOCTOR = pydoctor
PYDOCTOR_OPTIONS ?=
SETUP = $(PYTHON) setup.py
Expand Down Expand Up @@ -44,4 +44,5 @@ pydoctor:
$(PYDOCTOR) $(PYDOCTOR_OPTIONS) --introspect-c-modules -c subvertpy.cfg --make-html

style:
$(FLAKE8)
$(RUFF) check
$(RUFF) format --check
3 changes: 1 addition & 2 deletions examples/ra_commit.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,7 @@
# Note that a username provider needs to be provided, so that Subversion
# knows who to record as the author of new commits made over this connection.
repo_url = "file://%s" % os.path.abspath("tmprepo")
conn = RemoteAccess(repo_url,
auth=Auth([get_username_provider()]))
conn = RemoteAccess(repo_url, auth=Auth([get_username_provider()]))

# Simple commit that adds a directory
editor = conn.get_commit_editor({"svn:log": "Commit message"})
Expand Down
9 changes: 4 additions & 5 deletions examples/ra_log.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@

conn = RemoteAccess("svn://svn.samba.org/subvertpy/trunk")

for (changed_paths, rev, revprops, has_children) in conn.iter_log(
paths=None, start=0, end=conn.get_latest_revnum(),
discover_changed_paths=True):
for changed_paths, rev, revprops, has_children in conn.iter_log(
paths=None, start=0, end=conn.get_latest_revnum(), discover_changed_paths=True
):
print("=" * 79)
print("%d:" % rev)
print("Revision properties:")
Expand All @@ -16,6 +16,5 @@
print("")

print("Changed paths")
for path, (action, from_path, from_rev, node_kind) in (
changed_paths.items()):
for path, (action, from_path, from_rev, node_kind) in changed_paths.items():
print(" %s (%s)" % (path, action))
12 changes: 5 additions & 7 deletions examples/ra_replay.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,27 +4,27 @@

from subvertpy.ra import RemoteAccess, Auth, get_username_provider

conn = RemoteAccess("svn://svn.gnome.org/svn/gnome-specimen/trunk",
auth=Auth([get_username_provider()]))
conn = RemoteAccess(
"svn://svn.gnome.org/svn/gnome-specimen/trunk", auth=Auth([get_username_provider()])
)


class MyFileEditor:

def change_prop(self, key, value):
print("Change prop: %s -> %r" % (key, value))

def apply_textdelta(self, base_checksum):
# This should return a function that can receive delta windows
def apply_window(x):
pass

return apply_window

def close(self):
pass


class MyDirEditor:

def open_directory(self, *args):
print("Open dir: %s (base revnum: %r)" % args)
return MyDirEditor()
Expand All @@ -38,8 +38,7 @@ def open_file(self, *args):
return MyFileEditor()

def add_file(self, path, copyfrom_path=None, copyfrom_rev=-1):
print("Add file: %s (from %r:%r)" %
(path, copyfrom_path, copyfrom_rev))
print("Add file: %s (from %r:%r)" % (path, copyfrom_path, copyfrom_rev))
return MyFileEditor()

def change_prop(self, key, value):
Expand All @@ -53,7 +52,6 @@ def close(self):


class MyEditor:

def set_target_revision(self, revnum):
print("Target revision: %d" % revnum)

Expand Down
12 changes: 8 additions & 4 deletions examples/ra_shell.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@ def log_printer(changed_paths, rev, revprops, has_children=None):


class RaCmd(cmd.Cmd):

@staticmethod
def parse_path_revnum(line):
args = line.split(" ")
Expand Down Expand Up @@ -59,7 +58,7 @@ def do_ls(self, args):

def do_cat(self, args):
path, revnum = self.parse_path_revnum(args)
outf = getattr(sys.stdout, 'buffer', sys.stdout)
outf = getattr(sys.stdout, "buffer", sys.stdout)
(fetched_rev, props) = conn.get_file(path, outf, revnum)

def do_reparent(self, args):
Expand Down Expand Up @@ -93,8 +92,13 @@ def do_get_repos_root(self, args):
print(conn.get_repos_root())

def do_log(self, args):
conn.get_log(callback=log_printer, paths=None, start=0,
end=conn.get_latest_revnum(), discover_changed_paths=True)
conn.get_log(
callback=log_printer,
paths=None,
start=0,
end=conn.get_latest_revnum(),
discover_changed_paths=True,
)


cmdline = RaCmd()
Expand Down
9 changes: 9 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
[tool.ruff]
exclude = [
"build",
".git",
"build-pypy",
".tox",
"subversion-*",
"serf-*",
]
2 changes: 0 additions & 2 deletions setup.cfg

This file was deleted.

Loading
Loading