unison 如何决定以哪种方式同步文件

发布于 2024-10-08 20:15:39 字数 156 浏览 3 评论 0原文

我正在使用 unison 将一堆文件夹同步在一起。不只是 2 个根,但我认为我的问题可以变得这么简单......

可以说我正在使用一致同步目录 A 和 B。如果我从目录 A 中删除文件 X,unison 如何知道要做什么?应该将 X 从 B 添加回 A 还是应该从 B 中删除 X?

I am using unison to sync a bunch of folders together. Not just 2 roots, but I think my question can be made this simple...

Lets say I am syncing directory A and B using unison. If I remove file X from directory A, how does unison know what to do? Should it add X back to A from B or should it delete X from B?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

独孤求败 2024-10-15 20:15:39

每次成功同步该路径后,Unison 都会保留该路径的内容记录(即,它会记住最后一刻的内容在两个副本中相同时的内容)。

如果路径的当前内容与上次成功同步时的内容不同,我们就说路径已更新(在某些副本中)。请注意,路径是否更新与其最后修改时间无关——Unison 在确定是否发生更新时仅考虑内容。这意味着触摸文件而不更改其内容将不会被识别为更新。一个文件甚至可以多次更改,然后再更改回其原始内容;只要 Unison 仅在此过程结束时运行,就不会识别任何更新。

换句话说:Unison 知道您已经删除了文件 X,因为它不再位于 A 的磁盘上,它知道应该从 B 中删除它。

Unison keeps a record of the contents of each path after each successful synchronization of that path (i.e., it remembers the contents at the last moment when they were the same in the two replicas).

We say that a path is updated (in some replica) if its current contents are different from its contents the last time it was successfully synchronized. Note that whether a path is updated has nothing to do with its last modification time—Unison considers only the contents when determining whether an update has occurred. This means that touching a file without changing its contents will not be recognized as an update. A file can even be changed several times and then changed back to its original contents; as long as Unison is only run at the end of this process, no update will be recognized.

In other words: Unison knows that you have deleted file X, because it's no longer on the disk in A, it knows it should delete it from B.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文