Reputation: 2330
Giving an example to explain the problem.
I made some changes in source files e.g: in folders:
project/foo/src
project/fun/src
.
.
The diff can be viewed as:
# svn diff -r 2000:2001 <svn url>
Then I made some changes in unit tests for the project, in folders:
project/foo/tst
project/fun/tst
.
.
The diff for these particular changes can be viewed as:
# svn diff -r 2001:2002 <svn url>
Later, I found some mistakes in source code, and made some changes in project/foo/src. The diff for these particular changes can be viewed as:
# svn diff -r 2002:2003 <svn url>
Now, I need a single svn diff command to view the changes in source code alone (excluding unit test changes).
I could not find a single command to view non-consecutive changes (i.e 2000-2001, and 2002-2003). Is this possible some how (Note: I know with 2 separate diff command it is possible, I am trying to find out whether it is possible with a single command).
Or else, is it possible to give regular expression in svn url in the command. i.e Something like:
# svn diff -r 2000:2001 <svn url pattern>
//where 'pattern' lists folders that does not contain 'tst' in name.
Upvotes: 2
Views: 397
Reputation: 19612
With Subversion 1.7 (and later) you can do a
svn log --diff -r 2000:2003 project/foo/src
Which will give you individual diffs of all revisions that apply to src. (But also of other targets that are changed in the same revision)
Upvotes: 0
Reputation: 2330
I got the answer. :)
You can create changelist for this.
More details at: http://svnbook.red-bean.com/en/1.5/svn.advanced.changelists.html
So I can create a changelist for source code changes, and another changelist for unit test changes.
There is a drawback, that it can be used only on the working copy.
Changelists are artifacts of a particular working copy, which means that changelist assignments cannot be propagated to the repository or otherwise shared with other users.
Upvotes: 0
Reputation: 12266
I don't think you can do that with one call to svn. (What's wrong with making two calls? It is more straightforward than trying to hack something together.)
I used grep when I needed to use a wildcard. Giving
svn diff -r 2000:2001 <svn url pattern> | grep -v 'test'
Upvotes: 1
Reputation: 189387
For your use case, perhaps it would be better to slice it per file path. It will still be multiple commands, but you get the minimal cumulative diff if you have made updates in the interim versions.
svn diff -r2000:2003 project/foo/src
svn diff -r2000:2003 project/fun/src
If there is a large number of paths, this may be getting too cumbersome. For a one-off job, you could import the history to a DVCS such as Git, and use its rebase facility (or equivalent) to rewrite history so you get the diff you want to distribute.
Upvotes: 0