deleting all subversion files from a directory

Posted about 16 years ago

OK, I've got to give Mercurial a try. In order to import the files from my local working copy (will try hg convert later) I needed to prune out my local copy.

Yes, you can use SVN export as well. But I wanted to try to delete all the files within a directory structure. Here's how to use "find" and "rm" together to remove specific directories in a directory structure:

find . -name '.svn' -type d -print0 | xargs -0 rm -rf

the "find" part of this argument will find all files in and under the current directory named ".svn" that are directories and print them out as a list. those results are piped to xargs to turn into an argument list for rm. the "r" option works through the tree recursively and the "f" option forces removal. This is necessary in order to remove folders that have files in them.

Extract Files From Subversion for Propagation

Posted about 16 years ago

Problem:

You store your site files in a subversion repository for source control. When you update your site you don't want to upload the entire tree (nor the svn working copy files) nor do you want to spend time hunting and pecking for the changed files.

Solution:

Use the following script on *nix to extract non-svn files that have recently changed:

find . -not ( -name '.svn' -type d -prune ) -not ( -name '*.log' ) -type f -mmin -240 -print | zip ~/Desktop/prop -@

Discussion:

We're building upon syntax we've used in two previous posts: delete files from a subversion sandbox and zip changed files in your subversion sandbox.

In this case we are using the "find" command combined with the -mmin option to find file modified within a specified number of minutes. find . -mmin -X will find files in the current directory structure modified in the last X minutes. find . -mmin X will find files in the current directory structure modified before X minutes ago.

In the example above we're findiing all files not in .svn folders modified less than 240 minutes ago. We pipe the results of that find to the zip utility to zip up the results. We are also filtering out the Rails-specific "development.log" from being zipped.

If you want to propagate an entire directory structure you can use svn export on your working copy to extract out all your files (this is the same as a checkout without the .svn folders). You can also svn export from the repository to pull a specific revision or branch.

svn export . ~/Desktop/prop
svn export http://repos/project/tags/release_1.0 ~/Desktop/prop

And for those Rails developers you can obviously use Capistrano to get around most of these issues.

Delete All Files in a Subversion Working Copy

Posted about 16 years ago

Problem:

You want to remove all the files in your subversion working copy but you do not want to remove the folder structure.

Description:

I have had to do this when upgrading an application from Rails 1.x to Rails 2.0. The file structure of my project changed significantly enough that I just moved everything out to a non-working copy to do the work. When I started to move the work back in there were a lot of files/folders that had changed.

Rather than work through the manual process of moving files in svn it's sometimes easier to just start from a new point in time within the same repository. In that case you want to:

  1. remove all the files in your current working copy yet preserve the folder structure for SVN
  2. move all the new files into your working copy and commit those changes
  3. clean up any new/missing files and folders.

Solution:

*nix

From the command line run:

find . -not \( -name '.svn' -type d -prune \) -type f -print | xargs rm 

This says....

find from the current directory (find .)
...ignoring files in a directory called '.svn' (-not ( -name '.svn' -type d -prune ))
...any file (-type f)
...and delete it (-print lists the files and xargs rm removes any file in that list)

oddly enough the following _will_ list out the same as above...

find . -type d -name '.svn' -prune -o -type f -print
but -delete is invoked with -depth implied so you will end up deleting required svn files if you run

find . -type d -name '.svn' -prune -o -type f -print

Windows

This is easier from the UI with your favorite search tool. I use Directory Opus so from the advanced tab specify Location to not match .svn and type matches files only.

Any other good ideas for this on Windows?

Easily Zip Changed Files in Your Subversion Working Copy

Posted about 16 years ago

Subversion is a great tool for source control on a team of software developers. Every check-in we do into subversion must be accompanied by a code review from a fellow developer. The best method for doing this is to send the modified files to another developer in zip format. But how does one do this with a large source tree?

*nix

From the command line run the following:

svn status | grep ^[AM] | awk '{print $2}' | zip ~/Desktop/cr -@

