From 9bbb38d9ab349000ef0022a97d24a33ac9e7fdaf Mon Sep 17 00:00:00 2001 From: eoli3n Date: Thu, 8 Jun 2023 19:00:31 +0200 Subject: [PATCH 1/3] improve patterns help --- src/borg/archiver/help_cmd.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/borg/archiver/help_cmd.py b/src/borg/archiver/help_cmd.py index 440a87bbf..16ece6e7e 100644 --- a/src/borg/archiver/help_cmd.py +++ b/src/borg/archiver/help_cmd.py @@ -28,9 +28,9 @@ class HelpMixIn: Starting with Borg 1.2, paths that are matched against patterns always appear relative. If you give ``/absolute/`` as root, the paths going - into the matcher will look relative like ``absolute/.../file.ext``. - If you give ``../some/path`` as root, the paths will look like - ``some/path/.../file.ext``. + into the matcher will start with ``absolute/``. + If you give ``../../relative`` as root, the paths will be normalized + as ``relative/``. File patterns support five different styles. If followed by a colon ':', the first two characters of a pattern are used as a style selector. From ba922d2e0a5fc5b5b9bc8b024e03dde6f32cc045 Mon Sep 17 00:00:00 2001 From: eoli3n Date: Thu, 8 Jun 2023 19:14:36 +0200 Subject: [PATCH 2/3] improve patterns help: define a pattern style --- src/borg/archiver/help_cmd.py | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/src/borg/archiver/help_cmd.py b/src/borg/archiver/help_cmd.py index 16ece6e7e..e0c0e2a16 100644 --- a/src/borg/archiver/help_cmd.py +++ b/src/borg/archiver/help_cmd.py @@ -32,11 +32,9 @@ class HelpMixIn: If you give ``../../relative`` as root, the paths will be normalized as ``relative/``. - File patterns support five different styles. If followed by a colon ':', - the first two characters of a pattern are used as a style selector. - Explicit style selection is necessary if a non-default style is desired - or when the desired pattern starts with two alphanumeric characters - followed by a colon (i.e. ``aa:something/*``). + Borg supports different pattern styles. To define a non-default + style for a specific pattern, prefix it with two characters followed + by a colon ':' (i.e. ``fm:path/*``, ``sh:path/**``). `Fnmatch `_, selector ``fm:`` This is the default style for ``--exclude`` and ``--exclude-from``. From 095d5f463bfd5ad9f0978edf6d87d6d49f49b0dc Mon Sep 17 00:00:00 2001 From: eoli3n Date: Fri, 9 Jun 2023 22:45:09 +0200 Subject: [PATCH 3/3] improve patterns help: added declarative includes sample --- src/borg/archiver/help_cmd.py | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/src/borg/archiver/help_cmd.py b/src/borg/archiver/help_cmd.py index e0c0e2a16..9fe8a748a 100644 --- a/src/borg/archiver/help_cmd.py +++ b/src/borg/archiver/help_cmd.py @@ -178,6 +178,25 @@ class HelpMixIn: exclude stops examination of subdirectories so that potential includes will not match - use normal excludes for such use cases. + Example:: + + # Define the recursion root + R / + # Exclude all iso files in any directory + - **/*.iso + # Explicitly include all inside etc and root + + etc/** + + root/** + # Exclude a specific directory under each user's home directories + - home/*/.cache + # Explicitly include everything in /home + + home/** + # Explicitly exclude some directories without recursing into them + ! re:^(dev|proc|run|sys|tmp) + # Exclude all other files and directories + # that are not specifically included earlier. + - ** + **Tip: You can easily test your patterns with --dry-run and --list**:: $ borg create --dry-run --list --patterns-from patterns.txt archive