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

Re: [PATCH] Infrastructure to exclude comparing lines

From: Ramkumar Ramachandra <artagnon_at_gmail.com>
Date: Mon, 20 Sep 2010 09:39:57 +0530

Hi Daniel,

Daniel Shahaf writes:
> > +# Mismatched headers during dumping operation
> > +mismatched_headers_re = \
> > + "Prop-delta: |Text-content-sha1: |Text-copy-source-md5: |" \
> > + "Text-copy-source-sha1: |Text-delta-base-sha1: .*"
> > +
>
> So:
>
> * ignore sha1 because RA doesn't provide it yet

Yes, that's correct.

> * ignore Text-copy-source-md5... why? for the same reason?

Yes.

> * ignore Prop-delta... why?

This is because svnrdump outputs "Prop-delta: true" everytime, whether
it's really a delta or a delta from /dev/null. This is quite harmless,
and the logic for omitting it when it's a delta from /dev/null can be
fairly non-trivial and unnecessary. Again, svnadmin dump does it
"right".

> (It would be good to have the answer in a comment, I think.)

Ok.

> Couldn't you redefine one of these two functions (matches_except() and
> is_equivalent_list()) such that they share more code?
>
> For example:
>
> def matches_except(self, expected, actual, except_re):
> # TODO: possibly use a slightly different error message
> # if an exception is thrown
> return self.is_equivalent_list(
> filter(lambda x: not re.match(except_re, x), expected),
> filter(lambda x: not re.match(except_re, x), actual))
>
> ... or add some sort of optional argument to is_equivalent_list(), such
> that the functionalities of both functions can be achieved by varying
> the value of the optional argument.
>
> In second thought: you could make except_re a lambda expression
> (taking a single argument, the line) instead of a regex; i.e.,
>
> s/foo('Text-sha1:')/foo(lambda line: 'Text-sha1' not in line)/
>
> ?

Actually, this was sort of intentional on my part. I don't know if
this except_re (the way I've written it) is such a great idea in the
long run. We know that svnrdump needs it, but I'd like to wait until
we have more usecases before restructuring it. We might figure out
that some more general way of including/ excluding lines to match in
actual/ expected: the lambda function example you've provided is quite
illustrative. For now, let this except_re feature serve just the
svnrdump case.

-- Ram
Received on 2010-09-20 06:12:03 CEST

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.