A small explanation of what's going on here:

  • this makes heavy use of piping (aka the | or "pipe" character) which sends the output of a command on the left of the pipe as input to the command on the right. as a short exampe ls -l | grep ^A will send a directory listing to grep will will then evaluate that list and parse out only those entries that start with A (which really will be none...).

  • svn status will list all files in your working copy (local sandbox) that are not in sync with the svn repository.

  • svn status returns ?, !, A, M, D for "unknown," "file missing," "added," "modified," and "deleted" respectively. it lists this info in column 1 and the file path in column 2.

  • we use grep ^[AM] to filter out the list for added and modified files only. it's a regular expression that says find matches where the line starts with A or M. this means the output of svn status | grep ^[AM] will be a list of all added and modified files in your working copy.

  • we use awk '{print $2}' to print the 2nd column front standard input. this means that svn status | grep ^[AM] | awk '{print $2}' will list the paths of each file in your svn working copy that has been added or modified.

  • zip is the most obvious command in this sequence - it builds a zip file in the location specified. the only odd option is -@ which tells zip to take the list of files to zip from standard input.

I have actually saved this to a bash script to make sure I delete any existing cr.zip.

Windows

Heaven forbid you can actually do something more easily and nearly as geeky on Windows but it's true....

This assumes you use TortoiseSVN which is a stellar program that integrates into the Windows shell.

Right-click on your trunk directory and choose TortoiseSVN => SVN Check for Modifications. This command sends svn status and returns the list to a dialog box. From here you can double-click each file for easy diff.

To zip these files up create a new zip file (on your desktop) with your zip utility of choice (aka WinRar or WinZip - as you'll see in a moment) and open the zip in your utility.

From the TortoiseSVN window select all the files you want to zip (you will have to manually unselect (or not select) deleted, missing, or non-added files which is made easier if you sort by the "text status" column) and drag them to the title bar of your zip utility. With WinRar and WinZip you get a dialog giving you options about how you want to add these files - make sure you select to add the files with full paths or when they are unzipped they'll be all at the root of the zip file.

I have not played with other zip utilities on windows outside of 7z which does give you the option to add files by full path.

Oh My

Posted about 17 years ago

Star Wars Gangsta Rap - very disturbing (and funny). Check it out.

My New Toy

Posted over 18 years ago

Today arrive my Dell Dimension E510. I toyed with getting one of the new XPS boxes but didn't want to shell out the cash. I got the Win XP Media Center edition which is quite interesting so far (I'm not quite done installing all the advertising crap that Dell feels obliged to install for me).

The machine is super quiet - insanely quiet actually. I've got 2GB RAM with a hyperthreaded 3.4GHz CPU.

The only real problem so far is the uninstallation process. I suppose this is an ideal thought but it would be nice to get a computer with just the OS installed - damned OEM agreements.

I think I will also need to get a cable in box - we'll have to see about that. In theory this machine will act just like a ReplayTV but will have to play with that.

More later...

Look Into: My Favorite New PowerToy

Posted over 18 years ago

My Favorite New PowerToy

This might be worth a look - I do a lot of work on multiple computers and it is hard to keep things sync'd. Will have to play with in my free time.

Vampire Hunters

Posted over 18 years ago

In the interest of useless trivia I discovered tonight that the music to the Demolition Man trailer is from the Dracula soundtrack composed by Wojciech Kilar. The track is Vampire Hunters and is quite a dark anthem.

In a seemingly related note I was told today that I was the geekiest person that someone knew. I dispute this but really have nothing substantial to refute this claim with.

That being said I did score 45% on the geek test - this does not really put me in the scale of uber-geeks.

