Closed (fixed)
Project:
Drupal core
Version:
x.y.z
Component:
base system
Priority:
Normal
Category:
Task
Assigned:
Reporter:
Created:
18 May 2006 at 15:43 UTC
Updated:
27 Jul 2006 at 06:15 UTC
Jump to comment: Most recent file
This is a script that Dries posted to the mailing list, that moves each of the modules to their own directories.
http://lists.drupal.org/archives/development/2006-05/msg00184.html
I am working on 2 patches that buld on this, namely the dependency system, which introduces small metadata files in each module's directory, and also splitting up the templates into separate files.
Additional work that can go into this patch is moving includes such as locale.inc to modules/locale/.
Also we can now split the drupal.css into separate files, each in the right module directories.
| Comment | File | Size | Author |
|---|---|---|---|
| #7 | cvs_rename.pl.txt_2 | 5.65 KB | dww |
| #6 | drupal_core_repo_mirror.php.txt | 723 bytes | dww |
| #4 | drupal_directory_renames.php.txt | 690 bytes | dww |
| #3 | cvs_rename.pl.txt | 5.66 KB | dww |
| dir.php.txt | 361 bytes | adrian |
Comments
Comment #1
jhriggs commentedAdditionally, the other module-specific files (i.e. forum icons, menu icons, watchdog icons, etc.) can move the their respective module's directories. It will be really nice to clean out misc...or eliminate it altogether!
Comment #2
dwwwe're not going to want to just directly *move* the files in the repository, since then if someone tries to checkout an older copy of core (e.g. the 4.6 or 4.7 releases), the files will be in the wrong places. on the other hand, "cvs rm; cvs add; cvs commit" means that folks have to look in the old locations for the older history, which sucks. luckily, there's a solution:
what we'll want to do for maximum goodness is:
a) copy the ,v files from the repository into the new location (e.g. "cd drupal/modules; mkdir book; cp book.module,v book")
b) cvs remove the files on the trunk from the current location
c) remove all the existing tags (esp the DRUPAL-* branches) from new copies
i've got a script that does this automatically, but sadly, upon testing it locally, it needs a little work before it's ready for this task. i'll follow-up again when i have the chance to fix-up the script. just wanted to post now so i can easily track progress of this issue and so folks know this is how you should do the actual cvs renaming.
Comment #3
dwwok, i finally made some time to work on this. 2 follow-ups:
this one is a "cvs_rename.pl" script. mostly authored by Marv Solomon, a very clueful co-worker of mine (he's a faculty member at University of Wisconsin, Madison). i've modified it to handle branch tags correctly. the perl doc comments are pretty clear. let me know if you have any questions. note, this must be run *directly* on the local file system with the cvs repository lives (since it's directly copying the repository's ",v" files around). therefore, this is only really going to be able to be used by dries for the final rename. however, if someone wants to play with this in a local mirror of the drupal core cvs repository, this should work fine.
next follow-up will be a new version of the "dir.php" script from the original post that uses this cvs_rename script. i'll put more comments there on how to test both of these if there are any interested parties.
Comment #4
dwwnew version of the dir.php script that calls cvs_rename.pl from my previous comment with the right args.
to test/use:
$cvs_renamevariable should be set to the full path to where you downloaded the "cvs_rename.pl" script$cvs_repovariable should be set to the full path to the "drupal" directory from the drupal core cvs repository. for example, if the core repository really lives in the filesystem as "/cvs/drupal", and there's a "drupal" subdirectory in there for the actual "drupal" directory that you check out, then you'd want:$cvs_repo="/cvs/drupal/drupal"in this script% /full/path/to/drupal_directory_renames.phpthat's basically it. it does all the magic itself. basically:
the cvs_rename.pl basically does this:
so, the end result is that the trunk copy of modules/foo.module is now dead. if you try to check out from the trunk, it's not there. however, all the old branch tags are still in the old location, so if you check out from "-r DRUPAL-4-6", you still get the "modules/foo.module" copy, as always. the copy in modules/foo/foo.module has no branches or tags yet (which is what we want), but as soon as we add a "DRUPAL-4-8-0-RC1" tag on the trunk, that'll hit the modules/foo/foo.module version, not modules/foo.module (which is dead on the trunk). furthermore, the copy in modules/foo/foo.module still has a complete cvs history, so if you do "cvs log" in there, you see everything, and "cvs annotate" still works along the trunk.
the only slightly weird thing with this system is that after the rename, if you want to see the cvs annotate output for a given branch (e.g. DRUPAL-4-7), you have to run the command in the old location, like so:
with a lot more effort, i might be able to come up with a solution that would allow this to work, even if you ran it on modules/foo/foo.module (basically, instead of removing old branch tags from the new location, to systematically remove the new location of the file from each branch). not sure if anyone cares enough about this to make it worth the trouble.
i don't have a viewcvs installation on my laptop to play with, so i'm not sure how gracefully that handles this kind of rename. i suspect it'd all just work, but it'd be nice if someone could test that.
as always, just let me know if anyone has any questions or problems with this.
thanks,
-derek
p.s. i'll quickly investigate how well the cvs.module handles such a rename. stay tuned.
Comment #5
dwwas i suspected, the cvs.module does basically what you'd expect by default: the commit for the rename shows up for both /modules/foo.module and /modules/foo/foo.module. if you click on the "/modules/foo/foo.module" link, you only see entries for the new location. if you want to see log messages for the old location, you have to use the old link (e.g., click on "/modules/foo.module" somewhere on a cvs message page).
if we wanted the cvs.module commit logs to mirror what happens in the actual cvs commit message history (you can view the same history from either file location), i could maybe dream up a solution to this, too. for example, we could add duplicate records to the cvs_files table for all commits using the old filename that pointed to the new one or something. alternatively, we could add weird special-case logic to cvs.module so that if you do a "file=/modules/foo/foo.module" arg to the URL, it has special-case logic to also display entries from /modules/foo.module. however, i think any such solution will just be far more confusing than helpful. at this point, i think only seeing cvs.module commit messages on whatever location the commit happened to is fine.
Comment #6
dwwfor the interested reader, here's a hack of a script to "mirror" the core drupal cvs repository to your local disk, so you can try out the scripts i posted above. just change
$local_repoto the full path to a directory where you want the local cvs repository on your filesystem. this will export the drupal core from HEAD, import it into your local repo, and make a bunch of dummy branch and release tags.then, once you run the scripts above, you should be able to do:
cvs co -d/full/path/to/your/local/repo -r DRUPAL-4-6 drupal/modulesand see stuff like "drupal/modules/book.module", vs:
cvs co -d/full/path/to/your/local/repo drupal/moduleswhere you'll see stuff like "drupal/modules/book/book.module".
not rocket science, but i thought i'd share...
Comment #7
dwwunable to leave well enough alone, took a stab at cvs annotate on old branches in the new location. i even got it working. but as i was testing it and thinking about it, i decided that we don't want this behavior. if people check out an old branch, they're going to cvs annotate along that branch from the old location, which will continue to work just fine. if they're on the trunk and they want to annotate an older branch, they should be forced to annotate in the old location. otherwise, all they'll be seeing is the snapshot of what the old branch in the old location looked like at the time of the rename (when the ,v file was copied into the new location), not the most recent annotation of the old branch (which is what people would want). so, the way annotate is handled in the aftermath of running the previous version of cvs_rename.pl is a feature, not a bug. ;)
that said, i noticed a minor annoyance with the older version. when commiting the "cvs remove" of the old location, the old script used to attempt to commit to both the old and new locations. this is unnecessary, and depending on minor details, can lead to spurious warning messages or needless commits that only end up changing the $Id$ but nothing else. so, the version attached here is (a little) better. but, now i can sleep soundly, knowing this is the best solution cvs can offer to this problem, that i'm not leaving a sub-optimal solution for drupal core modules simply because i didn't spend a little extra time...
Comment #8
dries commentedLooks awesome. I'll do some testing but I encourage others to do the same.
Comment #9
dries commentedI tried the script but couldn't get it to work. I'll try again when I can get hold of dww for real-time support.
Comment #10
dwwi just helped dries with this, and he's now got a test repository that seems to be doing just fine. he'll probably do the renames on the live core repository sometime in the next few days. setting to "RTBC", which seems like the most appropriate status. ;)
in related news, i'm working on a handbook page about the cvs and other implications of the move. i'll post a link here once it's done.
Comment #11
Chris Johnson commentedThis all looks good to me. I have not tested it myself on a local copy of the repo, though. But I have done stuff like this before with other CVS repositories.
Just be sure to make a snapshot copy of the repo before running it, so the worst case would be to copy back the original while the problem is solved. :-)
Comment #12
dwwunpublished handbook page about cvs implications of the move: http://drupal.org/node/69668
Comment #13
dries commentedCommitted to CVS HEAD! :)
Comment #14
Jaza commentedCannot access a site at all after upgrading to latest HEAD. Wasn't able to get the site working again, until I manually changed the 'system' table entry for the following modules, to reflect the new path:
- block
- filter
- node
- system
- user
- watchdog
(basically, all the 'required' modules).
We need a new update routine, to change the path _manually_ in the 'system' table for the 6 modules listed above, to clear the cache, and to then call system_modules(), so that the other modules on a site also get their paths updated. I think all of that should do the job.
Otherwise, nice improvement!
Comment #15
jvandyk commentedComment #16
Jaza commentedOK, hunmonk has created a separate issue for fixing the upgrade path needed as a result of this patch:
http://drupal.org/node/73456
Comment #17
(not verified) commented