sync_manager

This commit is contained in:
Amber 2024-10-28 13:43:03 +01:00
parent bbb962a32f
commit 39038c826c

View File

@ -291,6 +291,7 @@ class Manager():
remote_mount_point = self.get_remote_mount_point(node)
return agent.copy_dir(absolute_local_path, remote_mount_point)
#maybe useless
def precheck_remote_unode(self, node):
'''
Check the unmerged node on remote before solve conflict
@ -306,9 +307,6 @@ class Manager():
rstatus = self.get_rnode_status(node)
rfile_buf, rhash, rexists = map(rstatus.get, ['iobuffer', 'hash', 'exists'])
# if not rexists and version_kept == 'keep_local':
# return True, 'You push local version on remote'
remote_hash = node['remote_hash']
if not (remote_hash == rhash):
@ -344,6 +342,7 @@ class Manager():
return True, 'You can proceed'
def show_conflicts(self):
unmerged = self.load_unmerged_diff()
for n, unode in enumerate(unmerged):
@ -393,6 +392,34 @@ class Manager():
# raise Exception
pass
def check_for_conflict(self, node, onlyprint=False):
'''
i receive a node i'll check on remote the hash
for verify if equal to `last_hash` and eventually i generate a conflict
'''
conflicting = False
rstatus = self.get_rnode_status(node)
rfile_buf, rhash, rexists = map(rstatus.get, ['iobuffer', 'hash', 'exists'])
remote_hash = node['remote_hash']
if rhash == remote_hash:
return conflicting
conflicting = True
# (cur_hash, cur_buf) = _genlocal.generate_file_hash(self.get_absolute_local_path(node))
# node['cur_hash'] = cur_hash
# node['last_hash'] = found['remote_hash']
node['remote_hash'] = rhash
node['remote_file_buf'] = rfile_buf
if onlyprint:
return conflicting
self.store_unmerged_diff(unmerged)
## store diff in diffs path
self.store_fdiff(found)
return conflicting
def mark_conflicting_node_as_solved(self, node):
name = node['name']
path = node['rel_path']