Converting part of a svn repository to git

In moving my projects over to git, I stumbled across a troublesome issue. In one of my projects existed a folder along side trunk, tags and branches that had stuff I needed to be converted. However I wanted to convert these as individual git repositories.

So, after reading “git –help svn clone” and finding nothing to help me with this issue, I headed to the search engines. It took some time between search engines and asking some friends. As a note, Git 1.7 has sparse abilities, however I never got that far to try it out. I found out that git 1.6.4 included a new parameter which does the job just nicely.

I stumbled across this on the Tech Debug blog.

So in the end the following command is an example of what I did, with real data omitted.

This did the job exactly as I needed it to. It converted just the folder in the repository without so much of a complaint. Now that I review the git man page for svn, I do see I missed it.

When tracking multiple directories (using –stdlayout, –branches, or –tags options), git svn will attempt to connect to the
root (or highest allowed level) of the Subversion repository. This default allows better tracking of history if entire projects
are moved within a repository, but may cause issues on repositories where read access restrictions are in place. Passing
–no-minimize-url will allow git svn to accept URLs as-is without attempting to connect to a higher level directory. This option
is off by default when only one URL/branch is tracked (it would do little good).

Preventing access to drives on Windows 7

I added boot camp to one of my macs and happy found that that Windows 7 supports reading HFS drives. Which means it had access to my Mac OS X installation. Sadly it didn’t keep the user permissions setup and I could see everything from all users. Not acceptable for a family used computer.

So some google searches did bring up some options, however I found that all of them alone don’t resolve the issue completely.

The first thing I found suggested using “gpedit.msc” to add policy in User Configuration -> Administrative Templates -> Windows Components -> Windows Explorer in the “Prevent access to drives from My Computer” policy. However this had two limitations here. First off it applies to the current local user only and secondly it only did drives A-D. Which doesn’t help me with drive E.

Now, I can open “mmc”, go to add a snap in, select Group policy editor, click browse and then the users tab to set it to non administrators. However the secondary limitation was still the problem. I needed to do a non default drive that the group policy editor didn’t support. Which makes it almost useless.

Another solution I found was to modify the windows registry to do this. HKCU\Software\Microsoft\Windows\CurrentVersion\Policies\Explorer may contain a dword called “NoViewOnDrive”. This is perfect for what I want as I can limit it to other drives. A article on how to geek explained how the data was represented. So this works out for me.

However that solution had the same problem as first time where it only the current user. So after more searches not turning up anything useful I found a solution that works. By using the mmc I created above to add a policy for non administrators, it added that data into the registry. I simply used the find function to locate “NoViewOnDrive”. After some searches, I located it.

I do want to mention I did close the mmc I was using and opened the registry editor before. Data may be outdated otherwise and may not update. But it was simple to do this after which as I modified the value to match what I wanted. Now it appears to be working just fine for non administrators and is preventing access to the drive. A little more work than I wish I would of had to do in order to accomplish this, but it got the job done.

There is a similar dword in the registry called NoDrives. This simply hides the drives and does not prevent access to them. I left the drive visible as it really doesn’t bother me to see it. I just needed to prevent its unleashed access to the drive.

Mac OS X deleting users

I had a issue with my laptops video card dieing. None the less thanks to a class action lawsuit and some work by Apple, I have been able to get my video card replaced for free (See: The nicest thing is that this is costing me $0 dollars to fix and ship back to me. Which is awesome and I am glad that Apple took the initiative to investigate the issue and help their customers.

Well while I wait for that to happen, I was smart enough to use Screen Sharing which still worked to pull the logs off my system. Upon trying this I found my user accounts missing. I had the root user enabled so I was able to still get in one way. So after recreating my user for now (I could recreate from a full backup I did just days before this), I put my logs on a thumb drive so I could look at them.

This is a snippet from the logs:

2/12/11 10:12:19 PM[59] 2011-02-12 22:12:19.113 ManagedClient[120:903] -xaDiskDisappeared: removing external account “_amavisd” with home “/var/virusmails” from DSLocal because disk disappeared.
2/12/11 10:12:19 PM[59] 2011-02-12 22:12:19.116 ManagedClient[120:903] MCXCDeleteAccount(): Trying to delete user id = 83

It wasn’t able to delete the system accounts, thankfully. However it did delete my account and a postgresql user account I created. Which I should of setup as a system account in the first place. No damage was done, just the user account deleted. All my data was still there and backed up.

Managed Client is apart of the OS X and is used to manage users in a server setting. That said my system was never setup in a server setting. But if I had to guess from the error log, it appears that when it losses connection to the server with the user account data, it is auto deleting users as a security precaution. Again I don’t have server setup or use this, which means it acted on the local users when it couldn’t load the data. Not a very smart idea of Apple to allow this for the local users though.

User data for the system is kept in /var/db/dslocal, which explains this. I also had a notice about anacron not being able to find its data in /var. So I am suspecting that my /var directory went corrupted during one of the restarts I did trying to diagnose the system.

2/12/11 10:12:09 PM com.18james.anacron[78] anacron: Can’t chdir to /var/spool/anacron: No such file or directory

Luckily I can restore everything lost in there off a backup and didn’t keep anything important in var. So it isn’t a major lose and I am glad I keep backups.  Unfortunately I wasn’t able to find very much information in searching around.  I didn’t feel like reading Apples 294 page PDF about user management to try and see if I could find anything about it.  A search of the document using some simple terms didn’t turn up anything.

As a final note, incase you are wondering, user accounts disappearing is happening to other OS X users, but none of them tried to look at the console log to see why.”mac+os+x”+user+account+disappeared

Removing everything other than .svn

After I updated some code, I was downloading it into my local svn repository and planned to do a svn commit.  I thought I had set my FTP settings correctly to merge folders, but alas I didn’t.  What I ended up with was a broken svn working copy.

So I decided to pull another checkout in another directory.  After doing that, I needed a way to just get the .svn folders and its files out.  The quickest method I could think of would be to use my FTP client (Transmit by Panic) and this time merge the folders together.  I am sure there is a better way but I didn’t have much time to waste searching.

To accomplish this task, I needed all other files removed.  So I wrote a function to do this:


function remove_non_svn($dir)

$files = scandir($dir);

foreach ($files as $file)

if ($file == ‘.’ || $file == ‘..’ || $file == ‘.DS_Store’ || $file == ‘.svn’)


if (is_dir($file) && $file != ‘.svn’)

remove_non_svn($dir . ‘/’ . $file);
rmdir($dir . ‘/’ . $file);



unlink($dir . ‘/’ . $file);



Then I just popped that into a script and told it what folder to execute this on and it went to work.  It quickly did the job and got it all cleaned up.  Then I simply used my FTP client to merge the folders into the working copy.  After that a svn status showed the modified copies and was working.

I should note that doing this is dangerous to your svn working copy and could break things if not done right.  There also may be better methods to restore you working copy to working order.  I just didn’t have much time on my hands to search for it.