zauberzeug / livesync Goto Github PK
View Code? Open in Web Editor NEWSync local code with (slow) remote machine
License: MIT License
Sync local code with (slow) remote machine
License: MIT License
This is the current implementation for excluding files from synchronization:
def get_excludes(self) -> List[str]:
return ['.git/', '__pycache__/', '.DS_Store', '*.tmp', '.env'] + \
self._parse_ignore_file(self.local_path / '.syncignore') + \
self._parse_ignore_file(self.local_path / '.gitignore')
From the user's perspective it might be surprising that so many files are already ignored. But even though it looks like all git-ignored files are ignored, only the .gitignore in the current working directory is considered. Besides that, it is impossible to sync a .env file in case the user would like to do so.
Therefore, I would like to make it more flexible and predictable by
In 1a772a0#diff-c978be6905cfee18321359be830bc321deb78d07b25b7842607080b68cf867e0 I changed the line
from livesync import Mutex
to
from mutex import Mutex
The new line is usually the way to import modules from the current directory and this way we can start ./livesync.py
locally. But when installing via pip install -e .
, calling livesync
raises an error: "ModuleNotFoundError: No module named 'mutex'"
Apparently, this has to do with an issue with pip. Do we want to try changing the repo structure as suggested, or should we simply revert this line and only call livesync
and not ./livesync
?
Instead of using the bash command fswatch
to monitor for changes it would be cleaner and more platform-independend to use https://pypi.org/project/watchfiles/ or a similar python lib.
Tasks:
awatch()
We should make the SSH port configurable.
In this issue we collect a list of alternatives and their disadvantages.
plain rsync
It would be helpful to see the current development status on the remote machine to explain its current behavior. The output of git status
per synchronized folder should be a good start.
In case another developer wonders, when a remote machine was synced, a human-readable time format would help.
Not sure how i got into the situation of having an empty .livesync_mutex, but it would be worth checking for an empty file before line 21:
output = self._run_ssh_command(f'cat {MUTEX_FILEPATH} || echo "{self.tag}\n{info}"').splitlines()[0]
ERROR:root:Could not access target system
Traceback (most recent call last):
File "/var/home/niklas/Work/livesync/livesync/mutex.py", line 21, in is_free
output = self._run_ssh_command(f'cat {MUTEX_FILEPATH} || echo "{self.tag}\n{info}"').splitlines()[0]
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^^
IndexError: list index out of range
With the following scenario two computers sync their code changes to the same target and break our assumption of exclusivity:
-> now computer A and B both sync to the target because A assumes it still has the lock
Because git does not set the modification time to the last commit time, every checkout has different modification times for the same files. This results in a too-large transfer when livesync
is first started with another checkout. For example if two developers work on the same target at different times.
Maybe LiveSync can incorporate git-restore-mtime
(https://github.com/MestreLion/git-tools/blob/main/git-restore-mtime and https://stackoverflow.com/a/13284229/364388) or a simpler version like https://stackoverflow.com/a/36243002/364388.
-c
--on-change
argumentIt would be useful in some scenarios to specify a subfolder on the target device to clone to. E.g. with an argument:
Running livesync project --subfolder a_folder
from "project" folder on the local device should sync "local:project" to "remote:a_folder/project"
To reproduce:
.git
dirfatal: not a git repository (or any of the parent directories): .git
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.