Bug 9485

Summary: Teach svn-apply and svn-unapply to use full path names
Product: WebKit Reporter: David Kilzer (:ddkilzer) <ddkilzer>
Component: Tools / TestsAssignee: Nobody <webkit-unassigned>
Status: RESOLVED FIXED    
Severity: Normal CC: darin
Priority: P2    
Version: 420+   
Hardware: Mac   
OS: OS X 10.4   
Attachments:
Description Flags
Patch v1 darin: review+

Description David Kilzer (:ddkilzer) 2006-06-17 09:17:17 PDT
It annoys me when using svn-apply and svn-unapply that full path names to files are not used.  I have a patch that will fix this, along with some general clean-up of both scripts.
Comment 1 David Kilzer (:ddkilzer) 2006-06-17 09:27:49 PDT
Created attachment 8887 [details]
Patch v1

Patch v1 does the following:

svn-apply:
- Added "use warnings;"
- Used subroutine prototypes
- Added command-line argument validation and a -h|--help argument with a help message
- Changed merge feature to operate on full paths
- Added "exit 0;" statement at end of main code path
- Renamed $fullpath to $fullPath
- Changed patch() subroutine to use $fullPath instead of $base and to inline usages of $prefix
- Changed handleBinaryChange() subroutine to use a full path
- Renamed chdirAddingDirectoriesIfNeeded() to addDirectoriesIfNeeded() and chdir back to $startDir when done

svn-unapply:
- Added new missing feature for removing newly added directories
- Added "use warnings;"
- Used subroutine prototypes
- Added command-line argument validation and a -h|--help argument with a help message
- Added "exit 0;" statement at end of main code path
- Renamed $fullpath to $fullPath
- Changed patch() subroutine to use $fullPath instead of $base and to remove usages of $prefix
Comment 2 David Kilzer (:ddkilzer) 2006-06-17 09:33:33 PDT
(In reply to comment #1)
> svn-unapply:
> - Added new missing feature for removing newly added directories

That is, I added the item to the missing-feature list.  I haven't implemented that feature (yet).
Comment 3 Darin Adler 2006-06-18 16:48:14 PDT
Comment on attachment 8887 [details]
Patch v1

cvs couldn't handle full paths; that's why the code was doing complicated unnecessary stuff before. Once we switched to svn, we didn't need that code.

I don't understand why we need to chdir at all any more. I think that addDirectoriesIfNeeded also should use full paths.

r=me
Comment 4 David Kilzer (:ddkilzer) 2006-06-18 16:54:17 PDT
(In reply to comment #3)
> I don't understand why we need to chdir at all any more. I think that
> addDirectoriesIfNeeded also should use full paths.

Hmm...you must add the top-level directory in SVN:

pbookw:~/WebKit ddkilzer$ mkdir foo
pbookw:~/WebKit ddkilzer$ mkdir foo/bar
pbookw:~/WebKit ddkilzer$ svn add foo/bar
subversion/libsvn_wc/lock.c:377: (apr_err=155007)
svn: 'foo' is not a working copy
pbookw:~/WebKit ddkilzer$ svn add foo
A         foo
A         foo/bar
pbookw:~/WebKit ddkilzer$ 
Comment 5 David Kilzer (:ddkilzer) 2006-06-18 16:55:50 PDT
Committed revision 14909.
Comment 6 Darin Adler 2006-06-19 10:52:30 PDT
(In reply to comment #4)
> (In reply to comment #3)
> > I don't understand why we need to chdir at all any more. I think that
> > addDirectoriesIfNeeded also should use full paths.
> 
> Hmm...you must add the top-level directory in SVN:

Sure, you need to add one directory at a time. But we don't need to chdir. We can use a full path for each directory as we add it.