Bug 174339 - Do not duplicate files when deleting directories with svn 1.9
Summary: Do not duplicate files when deleting directories with svn 1.9
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: Tools / Tests (show other bugs)
Version: WebKit Nightly Build
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Jonathan Bedard
URL:
Keywords: InRadar
Depends on:
Blocks:
 
Reported: 2017-07-10 17:23 PDT by Jonathan Bedard
Modified: 2017-07-11 17:24 PDT (History)
8 users (show)

See Also:


Attachments
Patch (2.79 KB, patch)
2017-07-10 18:28 PDT, Jonathan Bedard
no flags Details | Formatted Diff | Diff
Patch (2.84 KB, patch)
2017-07-11 12:27 PDT, Jonathan Bedard
no flags Details | Formatted Diff | Diff
Patch (2.90 KB, patch)
2017-07-11 15:28 PDT, Jonathan Bedard
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Jonathan Bedard 2017-07-10 17:23:54 PDT
When directories are moved or deleted, files will be duplicated in svn-create-patch.  Prevent this duplication.
Comment 1 Radar WebKit Bug Importer 2017-07-10 17:24:25 PDT
<rdar://problem/33226781>
Comment 2 Jonathan Bedard 2017-07-10 17:27:55 PDT
Note that this change must be made before The WebKit2 -> WebKit and WebKit -> WebKitLegacy change is made.
Comment 3 Jonathan Bedard 2017-07-10 18:28:59 PDT
Created attachment 315058 [details]
Patch
Comment 4 Sam Weinig 2017-07-10 21:45:39 PDT
Comment on attachment 315058 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=315058&action=review

> Tools/ChangeLog:3
> +        Need a short description (OOPS!).

Please add a descriptive title.

> Tools/ChangeLog:10
> +        (diffOptionsForFile): No longer pass -N option, since this does not work in SVN 1.9.4.

