Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Adding new files to a subversion repository

Tags:

svn

I have some files on my local Unix machine that need to be added to a Subversion repository (access via HTTPS). How do I do this?

Doing svn commit in the directory just says it's not a working directory.

like image 389
alok Avatar asked Dec 28 '10 06:12

alok


People also ask

How do I add a folder to svn repository?

Right Click the new repo and choose SVN Repo Browser. Right click 'trunk' Choose ADD Folder... and point to your folder structure of your project in development. Click OK and SVN will ADD your folder structure in.

Can multiple files be added in svn?

Edit These files exist in a directory tree so adding * for one directory will not work. @your edit: So then provide multiple paths to add like: svn add dir1/* dir2/* dir3/* or as many have mentioned grep the ouput of svn stat from the root and pipe it to cut or awk and then to add.

How do I add a project to an existing repository in svn?

To import a project into the repository, right click the project you want to import and select Team > Share Project... from the context menu. This will begin the Share Project wizard. Select SVN as the repository type and click Next.


2 Answers

  • Checkout a working copy of the repository (or at least the subdirectory that you want to add the files to): svn checkout https://example.org/path/to/repo/bleh
  • Copy the files over there.
  • svn add file1 file2...
  • svn commit

I am not aware of a quicker option.

Note: if you are on the same machine as your Subversion repository, the URL can use the file: specifier with a path in place of https: in the svn checkout command. For example svn checkout file:///path/to/repo/bleh.

PS. as pointed out in the comments and other answers, you can use something like svn import . <URL> if you want to recursively import everything in the current directory. With this option, however, you can't skip over some of the files; it's all or nothing.

like image 71
Jan Krüger Avatar answered Sep 23 '22 08:09

Jan Krüger


Probably svn import would be the best option around. Check out Getting Data into Your Repository (in Version Control with Subversion, For Subversion).

The svn import command is a quick way to copy an unversioned tree of files into a repository, creating intermediate directories as necessary. svn import doesn't require a working copy, and your files are immediately committed to the repository. You typically use this when you have an existing tree of files that you want to begin tracking in your Subversion repository. For example:

$ svn import /path/to/mytree \              http://svn.example.com/svn/repo/some/project \              -m "Initial import" Adding         mytree/foo.c Adding         mytree/bar.c Adding         mytree/subdir Adding         mytree/subdir/quux.h  Committed revision 1. $ 

The previous example copied the contents of the local directory mytree into the directory some/project in the repository. Note that you didn't have to create that new directory first—svn import does that for you. Immediately after the commit, you can see your data in the repository:

$ svn list http://svn.example.com/svn/repo/some/project bar.c foo.c subdir/ $ 

Note that after the import is finished, the original local directory is not converted into a working copy. To begin working on that data in a versioned fashion, you still need to create a fresh working copy of that tree.

Note: if you are on the same machine as the Subversion repository you can use the file:// specifier with a path rather than the https:// with a URL specifier.

like image 21
Version Control Buddy Avatar answered Sep 22 '22 08:09

Version Control Buddy