Skip to content

Commit 5cdb96a

Browse files
committed
feat(cmd[svn]): Add progress_callback
1 parent de39b02 commit 5cdb96a

1 file changed

Lines changed: 14 additions & 2 deletions

File tree

src/libvcs/cmd/svn.py

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
from collections.abc import Sequence
1111
from typing import Any, List, Literal, Optional, Union
1212

13-
from libvcs._internal.run import run
13+
from libvcs._internal.run import ProgressCallbackProtocol, run
1414
from libvcs._internal.types import StrOrBytesPath, StrPath
1515

1616
_CMD = Union[StrOrBytesPath, Sequence[StrOrBytesPath]]
@@ -20,7 +20,14 @@
2020

2121

2222
class Svn:
23-
def __init__(self, *, dir: StrPath) -> None:
23+
progress_callback: Optional[ProgressCallbackProtocol] = None
24+
25+
def __init__(
26+
self,
27+
*,
28+
dir: StrPath,
29+
progress_callback: Optional[ProgressCallbackProtocol] = None,
30+
) -> None:
2431
"""Lite, typed, pythonic wrapper for svn(1).
2532
2633
Parameters
@@ -40,6 +47,8 @@ def __init__(self, *, dir: StrPath) -> None:
4047
else:
4148
self.dir = pathlib.Path(dir)
4249

50+
self.progress_callback = progress_callback
51+
4352
def __repr__(self) -> str:
4453
return f"<Svn dir={self.dir}>"
4554

@@ -124,6 +133,9 @@ def run(
124133
if config_option is not None:
125134
cli_args.extend(["--config-option", str(config_option)])
126135

136+
if self.progress_callback is not None:
137+
kwargs["callback"] = self.progress_callback
138+
127139
return run(
128140
args=cli_args,
129141
check_returncode=True if check_returncode is None else check_returncode,

0 commit comments

Comments
 (0)