librelist archives

« back to archive

Some PR descriptions

Some PR descriptions

From:
Yuri D'Elia
Date:
2015-01-20 @ 18:42
Hi everyone, I've been trying to switch over from rdiff-backup to attic
and in doing so I've submitted a couple of pull requests. I've been
using attic with these patches since a month now, and I think they
deserve some attention:

https://github.com/jborg/attic/pull/142

This implements --exclude-if-present [file], which is identical in
behavior to rdiff-backup's --exclude-if-present: if the requested
filename exists in a directory, the directory itself is excluded. The
flag can be repeated to specify more than a single file name.

This is a variation on the --exclude-caches, except that allows any file
name to be specified and the content of the file itself is ignored.

In the same PR, the second commit includes --keep-tag-files. If
--keep-tag-files is specified, the excluded directory and it's tag file
(CACHEDIR.TAG *and* any other exclusion file name) is kept in the
archive. The rationale here is that it's very helpful, in the vast
majority of cases, to restore the excluded directory and associated tag
file in order for *further* backups to process the directory in the same
way. It's also helpful to detected excluded directories after the backup
has been made.

https://github.com/jborg/attic/pull/150

This normalizes the file names in the dot directory when specified
explicitly, along with exclude/include patterns.

This fixes several mismatches when including relative paths that involve
the current directory, for example:

  attic create ... --exclude=file .

would fail to exclude ./file because of a mismatch. Likewise:

  attic create ... --exclude ./test/file test/

would fail to exclude ./test/file for the same reason.
It's a minor tweak, but I've found this behavior to be highly annoying
in other backup/archiving software.

https://github.com/jborg/attic/pull/151

attic so far doesn't allow to have an --include or similar rule, which
prevents you to backup just some directories rooted in a common tree.

For example, imagine trying to backup /home/, while trying to preserve
the /home prefix. The issue becomes more apparent when you try to do
something as:

  attic create ... /home /home2

which will conflate both directories in the same root. To achieve the
correct result, you would need:

  attic create ... / --exclude [long list of paths here]

which is not feasible, since the list of excluded paths might change
over time.

In this PR, we reduce the include/exclude logic to the most specific
pattern directly specified on the command line. With the following file
list:

  root/file1
  root/unwanted/subtree1/file2
  root/unwanted/subtree2/file3

The command:

  attic create archive::name --exclude root/unwanted root root/unwante
/subtree2

Will correctly archive:

  root/file1
  root/unwanted/subtree2/file3.

Since root/unwanted is more specific than the requested --exclude
pattern. Patterns may be nested, so you can have multiple generic
exclusion lists, while still forcing some subtrees to be included in the
archive.

With this, I was able to have the same generic exclusion patterns I was
having before with rdiff-backup, and I found the behavior quite
intuitive as well.

All the PRs include specific test cases for the features that they
introduce. In particular, PR 150 also includes tests for the previous
broken behavior with relative path names.

The PRs are designed to be pulled independently, but I guess some
"imports" overlap, so some manual fixing will be required.

Re: [attic] Some PR descriptions

From:
Ed Blackman
Date:
2015-01-20 @ 21:32
On Tue, Jan 20, 2015 at 07:42:58PM +0100, Yuri D'Elia wrote:
>https://github.com/jborg/attic/pull/142
>
>This implements --exclude-if-present [file], which is identical in
>behavior to rdiff-backup's --exclude-if-present: if the requested
>filename exists in a directory, the directory itself is excluded. The
>flag can be repeated to specify more than a single file name.

I'd love to see this accepted.

-- 
Ed Blackman