1. $version_control->pre_update() does move the project to backup directory.
2. cvs package_handler looks for CVS in the unexistent project directory.
3. instead of cvs update, cvs checkout is done.
To fix this, pre_update() should copy to backup directory instead of moving. It should do this only under those conditions:
a) package-handler == cvs
b) CVS directory is present in project's dir.
| Comment | File | Size | Author |
|---|---|---|---|
| #9 | drush-940688-w-recursive-copy-2.patch | 4.83 KB | greg.1.anderson |
| #6 | drush-940688-w-recursive-copy.patch | 4.84 KB | greg.1.anderson |
| #5 | drush-940688.patch | 3.71 KB | jonhattan |
Comments
Comment #1
greg.1.anderson commentedThis would also fix the problem where php's
renamefails for cross-volume moves. Would copying instead of moving cause problems when files are removed from a module? There are existing issues about this, I think. Copy instead of move would at least make it consistent -- drush would need to explicitly remove files that no longer belong in the directory. So, in conclusion, I think the proposed fix is a good idea.Comment #2
jonhattanwith package-handler=cvs an update will take care of removing files. If package handler =wget, instead of copy it will move(rename), as now. This is my proposal in #0.
I still haven't think of the way to implement copy,... rsync or drush_shell_exec('cp ..').
Other think to address in a distinct issue is to make wget compatible with vcs'. I've think of scanning the directory in backup and copy each .svn or whatever over the fresh downloaded project. Doing it compatible with any random 3rd library that the module wants placed in its folder is harder.
Comment #3
greg.1.anderson commentedI was planning on using rsync, as drush has a nice wrapper function for it. However, moshe thought that rsync wasn't 'core' enough to use in a critical function such as pm-updatecode. Windows support only seems to be getting sketchier in drush over time, though, so maybe this decision could be revisited...? Are we ready to punt Windows-native support for drush, and require at least cygwin on Windows?
Comment #4
jonhattanComment #5
jonhattanPatch providing drush_copy_dir() and a switch in backup.inc to copy instead of move if package-handler=cvs.
drush_copy_dir() uses cp or rsync although I don't see a reason for cp to fail. There's no copy() for directories in php. The function also overlaps a lot with drush_move_dir().
Comment #6
greg.1.anderson commentedLooks good, but let's be kind to Windows users and do it with a recursive php function. This also improves on #968948: Drush returns an error on dl command on subdomain named subsites.domain.com.
Comment #7
luchochs commentedGood!
Some comments:
- less indentation is possible.
- the error never occurs.
- less indentation is possible.
Comment #8
luchochs commentedUpdate: The observation about the error is wrong, clearer patch in a while.
Comment #9
greg.1.anderson commentedHere is a new patch with less indentation.
The error DRUSH_PM_BACKUP_FAILED actually will occur if drush_move_dir or drush_copy_dir returns FALSE (e.g. permissions error).
Comment #10
luchochs commentedYes, I was wrong about the error. Alternative proposal:
Comment #11
luchochs commentedRudimentary tests OK for #9 and #10. You choose.
Comment #12
greg.1.anderson commented#10 removes too much indentation and fails to return the correct error code should drush_move_dir or drush_copy_dir fail.
I recommend #9, but will let jonhattan confirm and commit.
Comment #13
jonhattanThanks Greg for writing up the recursive copy: I was naturally lazy to do it. With that we have better support for windows. Commited #9 with an actualization to docstrings.