我已經在 2 個資料夾(在 OSX 中)之間設定了自訂自動同步一致與以下行:
unison folder1 folder2 -batch -debug update+
直到我遇見:
Synchronization complete at 12:01:44 (0 item transferred, 1 skipped, 0 failed)
skipped: example.txt (contents changed on both sides)
我希望該命令自動同步最新版本。查看選項:
$ unison -help | grep conflict
-auto automatically accept default (nonconflicting) actions
-copyonconflict keep copies of conflicting files
-prefer xxx choose this replica's version for conflicting changes
..這表明解決問題的唯一方法是 with -prefer
,但我可能會遺漏一些東西。是否可以透過時間戳指定版本?
編輯:同步報告的所有相關位元:
[update+] Unchanged file
[update+] buildUpdateChildren(handleChild): example.txt
[update] buildUpdateRec: /path/to/folder1/example.txt
[update] checkContentsChange: archStamp is inode (3373366) / info.inode (3373748) / times: 1433242394.000000 = 1433242527.000000... false / lengths: 110602 - 110611
[update+] Double-check possibly updated file
[update] archive digest = (29c46acff8e661513ec7487bc0069c2b,) current digest = (cdc82c2519076f9e52486b1c881e179d,)
[update+] Unchanged file
[update+] buildUpdateChildren(handleChild): example.txt
[update] buildUpdateRec: /path/to/folder2/example.txt
[update] checkContentsChange: archStamp is inode (3373726) / info.inode (3373746) / times: 1433242452.000000 = 1433242515.000000... false / lengths: 110602 - 109400
[update+] Double-check possibly updated file
[update] archive digest = (29c46acff8e661513ec7487bc0069c2b,) current digest = (e12ef45f692808d50989ca4b08d8c27f,)
changed <-?-> changed example.txt
Synchronization complete at 12:23:37 (0 item transferred, 1 skipped, 0 failed)
skipped: example.txt (contents changed on both sides)
答案1
我已經放棄了時間戳並決定通過添加參數來優先考慮一個版本
-prefer /path/to/folder1
這解決了衝突。
答案2
我認為這會有所幫助。 2.48.4版本的變更:
新增了「copyonconflict」首選項,以建立檔案副本,否則在發生衝突的變更時將被覆蓋或刪除。 (這使得在連續同步時,結合「repeat = watch」和「prefer = newer」首選項,可以以相當安全的方式自動解決衝突。