Sarah has also challenged me to put up my picture of our visit to the Star Trek exhibit at the Las Vegas Hilton (this qualifies I'm sure for something). I honestly like my picture with the Mark V torpedo as it has more historical significance in the Star Trek universe.



Note that Sarah is standing next to the Klingon.

One thing to remember from this visit is that they take pictures halfway through the tour. At the end they merge your picture into a Star Trek scene. I don't remember what my expression was but it sure was funny merged into the TOS bridge scene.

Dual Blogging

Posted over 18 years ago

Well, I figured out how to make dual blogging work with MSN Spaces and Blogger.com.

Here is what I was after (and figured out): to post to Blogger.com and show it in MSN Spaces so that the gleam shows up. For those of you regulars you know that I'm primarily using Blogger.com so I want to post there first. The steps below allow you to accomplish this.



Both sites allow you a publishing email. In either case you must specify a special word to use in your email address as a cheap security measure.

In MSN Spaces this is under Edit My Space => Settings => E-mail Publishing. Setting this up is quite easy:

1. Check the box "Turn on e-mail publishing"
2. Email address - use the email address associated with your blogger.com account
3. choose your "secret word" - the email address you publish to will be user.secret@spaces.msn.com
4. choose to publish or save as drafts - I am using drafts right now just to make sure everything is hunky dory but will likely change this to live publishing in a couple of weeks.

That's it on the MSN side. You will update and the gleam should show up on your MSN Messenger when you publish to blogger.com.

BTW, I turned off commenting as I want these as blogger.com only.

On the blogger side it's equally as easy:

1. Goto your blog
2. Click Setting => Email
3. For Blogger Send Address enter the MSN Spaces email above
4. You can select a mailto blogger address - same "secret word" security model - same rules as you can publish or save as drafts

I did do an email post the other day (geek factor - from my phone :-)) and it works like a champ. I did find I needed to re-edit the post but that may be due to the phone more than from the email. Shame on me - I should have posted this from email...

Happy Blogging!

Welcome Back

Posted over 18 years ago

Well, I experimented with a couple of other blogs and I think it's time to return to blogger.com. In comparison there are a couple of things that stand out as to why:

1. spaces.msn.com never got my blog listed in MSN search
2. I can allow people to comment on my blog that are not members
3. I can modify my template how I choose meaning I am not put into a pre-determined template
4. I can post this on my website rather than having to use another server
5. works equally well in Firefox and IE
6. I can mod the time of my post - handy when I've been lazy about goings on....

What am I losing?

1. gleem from MSN Messenger when I've posted - I can overcome this by updating links to this site from my MSN spaces site
2. automatic blogging from messenger - not a huge feature anyway for me. I will need to experiment with the email blog capability of blogger.com
3. not much else....

So, let's see how this goes. First step is to copy over content from the other blog...here I go...

Emacs Quick Reference

Posted almost 19 years ago

A very nice top-level view of emacs

Another very good overview

Tips For Linux - How to find Size of a directory & Free disk space

Posted almost 19 years ago

provides some handy notes on getting started with LINUX

Activating NUMLOCK During Boot Time in Linux

Posted almost 19 years ago

Interesting notes while I hack away with Linux

Firefox Impresses - Continually

Posted almost 19 years ago

Well, Firefox just continues to impress.

I have managed to customize my tabs via the normal preferences as well as a couple of plug-ins to provide me the ideal browing experience.

First, all new tabs open in the background. For me, I like to be able to click on links in stories I'm reading but continue where I am.

Second, anything typed into the location bar is opened in a new tab in the foreground. See below what this means for keyword bookmarks. Obviously, if I'm typing something in then I want it right away (most of the time anyway :-)).

Third, Firefox supports multiple home pages. If you enter your home page as "http://google.com|http://yankees.com" this will open two tabs when you open FF or click "home."

Fourth, Firefox bookmarks support the notion of keywords. You can create a bookmark from a google search and replace the specific search with %s (e.g. http://www.google.com/search?hl=en&q=%s). Edit the bookmark and create a keyword like "google" - now anytime you type "google amazon" in the address bar firefox will do a google search for you. I've done the same trick with Google Maps.

Finally, some nice extensions.

  • Tabbrowser preferences - provides a nice interface for some advanced tabbing features that are not normally available through Firefox preferences.
  • Last Tab - for the programmers of the world this is a necessity. It changes the CTRL-Tab behavior to go to the most recent tab rather than the next tab in order.
  • Unread Tabs - if you open a lot of tabs (from RSS feeds for example) you can easily see what's not been read with this extension.

chrisholtz.com

Posted almost 19 years ago

So, speaking of Chris we were playing around last night (in our typical "why aren't we just using IM?" email frenzy) and found this sweet website (http://web.archive.org). Unfortunately we also found Chris' old sweet website :-)

Interesting to note that this is when I met Chris. This is also shortly where I turned him back into a carnivore (with help from Ben). I believe the fall happened at the Golden Dynasty and the dish was sesame chicken....

Chris also currently has his own blog.