From f6189325841103c2aaec7e2c9863011b5f1f158f Mon Sep 17 00:00:00 2001 From: furtest Date: Wed, 7 Jan 2026 23:27:48 +0100 Subject: [PATCH] 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. --- src/unisync/synchroniser.py | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/src/unisync/synchroniser.py b/src/unisync/synchroniser.py index 8a39e44..222fc7d 100644 --- a/src/unisync/synchroniser.py +++ b/src/unisync/synchroniser.py @@ -150,7 +150,9 @@ class Synchroniser: ) 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. Args: @@ -162,6 +164,12 @@ class Synchroniser: If you need to ignore some specific files use the arguments. force: Force all changes from remote to local. 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: the unison return code see section 6.11 of the documentation @@ -192,6 +200,9 @@ class Synchroniser: command.append(remote_root) command.append("-batch") + for arg in other: + command.append(arg) + proc = subprocess.Popen(command) ret_code = proc.wait() return ret_code