diff.rst.inc 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158
  1. .. IMPORTANT: this file is auto-generated from borg's built-in help, do not edit!
  2. .. _borg_diff:
  3. borg diff
  4. ---------
  5. .. code-block:: none
  6. borg [common options] diff [options] REPO::ARCHIVE1 ARCHIVE2 [PATH...]
  7. .. only:: html
  8. .. class:: borg-options-table
  9. +-------------------------------------------------------+---------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------+
  10. | **positional arguments** |
  11. +-------------------------------------------------------+---------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------+
  12. | | ``REPO::ARCHIVE1`` | repository location and ARCHIVE1 name |
  13. +-------------------------------------------------------+---------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------+
  14. | | ``ARCHIVE2`` | ARCHIVE2 name (no repository location allowed) |
  15. +-------------------------------------------------------+---------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------+
  16. | | ``PATH`` | paths of items inside the archives to compare; patterns are supported |
  17. +-------------------------------------------------------+---------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------+
  18. | **options** |
  19. +-------------------------------------------------------+---------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------+
  20. | | ``--numeric-owner`` | deprecated, use ``--numeric-ids`` instead |
  21. +-------------------------------------------------------+---------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------+
  22. | | ``--numeric-ids`` | only consider numeric user and group identifiers |
  23. +-------------------------------------------------------+---------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------+
  24. | | ``--same-chunker-params`` | Override check of chunker parameters. |
  25. +-------------------------------------------------------+---------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------+
  26. | | ``--sort`` | Sort the output by path (deprecated, use --sort-by=path). |
  27. +-------------------------------------------------------+---------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------+
  28. | | ``--sort-by FIELD[,FIELD...]`` | Advanced sorting: specify field(s) to sort by. Accepts a comma-separated list. Prefix with > for descending or < for ascending (default). |
  29. +-------------------------------------------------------+---------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------+
  30. | | ``--content-only`` | Only compare differences in content (exclude metadata differences) |
  31. +-------------------------------------------------------+---------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------+
  32. | | ``--json-lines`` | Format output as JSON Lines. |
  33. +-------------------------------------------------------+---------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------+
  34. | .. class:: borg-common-opt-ref |
  35. | |
  36. | :ref:`common_options` |
  37. +-------------------------------------------------------+---------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------+
  38. | **Include/Exclude options** |
  39. +-------------------------------------------------------+---------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------+
  40. | | ``-e PATTERN``, ``--exclude PATTERN`` | exclude paths matching PATTERN |
  41. +-------------------------------------------------------+---------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------+
  42. | | ``--exclude-from EXCLUDEFILE`` | read exclude patterns from EXCLUDEFILE, one per line |
  43. +-------------------------------------------------------+---------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------+
  44. | | ``--pattern PATTERN`` | include/exclude paths matching PATTERN |
  45. +-------------------------------------------------------+---------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------+
  46. | | ``--patterns-from PATTERNFILE`` | read include/exclude patterns from PATTERNFILE, one per line |
  47. +-------------------------------------------------------+---------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------+
  48. .. raw:: html
  49. <script type='text/javascript'>
  50. $(document).ready(function () {
  51. $('.borg-options-table colgroup').remove();
  52. })
  53. </script>
  54. .. only:: latex
  55. REPO::ARCHIVE1
  56. repository location and ARCHIVE1 name
  57. ARCHIVE2
  58. ARCHIVE2 name (no repository location allowed)
  59. PATH
  60. paths of items inside the archives to compare; patterns are supported
  61. options
  62. --numeric-owner deprecated, use ``--numeric-ids`` instead
  63. --numeric-ids only consider numeric user and group identifiers
  64. --same-chunker-params Override check of chunker parameters.
  65. --sort Sort the output by path (deprecated, use --sort-by=path).
  66. --sort-by FIELD[,FIELD...] Advanced sorting: specify field(s) to sort by. Accepts a comma-separated list. Prefix with > for descending or < for ascending (default).
  67. --content-only Only compare differences in content (exclude metadata differences)
  68. --json-lines Format output as JSON Lines.
  69. :ref:`common_options`
  70. |
  71. Include/Exclude options
  72. -e PATTERN, --exclude PATTERN exclude paths matching PATTERN
  73. --exclude-from EXCLUDEFILE read exclude patterns from EXCLUDEFILE, one per line
  74. --pattern PATTERN include/exclude paths matching PATTERN
  75. --patterns-from PATTERNFILE read include/exclude patterns from PATTERNFILE, one per line
  76. Description
  77. ~~~~~~~~~~~
  78. This command finds differences (file contents, user/group/mode) between archives.
  79. A repository location and an archive name must be specified for REPO::ARCHIVE1.
  80. ARCHIVE2 is just another archive name in the same repository (no repository location
  81. allowed).
  82. What is compared
  83. +++++++++++++++++
  84. For each matching item in both archives, Borg reports:
  85. - Content changes: total added/removed bytes within files. If chunker parameters are comparable,
  86. Borg compares chunk IDs quickly; otherwise, it compares the content.
  87. - Metadata changes: user, group, mode, and other metadata shown inline like
  88. "[old_mode -> new_mode]" for mode changes. Use ``--content-only`` to suppress metadata changes.
  89. - Added/removed items: printed as "added SIZE path" or "removed SIZE path".
  90. Output formats
  91. ++++++++++++++
  92. The default (text) output shows one line per changed path, e.g.::
  93. +135 B -252 B [ -rw-r--r-- -> -rwxr-xr-x ] path/to/file
  94. JSON Lines output (``--json-lines``) prints one JSON object per changed path, e.g.::
  95. {"path": "PATH", "changes": [
  96. {"type": "modified", "added": BYTES, "removed": BYTES},
  97. {"type": "mode", "old_mode": "-rw-r--r--", "new_mode": "-rwxr-xr-x"},
  98. {"type": "added", "size": SIZE},
  99. {"type": "removed", "size": SIZE}
  100. ]}
  101. Only actual changes are included in the "changes" list. For example, a modified entry with
  102. added=0 and removed=0 is omitted.
  103. Sorting
  104. ++++++++
  105. Use ``--sort-by FIELDS`` where FIELDS is a comma-separated list of fields.
  106. Sorts are applied stably from last to first in the given list. Prepend ">" for
  107. descending, "<" (or no prefix) for ascending, for example ``--sort-by=">size_added,path"``.
  108. Supported fields include:
  109. - path: the item path
  110. - size_added: total bytes added for the item content
  111. - size_removed: total bytes removed for the item content
  112. - size_diff: size_added - size_removed (net content change)
  113. - size: size of the item as stored in ARCHIVE2 (0 for removed items)
  114. - user, group, uid, gid, ctime, mtime: taken from the item state in ARCHIVE2 when present
  115. - ctime_diff, mtime_diff: timestamp difference (archive2 - archive1)
  116. The ``--sort`` option is deprecated and only sorts by path.
  117. Performance considerations
  118. ++++++++++++++++++++++++++
  119. For archives created with Borg 1.1 or newer, diff automatically detects whether
  120. the archives were created with the same chunker parameters. If so, only chunk IDs
  121. are compared, which is very fast.
  122. For archives prior to Borg 1.1, chunk contents are compared by default.
  123. If you did not create the archives with different chunker parameters,
  124. pass ``--same-chunker-params``.
  125. Note that the chunker parameters changed from Borg 0.xx to 1.0.
  126. For more help on include/exclude patterns, see the :ref:`borg_patterns` command output.