1010from collections .abc import Sequence
1111from typing import Any , List , Literal , Optional , Union
1212
13- from libvcs ._internal .run import run
13+ from libvcs ._internal .run import ProgressCallbackProtocol , run
1414from libvcs ._internal .types import StrOrBytesPath , StrPath
1515
1616_CMD = Union [StrOrBytesPath , Sequence [StrOrBytesPath ]]
2020
2121
2222class 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