diff.rst 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. .. include:: diff.rst.inc
  2. Examples
  3. ~~~~~~~~
  4. ::
  5. $ borg init -e=none testrepo
  6. $ mkdir testdir
  7. $ cd testdir
  8. $ echo asdf > file1
  9. $ dd if=/dev/urandom bs=1M count=4 > file2
  10. $ touch file3
  11. $ borg create ../testrepo::archive1 .
  12. $ chmod a+x file1
  13. $ echo "something" >> file2
  14. $ borg create ../testrepo::archive2 .
  15. $ echo "testing 123" >> file1
  16. $ rm file3
  17. $ touch file4
  18. $ borg create ../testrepo::archive3 .
  19. $ cd ..
  20. $ borg diff testrepo::archive1 archive2
  21. [-rw-r--r-- -> -rwxr-xr-x] file1
  22. +135 B -252 B file2
  23. $ borg diff testrepo::archive2 archive3
  24. +17 B -5 B file1
  25. added 0 B file4
  26. removed 0 B file3
  27. $ borg diff testrepo::archive1 archive3
  28. +17 B -5 B [-rw-r--r-- -> -rwxr-xr-x] file1
  29. +135 B -252 B file2
  30. added 0 B file4
  31. removed 0 B file3
  32. $ borg diff --json-lines testrepo::archive1 archive3
  33. {"path": "file1", "changes": [{"type": "modified", "added": 17, "removed": 5}, {"type": "mode", "old_mode": "-rw-r--r--", "new_mode": "-rwxr-xr-x"}]}
  34. {"path": "file2", "changes": [{"type": "modified", "added": 135, "removed": 252}]}
  35. {"path": "file4", "changes": [{"type": "added", "size": 0}]}
  36. {"path": "file3", "changes": [{"type": "removed", "size": 0}]}