File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1212import pathlib
1313from typing import Any
1414
15+ from libvcs ._internal .types import StrPath
1516from libvcs .cmd .hg import Hg
1617
1718from .base import BaseSync
2223class HgSync (BaseSync ):
2324 bin_name = "hg"
2425 schemes = ("hg" , "hg+http" , "hg+https" , "hg+file" )
26+ cmd : Hg
27+
28+ def __init__ (
29+ self ,
30+ * ,
31+ url : str ,
32+ dir : StrPath ,
33+ ** kwargs : Any ,
34+ ) -> None :
35+ """A hg repository.
36+
37+ Parameters
38+ ----------
39+ url : str
40+ URL in subversion repository
41+ """
42+ super ().__init__ (url = url , dir = dir , ** kwargs )
43+
44+ self .cmd = Hg (dir = dir , progress_callback = self .progress_callback )
2545
2646 def obtain (self , * args : Any , ** kwargs : Any ) -> None :
27- cmd = Hg (dir = self .dir )
28- cmd .clone (
47+ self .cmd .clone (
2948 no_update = True ,
3049 quiet = True ,
3150 url = self .url ,
3251 )
33- cmd .update (
52+ self . cmd .update (
3453 quiet = True ,
3554 check_returncode = True ,
3655 )
@@ -39,11 +58,9 @@ def get_revision(self) -> str:
3958 return self .run (["parents" , "--template={rev}" ])
4059
4160 def update_repo (self , * args : Any , ** kwargs : Any ) -> None :
42- cmd = Hg (dir = self .dir )
43-
4461 if not pathlib .Path (self .dir / ".hg" ).exists ():
4562 self .obtain ()
4663 self .update_repo ()
4764 else :
48- cmd .update ()
49- cmd .pull (update = True )
65+ self . cmd .update ()
66+ self . cmd .pull (update = True )
You can’t perform that action at this time.
0 commit comments