9

I tried using svn ci dir/a dir/b -m "my comment" but this doesn't work. I also used svn ci dir/a/* dir/b/* -m "my comment" and it too doesn't work.

I know you can specify multiple files, but how can I tell subversion to check in all modified files in these folders? I mainly want to do this so that all my changes get in on one revision. I can checkin one directory at a time, but this ends up giving me different revisions for each directory..

  • so there are are many other modified files in say dir/c that you don't want commited? – dotjoe May 18 '09 at 18:04
  • There are many modified files in the directories that I do want to check in. I know svn commit will only checkin files that I modified, which is what I want. I'm not worried about files I don't want commited, if that answers your question.. –  May 18 '09 at 19:14

9 Answers9

10

You may need to specify what does "but this doesn't work" mean because it works fine here:

D:\Projects>svn commit -m 'test1' test\aaa "test\aaa bbb ccc"
Sending        test\aaa\aaa222\xxx.txt
Sending        test\aaa bbb ccc\aaa.txt
Transmitting file data ..
Committed revision 8.

D:\Projects>
Milen A. Radev
  • 60,241
  • 22
  • 105
  • 110
  • I wonder if they are separate working copies? Would that fail? – crashmstr May 18 '09 at 18:42
  • Yes, it will fail. OTOH we don't know the layout of the OP's working copies, so it may or may not be the the reason why it "doesn't work". – Milen A. Radev May 18 '09 at 18:54
  • C:\zoo>svn ci c:\zoo\tiger c:\zoo\lion -m "my comment" svn: 'C:\zoo' is not a working copy this is the error I get. It will work if I just pass it one directory, but when I give it a second directory it errors out. –  May 18 '09 at 19:11
  • see my update re: sparse directories. You can have a working copy that only has the projects you are concerned about, and it would make it easy to commit changes to both at the same time. – crashmstr May 18 '09 at 19:23
4
svn add dir/a
svn add dir/b
svn commit

Though, more likely, you're thinking:

svn add dir/*
svn commit
Jeff Ferland
  • 17,832
  • 7
  • 46
  • 76
1

You can use --changelist option, on top directory create one changelist with all files you want to commit, after, commit that changelist.

source and info: svn book: changelist

Jaziel_Inc
  • 82
  • 2
  • 9
1

I think you only have 1 option: check in the containing directory - the one that has both these as subdirs.

If they're not organised like that already (ie they're both top-level directories in the repo), then there's not a lot you can do - the svn commands work on a single directory only.

gbjbaanb
  • 51,617
  • 12
  • 104
  • 148
  • They both share a common top level directory but that directory is rather...huge, with many other child folders. –  May 18 '09 at 17:32
  • fair enough, that just means that svn will take longer to search through them to find all files that need committing. If none do, then its surprisingly quick. Try it using svn status to see (status will take longer than ci BTW) – gbjbaanb May 18 '09 at 17:46
  • svn commit will work on multiple directories, but only if they are all in the same working copy. If there is stuff you don't want, you can use subversion 1.5's sparse directories to make a smaller, more concise working copy. – crashmstr May 26 '09 at 13:16
0

A encountered similar problem. I had one repository and I needed to have two separate working copies of some of the repoeitory's subfolders. Repository was like this:

/web/lib
/web/htdocs
...

... which I needed to have in separate working copies (respectively):

C:/.../web/lib
C:/.../htdocs/cbs

I solved this by having a "master" working copy of /web in C:/.../web and creating a hardlink (or NTFS junction) in C:/.../htdocs/cbs "pointing" to C:/.../web/htdocs. So whenever I make local changes in one of those working copies, I always commit the C:/.../web, which naturally contains changes from both working copies.

I hope this way may be useful for You.

Roman Hocke
  • 4,137
  • 1
  • 20
  • 34
0

It has been a long time since this question was asked, but I have an update for any late arrivals.

Assuming you have a tree like dir/a, dir/b, dir/c, dir/d.... and want to commit changes only in subfolders a and b, the following command works:

svn ci dir/a/* dir/b/* -m "my comment"

If this truly didn't work when you tried it seven years ago, I can only assume that this feature was added in subsequent releases.

TychaBrahe
  • 51
  • 4
0

Considering the below is the query

  1. you have lot of files checked out from the repository into multiple directories and many of them got modified and you do not remember which files got modified and you it will be difficult to merge one file at a time, then do the following

go to the top-level directory and run the command

svn ci -m "comments"

this will check-in all the modified files under the top-level directory and many subdirectories below it.

René Höhle
  • 26,716
  • 22
  • 73
  • 82
0

This is easy if you check-out from a higher level folder for where a and b are. So if your working copy is "dir" and a and b have changes, commit "dir" to commit changes to both. I do this all of the time.

Edit:
To commit more than one folder, you will need for them to be in the same working copy.

If you are worried about having too much to process, you could try a sparse checkout with only the folders you need, and then you could just commit the base directory or the subdirectories as needed without the overhead of the other projects.

Sparse Directories Information

crashmstr
  • 28,043
  • 9
  • 61
  • 79
0

Consider using svn:externals property for checking out part of the repository. You can pick and choose which directories to get, then commit to multiple destinations in a single step. We've been using this approach for a while with great success.

GregC
  • 7,737
  • 2
  • 53
  • 67
  • I'd strongly suggest looking at sparse directories in SVN now, if you're using Tortoise, then its as simple as you can get - its great. – gbjbaanb May 24 '09 at 15:28