[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Quilt-dev] merging with upstream and adding new files
From: |
Jean Delvare |
Subject: |
Re: [Quilt-dev] merging with upstream and adding new files |
Date: |
Sun, 12 Jun 2005 23:03:04 +0200 |
Hi Andreas,
[Andreas Gruenbacher]
> if (/^@@ -(\d+)(?:,(\d+)) \+(\d+)(?:,(\d+)) @@/) {
> my ($ln, $n, $lr) = ($2 || 1, $3, $4 || 1);
[Jean Delvare]
> I'm a bit confused by this regular expression. Why are you using the
> "?:" construct?
[Andreas Gruenbacher]
> The 2nd and 4th parentheses are not counted with (?:...); they are
> used for grouping only.
Except that grouping doesn't do anything here, as far as I can see.
[Andreas Gruenbacher]
> The line ranges can be of the form \d+ or \d+,\d+. Example:
>
> diff -U0 <(echo 'a') <(echo 'b'; echo 'c')
> [...]
> @@ -1 +1,2 @@
Your regular expression won't match this though. Two question marks
missing maybe? This would clear my original confusion.
/^@@ -(\d+)(?:,(\d+))? \+(\d+)(?:,(\d+))? @@/
And you should omit the first pair of parentheses too, as you don't use
the captured value anyway.
[Jean Delvare]
> I am also wondering if a forced pop followed by a push when a
> refresh strips whitespace wouldn't be just as efficient, and cheaper
> (as far as code goes)?
[Andreas Gruenbacher]
> I'd rather not. The script has a fair chance of doing the right thing
> when refreshing a patch that is not on top. With pop+push this would
> get nasty.
I was under the impression that it should work fine unless the refresh
was forced - so we could simply skip the trailing whitespace stripping
in this case. But you definitely know the whole thing much better than I
do, so it's quite possible that I am missing something. And your little
perl script doesn't look bad at all anyway, so I have no strong opinion.
Thanks,
--
Jean Delvare
- Re: [Quilt-dev] merging with upstream and adding new files, Jean Delvare, 2005/06/02
- Re: [Quilt-dev] merging with upstream and adding new files, jerome lacoste, 2005/06/02
- Re: [Quilt-dev] merging with upstream and adding new files, Jean Delvare, 2005/06/03
- Re: [Quilt-dev] merging with upstream and adding new files, jerome lacoste, 2005/06/12
- Re: [Quilt-dev] merging with upstream and adding new files, Andreas Gruenbacher, 2005/06/12
- Re: [Quilt-dev] merging with upstream and adding new files, Jean Delvare, 2005/06/12
- Re: [Quilt-dev] merging with upstream and adding new files, Andreas Gruenbacher, 2005/06/12
- Re: [Quilt-dev] merging with upstream and adding new files, Jean Delvare, 2005/06/12
- Re: [Quilt-dev] merging with upstream and adding new files, Andreas Gruenbacher, 2005/06/12
- Re: [Quilt-dev] merging with upstream and adding new files,
Jean Delvare <=
- Re: [Quilt-dev] merging with upstream and adding new files, Andreas Gruenbacher, 2005/06/12