Comments (3)
Hey @r888800009 , thanks for your pull request and bug report.
yarsync
tests that there are no uncommitted changes in the local repository.
I can't see any way of testing that for the remote repository.
The way I do it is to use yarsync -n push <remote>
. -n
is dry run and it will show you the transferred data (without making changes).
Otherwise seeing "uncommitted changes" on the remote would mean to compare (push data) between two remote folders. Do you have an idea on how it could be implemented?.. With rsync
it is not possible, unfortunately.
from yarsync.
Thanks for your reply, I have some ideas to discuss.
Run local test on the remote server
The first idea, if we expect remote to also install yarsync
, and your previous consideration is traffic overhead
There is a hacky way to use --rsync-path
to run local test on the remote server, but it is only for ssh connections and does not support rsync://host
(rsyncd)
For example, we can run sleep on the remote server with --rsync-path
rsync --rsync-path 'sleep 10 && rsync' remote_host:/
One possible solution is to use the rsync error message to detect whether the local test was successful.
rsync --rsync-path 'sleep 1 && ls / && rsync' remote_host:/temp -vvvv
We can compare the difference between these two outputs
In this case, it would be better to use the ssh command to avoid hacky code. The disadvantage is assumed the remote repo user uses rsync through ssh.
Dry run as default behavior
Another idea is to run dry-run checking by default when remote push, and the user can set the configuration like config.ini
to turn off checking.
This may be useful for new users to avoid accidental overwriting.
If we always run --dry-run
first, why not just let it run automatically?
Bare Repository
There is also something like git bare repository, which is divided into multiple repo, one is bare for sync between computers, but I have not tried it with yarsync. If it is a possible solution, maybe users can refer to it.
from yarsync.
Thanks for the ideas. They are all rather nice.
Run local test on the remote server
Yes, this should work. Since rsync
(and servers) are mostly used by (use) Linux, ssh
should also be present in most cases.
ssh <my_server> 'cd <my_repo_path>; yarsync status'
shall print the status.
The downside: (as in git
), it doesn't give an error code if something was changed.
I'm not sure one should rely solely on the text output (for a human it's easy to make a mistake).
Dry run as default behavior
Yes, this might be useful.
I would add an option -i
, so that it first runs -n
, then asks whether the user wants to continue.
Then again, the problem of the reliance upon the user stays.
Bare Repository
There is a kind of a "bare" repository (with detached working and configuration directories), but it is different.
However, when you don't work on a server, you simply don't change the working directory. So you either need a non-bare repository there, or you can go with a simple repo (just don't change it directly).
There are indeed several options to deal with this problem, that's why I'm not sure yet which one to apply. In general yes, it would be good (namely safe) to test for uncommitted changes.
For me, I try to always commit my changes. Also, the files in yarsync repositories are usually not crucial for me (and if they are, I carefully look at the results of dry run - and I synchronise important repositories rarely; I don't update them often).
What is your situation (working routine)? What kind of files do you use? Do you really use a server and add files there? Maybe a better solution exists.
from yarsync.
Related Issues (10)
- Add rich text formatting (colours, boldness) to the output via click HOT 2
- [Bug] `yarsync show` crash on AttributeError: 'NoneType' object has no attribute 'by_repos' HOT 2
- [Feature Request] Untrack unwanted file/dir like `.gitignore` HOT 4
- improve github-pages HOT 2
- Automatic Man Page Installation Via Setup.py HOT 11
- hard links don't work with ignore-existing HOT 1
- Add automatic delete old commits setting and log or command option for that HOT 8
- Clone two mount point question HOT 5
- fix pdf formatting
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from yarsync.