synchroniser : add arbitrary synchronisation arguments
Add the option to give arbitrary arguments to the unison call. These arguments must be passed as a list to sync and will be given to unison as is. This is a prerequisite for using the backup system of unison as the arguments for backup will only be given when synchronising the files and not the links.
This commit is contained in:
@@ -150,7 +150,9 @@ class Synchroniser:
|
|||||||
)
|
)
|
||||||
|
|
||||||
def sync(self, remote_root:str, local_root:str,
|
def sync(self, remote_root:str, local_root:str,
|
||||||
paths:list=[], ignore:list=[], force:bool=False) -> int:
|
paths:list=[], ignore:list=[], force:bool=False,
|
||||||
|
other:list=[]
|
||||||
|
) -> int:
|
||||||
"""Performs the synchronisation by calling unison.
|
"""Performs the synchronisation by calling unison.
|
||||||
|
|
||||||
Args:
|
Args:
|
||||||
@@ -162,6 +164,12 @@ class Synchroniser:
|
|||||||
If you need to ignore some specific files use the arguments.
|
If you need to ignore some specific files use the arguments.
|
||||||
force: Force all changes from remote to local.
|
force: Force all changes from remote to local.
|
||||||
Used mostly when replacing a link by the file.
|
Used mostly when replacing a link by the file.
|
||||||
|
other:
|
||||||
|
Other arguments to add to unison.
|
||||||
|
These arguments will only be used for this sync which is not
|
||||||
|
the case for the ones in self.args_bool and self.args_value.
|
||||||
|
They will be added to the command as is no - in front.
|
||||||
|
For exemple backups are implemented using this argument.
|
||||||
|
|
||||||
Returns:
|
Returns:
|
||||||
the unison return code see section 6.11 of the documentation
|
the unison return code see section 6.11 of the documentation
|
||||||
@@ -192,6 +200,9 @@ class Synchroniser:
|
|||||||
command.append(remote_root)
|
command.append(remote_root)
|
||||||
command.append("-batch")
|
command.append("-batch")
|
||||||
|
|
||||||
|
for arg in other:
|
||||||
|
command.append(arg)
|
||||||
|
|
||||||
proc = subprocess.Popen(command)
|
proc = subprocess.Popen(command)
|
||||||
ret_code = proc.wait()
|
ret_code = proc.wait()
|
||||||
return ret_code
|
return ret_code
|
||||||
|
|||||||
Reference in New Issue
Block a user