How can I do a single SVN commit across multiple e

2020-03-01 03:47发布

问题:

This may be impossible, but I'm going to ask anyway.

Without going into the details of why it's like this, I have two primary checkouts that I work in, one for the production release branch, and one for trunk. Each of them is a small collection of svn:externals references to sub-projects, with no direct content under the checked-out svn directory.

That is, the four svn:externals directives add all of the content in each of the checkout directories.

When I do a commit via Eclipse(/Subclipse) I can commit changes across all of the external projects in one go, which is good because they're just separate sub-projects in the same repository and this allows me to avoid doing 4 separate commits in a row to the same repo.

Is it not possible to do the same thing from the command line? Commits for each of the externals could certainly be scripted and aliased to one command, but I'd rather avoid cluttering the commit log with separate commits for related changes if possible.

回答1:

Unfortunately, your assumption was correct. The current subversion command line tool will not recurse into disjointed externals working copies during a commit. Eclipse probably figures out that it's all rooted the same and adjusts everything so that it's only doing a single commit transaction.

This drawback of the client is actually listed as one of the issues to watch out for when defining externals in your project. As of the 1.6.1 client, this limitation still exists.



回答2:

You can specify all files and folders you want to commit in the command line client, including the externals. Since the CL doesn't recurse into externals, you have to specify those in your commit command separately:

svn ci working_copy externals1 externals2 -m "log message"

Haven't tried this though. If it doesn't work, you have to specify all the modified files and folders separately, not just the 'root' folders of the externals.



回答3:

With the latest SVN you can do: --include-externals



回答4:

If you only have content and no attribute modifications, you can do something along:

svn st | egrep "^M" | awk '{print $2}' | xargs svn ci -m 'your message'

If you have added/deleted, ... files, you might modify the egrep regex to fit your needs.



回答5:

I iterate over all externals, and execute "svn commit" on each, such as:

for dir in $(svn propget svn:externals . | awk '{print $2}'); do svn commit $dir; done


回答6:

You can do:

svn ci -m"my comment" *


标签: svn