1

I want to commit the .svn folder, of each code folder, to the Hg repository. The problem is that many .svn subfolders are empty and, because of that, can't be committed to the mercurial repository.

One solution I found is to add an empty file to each of those folders, but this is cumbersome. Isn't there an easier way?

5
  • 2
    Why do you need the .svn folder under source control? Commented Jan 26, 2011 at 15:10
  • @jgifford We have to commit to the SVN repository eventually, but we use Mercurial daily Commented Jan 26, 2011 at 15:13
  • 2
    @Jader, we're in a similar situation as you as we have to use CVS by corporate standards, but are using Git for our sanity. We don't check in the CVS folders. We work in our git repo/directory and periodically do code pulls into a cloned local repository/directory that contains our CVS checkout. We then commit to CVS from that CVS checkout folder. Commented Jan 26, 2011 at 15:18
  • 4
    Just note that the files in the .svn folders are not possible to merge. Parallel commits to the Subversion repository will fail. Are you sure this is how you want to do it? Commented Jan 26, 2011 at 15:46
  • @Yads it worked. I will have to click more but that's the only way Commented Jan 26, 2011 at 16:45

2 Answers 2

4

You need to add an empty file for each. You could do that quickly with:

for thedir in $(find /path/to/repo -type -d -name .svn) ; do touch $thedir/emptyfile hg add $thedir/emptyfile done 
Sign up to request clarification or add additional context in comments.

2 Comments

great script! maybe someone could write one for windows as well
I think windows scripts are called interns. ;)
2

When you want to use hg on top of a svn repo, you can try the hgsubversion extension. Hgsubversion gives mercurial the ability to talk to svn servers like a svn client.

OTOH if you insist to have .svn folders everywhere, you can use hgsvn to manage your parallel hg and svn repo checkout. But hgsvn has the drawback that it does no automatic rebase for stuff which gets back into svn, so when you have had to merge (in terms of a mercurial merge) the svn history with your local history, you can't export every local commit, only the merge commit (there is the way to export every commit even when there is a merge, but the first local commit will undo the recent svn history, and the merge commit will redo it, which causes a defect svn history).

More about different svn<->hg workflows are on the WorkingWithSubversion wiki page.

1 Comment

I couldn't use hgsubversion since my SVN repository requires that (pre-commit hook) every new file should have the svn:needs-lock property

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.