فهرست منبع

Add "recreate" action to NEWS and docs (#610).

Dan Helfman 2 ماه پیش
والد
کامیت
da324ebeb7
4فایلهای تغییر یافته به همراه31 افزوده شده و 30 حذف شده
  1. 2 0
      NEWS
  2. 24 24
      borgmatic/commands/arguments.py
  3. 4 5
      borgmatic/config/schema.yaml
  4. 1 1
      docs/Dockerfile

+ 2 - 0
NEWS

@@ -1,6 +1,8 @@
 2.0.0.dev0
 2.0.0.dev0
  * #345: Add a "key import" action to import a repository key from backup.
  * #345: Add a "key import" action to import a repository key from backup.
  * #422: Add home directory expansion to file-based and KeePassXC credential hooks.
  * #422: Add home directory expansion to file-based and KeePassXC credential hooks.
+ * #610: Add a "recreate" action for recreating archives, for instance for retroactively excluding
+   particular files from existing archives.
  * #790, #821: Deprecate all "before_*", "after_*" and "on_error" command hooks in favor of more
  * #790, #821: Deprecate all "before_*", "after_*" and "on_error" command hooks in favor of more
    flexible "commands:". See the documentation for more information:
    flexible "commands:". See the documentation for more information:
    https://torsion.org/borgmatic/docs/how-to/add-preparation-and-cleanup-steps-to-backups/
    https://torsion.org/borgmatic/docs/how-to/add-preparation-and-cleanup-steps-to-backups/

+ 24 - 24
borgmatic/commands/arguments.py

@@ -1522,30 +1522,6 @@ def make_parsers():
         '-h', '--help', action='help', help='Show this help message and exit'
         '-h', '--help', action='help', help='Show this help message and exit'
     )
     )
 
 
-    borg_parser = action_parsers.add_parser(
-        'borg',
-        aliases=ACTION_ALIASES['borg'],
-        help='Run an arbitrary Borg command',
-        description="Run an arbitrary Borg command based on borgmatic's configuration",
-        add_help=False,
-    )
-    borg_group = borg_parser.add_argument_group('borg arguments')
-    borg_group.add_argument(
-        '--repository',
-        help='Path of repository to pass to Borg, defaults to the configured repositories, quoted globs supported',
-    )
-    borg_group.add_argument(
-        '--archive', help='Archive name, hash, or series to pass to Borg (or "latest")'
-    )
-    borg_group.add_argument(
-        '--',
-        metavar='OPTION',
-        dest='options',
-        nargs='+',
-        help='Options to pass to Borg, command first ("create", "list", etc). "--" is optional. To specify the repository or the archive, you must use --repository or --archive instead of providing them here.',
-    )
-    borg_group.add_argument('-h', '--help', action='help', help='Show this help message and exit')
-
     recreate_parser = action_parsers.add_parser(
     recreate_parser = action_parsers.add_parser(
         'recreate',
         'recreate',
         aliases=ACTION_ALIASES['recreate'],
         aliases=ACTION_ALIASES['recreate'],
@@ -1592,6 +1568,30 @@ def make_parsers():
         '-h', '--help', action='help', help='Show this help message and exit'
         '-h', '--help', action='help', help='Show this help message and exit'
     )
     )
 
 
+    borg_parser = action_parsers.add_parser(
+        'borg',
+        aliases=ACTION_ALIASES['borg'],
+        help='Run an arbitrary Borg command',
+        description="Run an arbitrary Borg command based on borgmatic's configuration",
+        add_help=False,
+    )
+    borg_group = borg_parser.add_argument_group('borg arguments')
+    borg_group.add_argument(
+        '--repository',
+        help='Path of repository to pass to Borg, defaults to the configured repositories, quoted globs supported',
+    )
+    borg_group.add_argument(
+        '--archive', help='Archive name, hash, or series to pass to Borg (or "latest")'
+    )
+    borg_group.add_argument(
+        '--',
+        metavar='OPTION',
+        dest='options',
+        nargs='+',
+        help='Options to pass to Borg, command first ("create", "list", etc). "--" is optional. To specify the repository or the archive, you must use --repository or --archive instead of providing them here.',
+    )
+    borg_group.add_argument('-h', '--help', action='help', help='Show this help message and exit')
+
     return global_parser, action_parsers, global_plus_action_parser
     return global_parser, action_parsers, global_plus_action_parser
 
 
 
 

+ 4 - 5
borgmatic/config/schema.yaml

@@ -290,16 +290,15 @@ properties:
         description: |
         description: |
             Mode for recompressing data chunks according to MODE. 
             Mode for recompressing data chunks according to MODE. 
             Possible modes are:
             Possible modes are:
-            - "if-different": Recompress if the current compression
+             * "if-different": Recompress if the current compression
             is with a different compression algorithm.
             is with a different compression algorithm.
-            - "always": Recompress even if the current compression
+             * "always": Recompress even if the current compression
             is with the same compression algorithm. Use this to change
             is with the same compression algorithm. Use this to change
             the compression level.
             the compression level.
-            - "never": Do not recompress. Use this option to explicitly
+             * "never": Do not recompress. Use this option to explicitly
             prevent recompression.
             prevent recompression.
             See https://borgbackup.readthedocs.io/en/stable/usage/recreate.html
             See https://borgbackup.readthedocs.io/en/stable/usage/recreate.html
-            for details.
-            Defaults to "never".
+            for details. Defaults to "never".
         example: if-different
         example: if-different
     upload_rate_limit:
     upload_rate_limit:
         type: integer
         type: integer

+ 1 - 1
docs/Dockerfile

@@ -4,7 +4,7 @@ COPY . /app
 RUN apk add --no-cache py3-pip py3-ruamel.yaml py3-ruamel.yaml.clib
 RUN apk add --no-cache py3-pip py3-ruamel.yaml py3-ruamel.yaml.clib
 RUN pip install --break-system-packages --no-cache /app && borgmatic config generate && chmod +r /etc/borgmatic/config.yaml
 RUN pip install --break-system-packages --no-cache /app && borgmatic config generate && chmod +r /etc/borgmatic/config.yaml
 RUN borgmatic --help > /command-line.txt \
 RUN borgmatic --help > /command-line.txt \
-    && for action in repo-create transfer create prune compact check delete extract config "config bootstrap" "config generate" "config validate" export-tar mount umount repo-delete restore repo-list list repo-info info break-lock "key export" "key import" "key change-passphrase" borg; do \
+    && for action in repo-create transfer create prune compact check delete extract config "config bootstrap" "config generate" "config validate" export-tar mount umount repo-delete restore repo-list list repo-info info break-lock "key export" "key import" "key change-passphrase" recreate borg; do \
            echo -e "\n--------------------------------------------------------------------------------\n" >> /command-line.txt \
            echo -e "\n--------------------------------------------------------------------------------\n" >> /command-line.txt \
            && borgmatic $action --help >> /command-line.txt; done
            && borgmatic $action --help >> /command-line.txt; done
 RUN /app/docs/fetch-contributors >> /contributors.html
 RUN /app/docs/fetch-contributors >> /contributors.html