AmirHmZz / mpbridge

CLI tool to synchronise and manage files on MicroPython running devices
https://pypi.org/project/mpbridge
MIT License
51 stars 5 forks source link

[Feature request] Sync mode that only updates local->mcu without neither cleaning nor syncing mcu->local #25

Closed jornamon closed 1 year ago

jornamon commented 1 year ago

I think an additional syncing mode could be useful when you have several project on the same board, and you don't want to erase them every time you you switch project.

In this mode, which could be activated by another modifier, say --push instead of --clean, mpbridge copies the files that have changed in the local folder to the board, but it doesn't neither erase other files in the board nor copies any board file to the local folder.

Wind-stormger commented 1 year ago

Do you mean, sometimes, you just want to upload changed files to device and ignore any other files that don't exist locally?

For example, you have boot.py and main.py in a local folder, while main.py and test.py are available on the device.

boot.py does not exist in the device, and main.py is different from that in the device.

You want to directly upload boot.py and main.py to the device without downloading test.py.

Wind-stormger commented 1 year ago

I can understand what you mean.

You want to keep several separate project folders locally, and keep files with non-conflicting filenames in these project folders on the micropython device.

They are likely to be some pictures, tables, driver libraries, etc. Their files are large in size, and you don't want to delete and modify these files repeatedly when switching projects back and forth.

Usually only changing boot.py and main.py is enough to meet our needs.

Is my understanding correct?

I also agree that this is indeed a practical requirement.

@AmirHmZz What do you think?

jornamon commented 1 year ago

Sorry for the delay, I didn't get notified.

It's exactly as you said in your last comment.

It's happening to me right now. I have a big project and a small project, with different file names (during development I rarely use main.py for example). I don't want to erase all the large project content from the board when I switch to the small one with a sync --clean, but I don't want to pull all those files to my small project either with a sync.

I've seen this sync setting in file sync software. For example, in FreeFileSync it's called update, and it's described as "The Update variant can be viewed as an example of such a customization: It is just like Mirror but adapted to avoid file deletions". FreeFileSync docs

If interested I can make a PR, but honestly it may take more time to review it rather than do it because I'm not like super good 🫣

Wind-stormger commented 1 year ago

Just do it~

AmirHmZz commented 1 year ago

Thanks for submitting this issue. That would be nice to have such a feature in mpbridge. I'll be working on it ASAP...

AmirHmZz commented 1 year ago

Merged in #27 and will be available in mpbridge v1.3.4. After upgrading mpbridge to the latest version you will be able to use sync command with --push-only flag.

jornamon commented 1 year ago

I have just tested and it appears to work great. This is super useful. Thanks a lot!