On Apr 3, 2009, at 7:32 AM, Robert Kosara wrote:

On Fri, Apr 3, 2009 at 10:23 AM, Ray <raimondi...@gmail.com> wrote:


On Thu, Apr 2, 2009 at 3:58 PM, Robert Kosara <rkos...@gmail.com> wrote:

I can import it into the repository and then check it out again, but isn't
there a more direct way of doing this?

Another thing you can do is create an empty directory in the repository where you want the local files to reside, and then checkout that empty directory into the same directory as the unversioned files. Then add everything there, and commit. It is essentially importing and checking out except in reverse. Unfortunately, the last time I checked, Versions does not support checking out an empty directory on a pre-existant directory, so you have to do it from the command line.

cd path/to/wc
svn co reposerver/repo/path/to/empty/dir .
svn add *
svn ci -m "Import and checkout in one go"

-Ray


That's a good trick, thanks! Still feels like a work-around though, this should be more straight-forward, IMHO.

It all depends on your point of view. For someone used to DVCS, you could call it a workaround and say it should be more straightforward. In Subversion, that's just the way it is. When you use a centralized repository, there has to be some overhead to create it to begin with. One could argue that this should be streamlined within Subversion client tools, but I'd be inclined to disagree. I think most SVN users are more likely to use a remote repository than a local one, and creating a repo on a remote machine requires additional setup with Apache or svnserve, anyway. Even locally, depending on where you want to put it and the permissions you want to apply to it, it can be somewhat of a hairy mess.

I think a reasonable compromise would be a user-contributed "svninit" script that accepts a file path for where the local repository should go, create the repository if it doesn't yet exist, check out a working copy, create trunk/branches/tags, then move the contents of the current directory to trunk and add the files. (It should also make sure the supplied path is not the current working directory or any of its children, for obvious reasons.) After running the script, there would be a local repository, and the files would be ready to commit. (If the repo was newly-created, this would include adding trunk/ branches/tags too, all at revision 1.)

I don't have time to whip out such a script right now, but the path matching parts lead me to think that Python or Perl would be better than a raw Bash script. (Both languages have SVN bindings, so it should be pretty efficient overall.) Perhaps someone else on the list has the time, expertise, and interest to come up with something like this? I personally wouldn't use it very often, but it would help somewhat to ease the suffering of people who come (back) to SVN from git/hg/bzr, whether by choice or necessity. :-)

 - Quinn

Attachment: smime.p7s
Description: S/MIME cryptographic signature

Reply via email to