Ever been disgruntled by the fact that you can't do a cvs diff with new files, because you haven't got write access on a Drupal contrib module's CVS repository and thus can't cvs add those new files? There's a solution though: edit CVS's Entries file. But who likes manually modifying files over and over again?
The solution: fakeadd! (I've attached the file to this post in case this site ever goes down.) This nice shellscript allows you to update the Entries file using a simple syntax: fakeadd newfile.php.
A quick install how-to:
~/scripts.~/.bash_profile file (if you're using the bash shell, this is the default shell on OS X) and add the following:
# Add custom scripts, such as the CVS fakeadd script. export PATH=$PATH:~/scripts
chmod +x ~/scripts/fakeadd.-N flag. So your eventual command will look like this: cvs diff -N -up > foo.patch.Updated on November 30, 2008. The above blog post was improved based on the feedback I got in the comments:
-N parameter for cvs diff to pick up new files.| Attachment | Size |
|---|---|
| fakeadd | 770 bytes |
Comments
It works. A couple extra pointers...
First, run the fakeadd script from the directory where the new file lives. If you're adding some new unit tests to D7, for example, they might be in ./includes/tests. fakeadd changes the CVS/Entries file in the current directory, so to add ./includes/tests/foo.test, you need to cd to includes/tests first.
Second, when making the patch, you need the -N flag:
cvs diff -N -up > foo.patch
Very handy!
Thanks very much for this script! Had troubles patching with a new file and this worked perfectly!
humm....
i was trying to use this as "fakeadd modules/*/*.api.php" and it failed miserably. i'm trying to decide if it'd be worth hacking it to get this to work correctly or if i should just add them by hand...
there fixed that for you ;)
Thanks, I updated the blog
Thanks, I updated the blog post!
Alternative approach: cvsdo
Just thought I'd throw out there that I stumbled across this post (and it didn't /quite/ work for me, though I appreciated that other Drupalers were attempting to solve this) slightly before this one.
Down in the section titled "Including new files in a patch", it mentions a nice utility called cvsdo (source is here, but see below if you're a Debianite), which accomplished this task quite nicely, and comes with other useful cvs utilities such as cvschroot which lets you change the Root entry (recursively!) for a working copy (ie. from an anonymous checkout to a logged-in one, for instance).
Even better was the fact that, on my debian-based system, all I had to do was apt-get install cvsutils and kapow! I had 'cvsdo' at my service :)
Thanks, great tip!
Thanks, great tip!
Added to drupal.org
Added to drupal.org documentation page. both this script and cvsdo, cvsutils.
http://drupal.org/node/323
Cheers
Frank Carey
Pingback
[...] command fails without write access to the repository. Luckely there is a handy little tool called fakeadd which you can use to edit the CVS entries file and let it look like the new files have been [...]
This is awesome!
You should get this into the official patch docs. The current setup is really a pain for a big patches with multiple dirs.
Syntax errors
I notice there are some missing trailing quotes (") on two of the echo statements.
That will make echo print "what you want ... plus every thing up to next echo with leading"
Here's a patch that fixes it (plus I added a line with a URL back here :).
--- /tmp/1/fakeadd 2010-01-08 10:49:37.051730790 -0600+++ /tmp/2/fakeadd 2010-01-08 10:49:13.531058172 -0600
@@ -1,4 +1,5 @@
#!/bin/sh
+# from http:/wimleers.com/blog/cvs-diff-new-files-fakeadd
if [ $# -eq 0 ]; then
echo "usage: $0 file ..." 1>&2
@@ -15,12 +16,12 @@ for file in "$@"; do
continue
fi
if [ -d "$dir/CVS" ]; then :; else
- echo "$0: fatal error: no CVS directory!
+ echo "$0: fatal error: no CVS directory!"
rv=1
continue
fi
if [ -f "$dir/CVS/Entries" ] && [ -w "$dir/CVS/Entries" ]; then :; else
- echo "$0: fatal error: CVS/Entries file not writable!
+ echo "$0: fatal error: CVS/Entries file not writable!"
rv=1
continue
fi
Nice post. Love your work
Nice post. Love your work hope to see some more cool stuff soon.
Upgrade your VCS
I'm surprised nobody has mentioned it yet. Just use bzr or git and you won't have these problems. There are well maintained bzr and git mirrors of Drupal. See detailed instructions for git at http://drupal.org/node/707484
It doesn't help getting your
It doesn't help getting your code into drupal.org's CVS though. It's possible, but that kind of set up is quite hard IIRC.
EcwfxYflRhIyVpQjzd
Have fun at the beach, relax, enjoy! german granny 8 [url="http://www.kerin-povirk.si/milf"]german granny 8[/url] http://www.kerin-povirk.si/milf german granny 8 lucious hentai digimon [url="http://www.tcgm.com/gallery"]lucious hentai digimon[/url] http://www.tcgm.com/gallery lucious hentai digimon splooge hentai [url="http://temple8.net/tentacle"]splooge hentai[/url] http://temple8.net/tentacle splooge hentai
WPkqAMWjqOLuKthSPZU
Thank You Everyone. bat tentacle hentai [url="http://www.argusfinearts.com/girls"]bat tentacle hentai[/url] http://www.argusfinearts.com/girls bat tentacle hentai hentaivedio [url="http://condagal.pt/adult"]hentaivedio[/url] http://condagal.pt/adult hentaivedio mature modles [url="http://klkomarno.sk/nude"]mature modles[/url] http://klkomarno.sk/nude mature modles
ONithgMsiflddefk
What's the answer here? HELP! salior moon hentai [url="http://www.quebecbravo.com/dragon"]salior moon hentai[/url] http://www.quebecbravo.com/dragon salior moon hentai full lengh mature movies [url="http://www.davidacutting.com/mom"]full lengh mature movies[/url] http://www.davidacutting.com/mom full lengh mature movies hentai with no sign up [url="http://www.gomtools.com/hentai"]hentai with no sign up[/url] http://www.gomtools.com/hentai hentai with no sign up
ONithgMsiflddefk
What's the answer here? HELP! salior moon hentai [url="http://www.quebecbravo.com/dragon"]salior moon hentai[/url] http://www.quebecbravo.com/dragon salior moon hentai full lengh mature movies [url="http://www.davidacutting.com/mom"]full lengh mature movies[/url] http://www.davidacutting.com/mom full lengh mature movies hentai with no sign up [url="http://www.gomtools.com/hentai"]hentai with no sign up[/url] http://www.gomtools.com/hentai hentai with no sign up
Post new comment