Giter Club home page Giter Club logo

livesync's People

Contributors

falkoschindler avatar niklasneugebauer avatar rodja avatar seatechrc avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

livesync's Issues

Improve API for excluding files from synchronization

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

  1. ignoring the .gitignore file and
  2. making the array of other excludes configurable via argparse.

Livesync does not ignore changing .git folder on Windows 11 WSL

Hello.

When using the Windows 11 WSL, it seems that the .git folder is not ignored.
image

I added some debug output to give a bit more information:
image

even though .git/ is part of the .syncignore for the field_friend folder, changes to the .git folder of field_friend are still reported.

Problems with importing mutex module

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?

Get rid of `fswatch`

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:

  • Replace fswatch with watchfiles
  • Use .syncignore for awatch()
  • specify dependencies "watchfiles" and "pathspec"
  • Fix "RuntimeError: Already borrowed" after pressing Ctrl-C

Write git status(es) into .livesync_mutex

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.

Task list

  • write git summary to mutex file
  • handle missing git
  • add commit hash
  • @rodja review

List Index out of range if .livesync_mutex is empty

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

Accidentally syncing from two computers (because mutex is not checked correctly)

With the following scenario two computers sync their code changes to the same target and break our assumption of exclusivity:

  1. start LiveSync on computer A
  2. put computer A in power save mode
  3. wait 10 seconds (so the lock on the target expires)
  4. start LiveSync on computer B
  5. wake computer A from power safe

-> now computer A and B both sync to the target because A assumes it still has the lock

Seperate git checkouts are forcing retransmitting to many files

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.

  • Try out -c
  • How to trigger the auto-reload without changing a file?
  • Implement --on-change argument
  • Review

Specify subfolder on target

It 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"

.git folder error if LiveSync is used in a non-git directory

To reproduce:

  1. start LiveSync in a directory which itself and all its parents does not contain a .git dir
  2. unexpected behaviour: every second or so we see an error message fatal: not a git repository (or any of the parent directories): .git

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.