From f5da38e6f34dfcad0f16cb9055085ef84cca5fe4 Mon Sep 17 00:00:00 2001 From: Tommy Nguyen Date: Wed, 18 Aug 2021 01:42:00 -0400 Subject: [PATCH 1/5] docs: clarify pattern usage with commands Fixes: #5176 --- docs/usage/help.rst.inc | 3 ++- docs/usage/list.rst | 9 +++++++++ 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/docs/usage/help.rst.inc b/docs/usage/help.rst.inc index c636b7c039..4be0495ae1 100644 --- a/docs/usage/help.rst.inc +++ b/docs/usage/help.rst.inc @@ -23,7 +23,8 @@ store all files as `some/path/.../file.ext` and ``borg create File patterns support these styles: fnmatch, shell, regular expressions, path prefixes and path full-matches. By default, fnmatch is used for ``--exclude`` patterns and shell-style is used for the experimental -``--pattern`` option. +``--pattern`` option. For commands that support patterns in their ``PATH`` +argument like (``borg list``), the default pattern is path prefix. Starting with Borg 1.2, for all but regular expression pattern matching styles, all paths are treated as relative, meaning that a leading path diff --git a/docs/usage/list.rst b/docs/usage/list.rst index f0789edd2a..3229149912 100644 --- a/docs/usage/list.rst +++ b/docs/usage/list.rst @@ -32,3 +32,12 @@ Examples drwxrwxr-x user user 0 Sun, 2015-02-01 11:00:00 code/myproject -rw-rw-r-- user user 1416192 Sun, 2015-02-01 11:00:00 code/myproject/file.ext ... + + $ borg list /path/to/repo::archiveA 'code/myproject' + drwxrwxr-x user user 0 Sun, 2015-02-01 11:00:00 code/myproject + -rw-rw-r-- user user 1416192 Sun, 2015-02-01 11:00:00 code/myproject/file.ext + ... + + $ borg list /path/to/repo::archiveA 'pf:code/myproject' + drwxrwxr-x user user 0 Sun, 2015-02-01 11:00:00 code/myproject + ... From 6c0436dc040388463813b156d87eb508c715bd04 Mon Sep 17 00:00:00 2001 From: Tommy Nguyen Date: Wed, 18 Aug 2021 20:20:58 -0400 Subject: [PATCH 2/5] Revert "docs: clarify pattern usage with commands" This reverts commit f5da38e6f34dfcad0f16cb9055085ef84cca5fe4. --- docs/usage/help.rst.inc | 3 +-- docs/usage/list.rst | 9 --------- 2 files changed, 1 insertion(+), 11 deletions(-) diff --git a/docs/usage/help.rst.inc b/docs/usage/help.rst.inc index 4be0495ae1..c636b7c039 100644 --- a/docs/usage/help.rst.inc +++ b/docs/usage/help.rst.inc @@ -23,8 +23,7 @@ store all files as `some/path/.../file.ext` and ``borg create File patterns support these styles: fnmatch, shell, regular expressions, path prefixes and path full-matches. By default, fnmatch is used for ``--exclude`` patterns and shell-style is used for the experimental -``--pattern`` option. For commands that support patterns in their ``PATH`` -argument like (``borg list``), the default pattern is path prefix. +``--pattern`` option. Starting with Borg 1.2, for all but regular expression pattern matching styles, all paths are treated as relative, meaning that a leading path diff --git a/docs/usage/list.rst b/docs/usage/list.rst index 3229149912..f0789edd2a 100644 --- a/docs/usage/list.rst +++ b/docs/usage/list.rst @@ -32,12 +32,3 @@ Examples drwxrwxr-x user user 0 Sun, 2015-02-01 11:00:00 code/myproject -rw-rw-r-- user user 1416192 Sun, 2015-02-01 11:00:00 code/myproject/file.ext ... - - $ borg list /path/to/repo::archiveA 'code/myproject' - drwxrwxr-x user user 0 Sun, 2015-02-01 11:00:00 code/myproject - -rw-rw-r-- user user 1416192 Sun, 2015-02-01 11:00:00 code/myproject/file.ext - ... - - $ borg list /path/to/repo::archiveA 'pf:code/myproject' - drwxrwxr-x user user 0 Sun, 2015-02-01 11:00:00 code/myproject - ... From c9565a3019286617d361e99439f65eb0e7bf3db3 Mon Sep 17 00:00:00 2001 From: Tommy Nguyen Date: Wed, 18 Aug 2021 20:26:10 -0400 Subject: [PATCH 3/5] Address review comments. --- docs/usage/list.rst | 4 ++++ src/borg/archiver.py | 4 +++- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/docs/usage/list.rst b/docs/usage/list.rst index f0789edd2a..9eec9cc514 100644 --- a/docs/usage/list.rst +++ b/docs/usage/list.rst @@ -32,3 +32,7 @@ Examples drwxrwxr-x user user 0 Sun, 2015-02-01 11:00:00 code/myproject -rw-rw-r-- user user 1416192 Sun, 2015-02-01 11:00:00 code/myproject/file.ext ... + + $ borg list /path/to/repo/::archiveA --pattern "re:ext$" + -rw-rw-r-- user user 1416192 Sun, 2015-02-01 11:00:00 code/myproject/file.ext + ... diff --git a/src/borg/archiver.py b/src/borg/archiver.py index 393fe7b834..d1da6533b9 100644 --- a/src/borg/archiver.py +++ b/src/borg/archiver.py @@ -2230,7 +2230,9 @@ def do_break_lock(self, args, repository): File patterns support these styles: fnmatch, shell, regular expressions, path prefixes and path full-matches. By default, fnmatch is used for ``--exclude`` patterns and shell-style is used for the experimental - ``--pattern`` option. + ``--pattern`` option. For commands that support patterns in their + ``PATH`` argument like (``borg list``), the default pattern is path + prefix. Starting with Borg 1.2, for all but regular expression pattern matching styles, all paths are treated as relative, meaning that a leading path From eb834b48d4a821e6c1d9805c0d6972454b9991b4 Mon Sep 17 00:00:00 2001 From: Tommy Nguyen Date: Thu, 19 Aug 2021 20:55:44 -0400 Subject: [PATCH 4/5] Use dot example. --- docs/usage/list.rst | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/docs/usage/list.rst b/docs/usage/list.rst index 9eec9cc514..44abb37546 100644 --- a/docs/usage/list.rst +++ b/docs/usage/list.rst @@ -31,8 +31,13 @@ Examples drwxrwxr-x user user 0 Sun, 2015-02-01 11:00:00 code drwxrwxr-x user user 0 Sun, 2015-02-01 11:00:00 code/myproject -rw-rw-r-- user user 1416192 Sun, 2015-02-01 11:00:00 code/myproject/file.ext + -rw-rw-r-- user user 1416192 Sun, 2015-02-01 11:00:00 code/myproject/file.text ... - $ borg list /path/to/repo/::archiveA --pattern "re:ext$" + $ borg list /path/to/repo/::archiveA --pattern 're:\.ext$' -rw-rw-r-- user user 1416192 Sun, 2015-02-01 11:00:00 code/myproject/file.ext ... + + $ borg list /path/to/repo/::archiveA --pattern 're:.ext$' + -rw-rw-r-- user user 1416192 Sun, 2015-02-01 11:00:00 code/myproject/file.text + ... From 85c0c348bf359dc11576731817dea85d00d18ef9 Mon Sep 17 00:00:00 2001 From: Tommy Nguyen Date: Thu, 19 Aug 2021 20:57:37 -0400 Subject: [PATCH 5/5] Fix typo. --- docs/usage/list.rst | 1 + 1 file changed, 1 insertion(+) diff --git a/docs/usage/list.rst b/docs/usage/list.rst index 44abb37546..71dfe8eca0 100644 --- a/docs/usage/list.rst +++ b/docs/usage/list.rst @@ -39,5 +39,6 @@ Examples ... $ borg list /path/to/repo/::archiveA --pattern 're:.ext$' + -rw-rw-r-- user user 1416192 Sun, 2015-02-01 11:00:00 code/myproject/file.ext -rw-rw-r-- user user 1416192 Sun, 2015-02-01 11:00:00 code/myproject/file.text ...