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
3 changes: 1 addition & 2 deletions examples/ra_commit.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,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://{}".format(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(f" {path} ({action})")
9 changes: 4 additions & 5 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 Auth, RemoteAccess, 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(f"Change prop: {key} -> {value!r}")

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: {} (base revnum: {!r})".format(*args))
return MyDirEditor()
Expand Down Expand Up @@ -52,7 +52,6 @@ def close(self):


class MyEditor:

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

Expand Down
16 changes: 10 additions & 6 deletions examples/ra_shell.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,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 All @@ -54,14 +53,14 @@ def do_stat(self, args):

def do_ls(self, args):
path, revnum = self.parse_path_revnum(args)
(dirents, fetched_rev, props) = conn.get_dir(path, revnum)
(dirents, _fetched_rev, _props) = conn.get_dir(path, revnum)
for name in dirents:
print(name)

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

def do_reparent(self, args):
conn.reparent(args)
Expand Down Expand Up @@ -94,8 +93,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
Loading
Loading