Posted by quicksketch on March 30, 2010 at 10:05pm
6 followers
| Project: | Drush |
| Version: | All-Versions-3.0-rc1 |
| Component: | Code |
| Category: | bug report |
| Priority: | normal |
| Assigned: | Unassigned |
| Status: | closed (fixed) |
Issue Summary
While #434944: Allow minor upgrades of drupal core was a great improvement, it unfortunately doesn't solve the one problem I wanted to use it for: easily updating Drupal core without having to keep track of the ".svn" directories all over the place. Running drush up drupal unfortunately blows away all .svn files, and apparently ANY other files in any core directory. So this problem would affect other version control systems that use this approach, or users who have a tendency of keeping .patch files directly within the module directory that has been patched.
Comments
#1
@quicksketch: Try this for me. It is improved, but I didn't check in my drupal dir to svn for a "real" test. Does
drush up somemodulenamepreserve your .svn files? If you're not using a vcs, then drush up will remove all files in the directory. Prior to this patch, drush up drupal removed all dot files in the drupal root, but should have preserved patch files.#2
Just a quick note -- started testing the patch in #1 with --version-control=svn. It seems to be working pretty well, but there's a problem with rollbacks not working right if you have uncommitted files in the root. Will continue on this later.
#3
Sub.
#4
Yes
drush uppreserves .svn files without any additional flags (I think it figures out --version-control=svn automatically though). drush up also doesn't affect any additional files that might be within a directory, so it will preserve things likesomemodule_patch.patchfiles that people have a tendency of sticking in module directories when they patch a module. I don't do this myself, but I think it's a common practice.#5
@quicksketch: I was more asking about how it was behaving on your system, since files that aren't checked in will cause the whole shebang to screech to a halt before you ever get to the point where drush preserves or loses your files. But I infer now that my 'additional files' you mean 'checked into svn but not part of the drupal release'. I was somehow thinking of files extraneous to both systems.
In any event, here is a new patch that works (*cough*) cleanly.
Okay, I was hoping that no one would notice that cough. Darn. A bit of an explanation.
The way that update core works right now is it moves all of the core files away to a new directory that 'looks' a lot like a project directory. It then uses the regular updatecode routines to do the update, and moves everything back again when it's done. Now, without going into details, the 'sites' folder can't come along; it doesn't work -- and in fact this is the main reason we move everything else away; I could probably also get away with keeping everything else in place, and just move the 'sites' folder somewhere else, but no matter, the end effect is the same.
The missing 'sites' folder causes problems for svn. 'svn status' emits a "! missing" line for the sites folder, and 'svn status -u' is even worse; it emits a "* not up to date" line for everything inside the 'sites' folder. [Edit: The rest of this is wrong -->] There is no flag to pass to svn status to tell it to skip just one file. So I hack it. I run 'svn status' as usual, but then use preg_match to get rid of the one "! missing sites" line. The 'svn status -u' is much too noisy for this sort of tomfoolery, though, so I skip the up-to-date check altogether when doing a core update.[End wrong]
Note that this would also be an issue for bzr, save for the fact that bzr does not do the same checks that svn does at the moment.
Edit: Do not use this patch.
#6
Right, sorry I was unclear about that. As you say, a file just floating around will kill the whole update if it is not in SVN.
The whole thing sounds and looks a little less clean that I think everyone would prefer, but I'll give this a shot tomorrow.
#7
I missed an obvious solution to the update core with svn problem last night.
svn statuscan optionally take a list of files to get status for; so, although there is no 'skip' option, an item can easily be skipped simply by passing in status a list of every item in the folder except the item to skip.I'll post a cleaner patch shortly.
#8
Here it is; cleaner and better, as described in #7.
One thing of note: I added a 'cd' before the svn status and svn status -u. Note that the scope of this directory change is only within the shell spawned by exec; drush's cwd will not change.
#9
I kind of worry that we are drifting into lots of special cases for Drupal core, when really we should be able to use the same approach to managing excludes or deltas (either specifying manually, or determining automatically) to deal with modules or themes with local changes - which is an identical problem. The approach of moving the current core out of the way and then trying to merge changes back also seems to be introducing quite a lot of complexity - perhaps we should reconsider the approach of dl-ing the project into a temporary directory and then copying files across from there (we could even do a simple rsync to start).
Either way, this is clearly a pretty major issue right now, so it is fine to commit this (or a simpler band aid, if possible), but I think we should aim for a round of refactoring before we do a stable release, if not to get core vs. contrib more consistent then at least to move somewhat in that direction.
#10
Heh, well now I've caused all kinds of trouble. Since I couldn't use Drush to update Drupal core, I just updated it manually and committed it. Now wanting to test this patch, I figured, "no problem, I'll just update to revision X before I did the update". Heh, no go here:
The SVN working copy at /Users/nate/Sites/test/drupal-6.16 appears to be out of date with the repository (see below). Please run [error]'svn update' to pull down changes before continuing:
Now to get this working I need to make a new repository, check in an old copy of Drupal, then use drush update. I suppose this matches the "normal" situation though.
#11
Yes, I agree with the sentiments. This implementation should definitely be re-factored and fixed up, as strategy used by pm-updatecode is not good for updating code. Your suggestions above are better vis-a-vis a long-term solution. However, I did it this way so that the existing, stable strategy used for module updates could also be applied to a core update, so that we could get to a point where we can update core faster, without needing all new code. So, while I agree that this implementation is ugly, it is also based on code that has gone through a lot of testing, and although it needs to wiggle a little to do it, a core update is done in very much the same way that a module update has always been done. I think that this technique is good enough to go into 3.0-stable, and that we should work on refactoring and rewriting it after DrupalCon. It's been six months since the last stable drush release, and I think a rewrite of pm-updatecode is likely to take another three to six months from start-to-stable.
It's up to Moshe to decide, of course; however, I think we should do 3.0-stable before DrupalCon, so if update-core is not ready for inclusion in a stable release, then it should be backed out.
#12
@quicksketch: Yep, it's working like it's supposed to, as inconvenient as that might be at the moment. ;) You could probably get it to work by creating an svn branch, but your other suggestion would also work.
#13
Okay, clean repository, checked in Drupal 6.15, ran drush up drupal:
Note: Updating core can potentially break your site. It is NOT recommended to update production sites without prior testing.
Do you really want to continue? (y/n): y
Project drupal was updated successfully. Installed version is now 6.16.
No database updates required [success]
Finished performing updates.
nate:~/Sites/test$ svn st -u
M 1 themes/bluemarine/bluemarine.info
M 1 themes/garland/garland.info
M 1 themes/garland/minnelli/minnelli.info
M 1 themes/chameleon/chameleon.info
M 1 themes/chameleon/marvin/marvin.info
M 1 themes/pushbutton/pushbutton.info
M 1 misc/teaser.js
M 1 install.php
M 1 CHANGELOG.txt
? includes/lock.inc
M 1 includes/bootstrap.inc
M 1 includes/file.inc
M 1 includes/theme.maintenance.inc
M 1 includes/session.inc
M 1 includes/common.inc
M 1 includes/database.pgsql.inc
M 1 includes/path.inc
M 1 includes/database.mysql-common.inc
M 1 includes/theme.inc
M 1 includes/form.inc
M 1 includes/database.mysql.inc
M 1 includes/database.mysqli.inc
M 1 includes/locale.inc
M 1 includes/menu.inc
M 1 includes/database.inc
M 1 modules/syslog/syslog.info
M 1 modules/aggregator/aggregator.info
M 1 modules/blog/blog.info
M 1 modules/system/system.admin.inc
M 1 modules/system/system.install
M 1 modules/system/system.module
M 1 modules/system/system.info
M 1 modules/upload/upload.info
M 1 modules/php/php.info
M 1 modules/statistics/statistics.info
M 1 modules/book/book.info
M 1 modules/translation/translation.info
M 1 modules/locale/locale.module
M 1 modules/locale/locale.install
M 1 modules/locale/locale.info
M 1 modules/menu/menu.info
M 1 modules/search/search.info
M 1 modules/taxonomy/taxonomy.module
M 1 modules/taxonomy/taxonomy.info
M 1 modules/openid/openid.inc
M 1 modules/openid/openid.info
M 1 modules/color/color.info
M 1 modules/update/update.compare.inc
M 1 modules/update/update.info
M 1 modules/filter/filter.info
M 1 modules/filter/filter.module
M 1 modules/node/node.info
M 1 modules/node/node.module
M 1 modules/dblog/dblog.info
M 1 modules/dblog/dblog.module
M 1 modules/forum/forum.info
M 1 modules/forum/forum.module
M 1 modules/help/help.info
M 1 modules/block/block.info
M 1 modules/tracker/tracker.info
M 1 modules/contact/contact.info
M 1 modules/path/path.info
M 1 modules/ping/ping.info
M 1 modules/profile/profile.admin.inc
M 1 modules/profile/profile.info
M 1 modules/comment/comment.admin.inc
M 1 modules/comment/comment.module
M 1 modules/comment/comment.info
M 1 modules/trigger/trigger.info
M 1 modules/throttle/throttle.info
M 1 modules/poll/poll.info
M 1 modules/blogapi/blogapi.info
M 1 modules/user/user.module
M 1 modules/user/user.info
M 1 modules/user/user.admin.inc
M 2 .htaccess
Status against revision: 3
Looks like it did exactly what it should. It did seem to take quite a bit longer than my previous attempts before the patch however. I'd say it takes about 40 seconds for the whole process, previously it took about 5 seconds. Maybe the download from d.o was just slow though.
I agree with the sentiments here though. While this works I'm not sure it's the right thing to be doing. I doubt this would work if you had .bzr or .git files in the root of your Drupal installation, requiring yet more exceptions to factor in.
#14
I recommend committing this bugfix, and moving the discussion about the future of updatecode drupal to #759906: Update core without moving core files out of the way..
#15
committed #8. lets discuss how to proceed in #759906: Update core without moving core files out of the way..
#16
Great, thanks moshe and greg.1.anderson.
#17
Automatically closed -- issue fixed for 2 weeks with no activity.