Should this be predicated on the svn version?  I know we support older versions of subversion, since we have checks like isSVNVersion16OrNewer().
Comment 5 Jonathan Bedard 2017-07-11 08:17:01 PDT
(In reply to Sam Weinig from comment #4)
> Comment on attachment 315058 [details]
> Patch
> 
> View in context:
> https://bugs.webkit.org/attachment.cgi?id=315058&action=review
> 
> > Tools/ChangeLog:3
> > +        Need a short description (OOPS!).
> 
> Please add a descriptive title.
> 
> > Tools/ChangeLog:10
> > +        (diffOptionsForFile): No longer pass -N option, since this does not work in SVN 1.9.4.
> 
> Should this be predicated on the svn version?  I know we support older
> versions of subversion, since we have checks like isSVNVersion16OrNewer().

This will still work with older versions of svn.  What this patch does is run a diff on the highest level directory deleted instead of each child.  So for example, given the following:

D folder1
D folder1/subfolder
D folder1/file1
D folder1/subfolder/file2

we would only run 'svn diff' on folder1.
Comment 6 Jonathan Bedard 2017-07-11 12:27:48 PDT
Created attachment 315143 [details]
Patch
Comment 7 David Kilzer (:ddkilzer) 2017-07-11 12:38:17 PDT
Comment on attachment 315058 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=315058&action=review

Tentative r=me if this has been tested with older svn versions, and you change the $flag variable name to describe why a path is being skipped.

However, I'd like to understand why --depth=XYZ won't work to replace -N for svn v1.9.x.

>> Tools/ChangeLog:10
>> +        (diffOptionsForFile): No longer pass -N option, since this does not work in SVN 1.9.4.
> 
> Should this be predicated on the svn version?  I know we support older versions of subversion, since we have checks like isSVNVersion16OrNewer().

Technically, the -N switch doesn't work because it was purposely deprecated.  (This makes it sound like it was broken by accident.)

> Tools/Scripts/svn-create-patch:278
> +        # svn diff -N doesn't work on svn 1.9, so only return top-level deletions.
> +        if ($modificationType eq "deletion") {
> +            push @deletedFiles, $path;
> +            next;
> +        }

Has this change been tested with older versions of svn like v1.7.x or v1.8.x?

Looking at "svn help diff", I see that -N is deprecated in svn v1.9.x:

  -N [--non-recursive]     : obsolete; try --depth=files or --depth=immediates
  --depth ARG              : limit operation by depth ARG ('empty', 'files', 'immediates', or 'infinity')

Can the --depth=XYZ switch be used instead of -N on svn v1.9.x and later?

(I could probably answer this if I was fully paying attention when you were talking to Matt yesterday.  Sorry.)

It seems like --depth=files might do what you want by listing all deleted files under the deleted directory, though.

> Tools/Scripts/svn-create-patch:297
> +        my $flag = 0;

Need a more descriptive name than "flag" for this variable to describe why the path is being skipped.  Maybe something like these (whichever makes the most sense):

$duplicatePathFound
$parentDirectoryFound
$parentPathFound
Comment 8 David Kilzer (:ddkilzer) 2017-07-11 12:39:57 PDT
Comment on attachment 315143 [details]
Patch

Tentative r=me, but all comments from Attachment 315058 [details] still apply.
Comment 9 Jonathan Bedard 2017-07-11 12:47:57 PDT
(In reply to David Kilzer (:ddkilzer) from comment #7)
> Comment on attachment 315058 [details]
> Patch
> 
> View in context:
> https://bugs.webkit.org/attachment.cgi?id=315058&action=review
> 
> Tentative r=me if this has been tested with older svn versions, and you
> change the $flag variable name to describe why a path is being skipped.
> 
> However, I'd like to understand why --depth=XYZ won't work to replace -N for
> svn v1.9.x.
> 
> >> Tools/ChangeLog:10
> >> +        (diffOptionsForFile): No longer pass -N option, since this does not work in SVN 1.9.4.
> > 
> > Should this be predicated on the svn version?  I know we support older versions of subversion, since we have checks like isSVNVersion16OrNewer().
> 
> Technically, the -N switch doesn't work because it was purposely deprecated.
> (This makes it sound like it was broken by accident.)
> 
> > Tools/Scripts/svn-create-patch:278
> > +        # svn diff -N doesn't work on svn 1.9, so only return top-level deletions.
> > +        if ($modificationType eq "deletion") {
> > +            push @deletedFiles, $path;
> > +            next;
> > +        }
> 
> Has this change been tested with older versions of svn like v1.7.x or v1.8.x?

I will double-check it against svn 1.7 and 1.8.  I don't expect this will cause any problems because it is essentially just using svn's recursion instead of us implementing our own.
 
> Looking at "svn help diff", I see that -N is deprecated in svn v1.9.x:
> 
>   -N [--non-recursive]     : obsolete; try --depth=files or
> --depth=immediates
>   --depth ARG              : limit operation by depth ARG ('empty', 'files',
> 'immediates', or 'infinity')
> 
> Can the --depth=XYZ switch be used instead of -N on svn v1.9.x and later?
> 
> (I could probably answer this if I was fully paying attention when you were
> talking to Matt yesterday.  Sorry.)
> 
> It seems like --depth=files might do what you want by listing all deleted
> files under the deleted directory, though.

I'm pretty sure -N was broken by accident.  The reason I say this is that --depth doesn't work either.  In fact, '--depth empty,' '--depth infinity' and '--depth immediates' all behave the way I would expect '--depth infinity' to behave.

> 
> > Tools/Scripts/svn-create-patch:297
> > +        my $flag = 0;
> 
> Need a more descriptive name than "flag" for this variable to describe why
> the path is being skipped.  Maybe something like these (whichever makes the
> most sense):
> 
> $duplicatePathFound
> $parentDirectoryFound
> $parentPathFound

I'll update flag to a more reasonable name.
Comment 10 David Kilzer (:ddkilzer) 2017-07-11 14:23:22 PDT
(In reply to Jonathan Bedard from comment #9)
> (In reply to David Kilzer (:ddkilzer) from comment #7)
> > Comment on attachment 315058 [details]
> > Patch
> > 
> > View in context:
> > https://bugs.webkit.org/attachment.cgi?id=315058&action=review
> > 
> > Tentative r=me if this has been tested with older svn versions, and you
> > change the $flag variable name to describe why a path is being skipped.
> > 
> > However, I'd like to understand why --depth=XYZ won't work to replace -N for
> > svn v1.9.x.
> > 
> > >> Tools/ChangeLog:10
> > >> +        (diffOptionsForFile): No longer pass -N option, since this does not work in SVN 1.9.4.
> > > 
> > > Should this be predicated on the svn version?  I know we support older versions of subversion, since we have checks like isSVNVersion16OrNewer().
> > 
> > Technically, the -N switch doesn't work because it was purposely deprecated.
> > (This makes it sound like it was broken by accident.)
> > 
> > > Tools/Scripts/svn-create-patch:278
> > > +        # svn diff -N doesn't work on svn 1.9, so only return top-level deletions.
> > > +        if ($modificationType eq "deletion") {
> > > +            push @deletedFiles, $path;
> > > +            next;
> > > +        }
> > 
> > Has this change been tested with older versions of svn like v1.7.x or v1.8.x?
> 
> I will double-check it against svn 1.7 and 1.8.  I don't expect this will
> cause any problems because it is essentially just using svn's recursion
> instead of us implementing our own.
>  
> > Looking at "svn help diff", I see that -N is deprecated in svn v1.9.x:
> > 
> >   -N [--non-recursive]     : obsolete; try --depth=files or
> > --depth=immediates
> >   --depth ARG              : limit operation by depth ARG ('empty', 'files',
> > 'immediates', or 'infinity')
> > 
> > Can the --depth=XYZ switch be used instead of -N on svn v1.9.x and later?
> > 
> > (I could probably answer this if I was fully paying attention when you were
> > talking to Matt yesterday.  Sorry.)
> > 
> > It seems like --depth=files might do what you want by listing all deleted
> > files under the deleted directory, though.
> 
> I'm pretty sure -N was broken by accident.  The reason I say this is that
> --depth doesn't work either.  In fact, '--depth empty,' '--depth infinity'
> and '--depth immediates' all behave the way I would expect '--depth
> infinity' to behave.

This is really picking nits, but does svn care if you use '--depth=files' vs. '--depth files'?
Comment 11 Jonathan Bedard 2017-07-11 15:11:06 PDT
(In reply to David Kilzer (:ddkilzer) from comment #10)
> ...
> 
> This is really picking nits, but does svn care if you use '--depth=files'
> vs. '--depth files'?

No, it doesn't care which format.

And actually, when testing both formats, I learned that SVN is respecting those flags, at least partially.  But it isn't sufficient for our use cases.  Using this example:

D containing/folder1
D containing/folder1/subfolder
D containing/folder1/file1
D containing/folder1/subfolder/file2

'svn diff --diff-cmd diff -x -uap --depth=empty containing' will return nothing, as expected.  However, 'svn diff --diff-cmd diff -x -uap --depth=empty containing/folder1/subfolder' will contain the diff of the removed file2.
Comment 12 Jonathan Bedard 2017-07-11 15:28:21 PDT
Created attachment 315174 [details]
Patch
Comment 13 WebKit Commit Bot 2017-07-11 17:24:47 PDT
Comment on attachment 315174 [details]
Patch

Clearing flags on attachment: 315174

Committed r219376: <http://trac.webkit.org/changeset/219376>
Comment 14 WebKit Commit Bot 2017-07-11 17:24:49 PDT
All reviewed patches have been landed.  Closing bug.