[svn.haxx.se] · SVN Dev · SVN Users · SVN Org · TSVN Dev · TSVN Users · Subclipse Dev · Subclipse Users · this month's index

Re: Svnadmin dump with include can not dump the subdir into add when it's parent path was a branch

From: Daniel Shahaf <d.s_at_daniel.shahaf.name>
Date: Tue, 24 Mar 2020 02:04:16 +0000

Sergey Raevskiy wrote on Tue, 24 Mar 2020 02:25 +0300:
> I've attached a patch which adds a new option (--include-parents) to 'svnadmin
> dump'. This option works with existing --include option and includes parent
> nodes for nodes specified in --include option.
>
> This should fix the mentioned case.
>
> The option doesn't work with globbing for now, since I don't see a simple
> way to implement this functionality for globbing. Thus the option is
> explicitly forbidden if --pattern option is specified. The option is also
> forbidden to use with --exclude option because it doesn't make sense.

Thanks for the patch.

> @@ -4036,7 +4057,62 @@ PROPS-END
> +def dump_include_parents(sbox):

> + # Check log.
> + expected_output = svntest.verify.RegexListOutput([
> + '-+\\n',
> + 'r3\ .*\n',
> + re.escape('Changed paths:'),
> + re.escape(' A /project/branches/b1'),
> + re.escape(' A /project/branches/b1/dir'),
> + '-+\\n',
> + 'r2\ .*\n',
> + '-+\\n',
> + 'r1\ .*\n',
> + re.escape('Changed paths:'),
> + re.escape(' A /project'),
> + re.escape(' A /project/branches'),
> + '-+\\n'
> + ])

This uses «\n» as a regex escape, «\ » as a string escape, and «\n» as
a string escape; and then uses re.escape() on constant strings that
it's a no-op on. There are three problems with this:

1. It's confusing.

2. Backslash-space is deprecated and will become a SyntaxError in the
future (see https://docs.python.org/3/reference/lexical_analysis.html#string-and-bytes-literals).

3. We have a way to verify the log output while abstracting away
details of its serialization by the cmdline client: run_and_verify_log_xml().
(That function's docstring says "expected_paths checking is not yet
implemented", but that seems to be factually incorrect.)

Furthermore, the test creates a TTB structure and then uses a branch
root as the target to dump. Is it significant that the target is
a branch root?

I'm curious why you didn't use the Greek tree. Using it would have
been idiomatic.

I've not looked closely at the C changes.

Cheers,

Daniel

P.S. Looking into RegexListOutput I noticed something: don't we need the following? —
.
    Index: subversion/tests/cmdline/svntest/verify.py
    ===================================================================
    --- subversion/tests/cmdline/svntest/verify.py (revision 1875498)
    +++ subversion/tests/cmdline/svntest/verify.py (working copy)
    @@ -190,7 +190,7 @@ def re_fullmatch(pattern, string, flags=0):
       if pattern.endswith('$'):
         return re.match(pattern, string, flags)
     
    - return re.match(pattern + '$', string, flags)
    + return re.match('(?:' + pattern + ')' + '$', string, flags)
     
     def regex_fullmatch(rx, string):
       """If the whole STRING matches the compiled regular expression RX,
.
— to correctly handle re_fullmatch('foo|bar')?
Received on 2020-03-24 03:04:35 CET

This is an archived mail posted to the Subversion Dev mailing list.

This site is subject to the Apache Privacy Policy and the Apache Public Forum Archive Policy.