I have a script which builds my application, uploads it to a remote machine, runs a performance test there and captures some metrics that I care about. The script creates a patch file for the local modifications I make in my workspace and shows it along with the performance numbers. This helps me compare the effect of various tuning options. If I want to recreate my workspace at a later date, I can use the SVN revision number and the patch.
svn diff
does not report a new files I add to the workspace unless I explicitly use svn add
on them first. Is there some way to create a patch file which will include the new files also?
PS: A similar question was asked here but was not answered adequately, IMO.
To make
svn diff
include all the unversioned files from your local working copy you have to add these files first.svn diff
outputs the same changeset thatsvn commit
would use.If you know for sure that all unversioned files should be added here's what you could do.
Prepare a list of unversioned files by taking from the output of
svn status
all the lines that start with a question mark:You can then pass that list of files to
svn add
usingxargs
:And then produce the patch:
If you don't want to keep those files added, use the list of files to unadd them:
Thanks Alexandre. At first, his approach didn't work in my case. I was sure all new files were maked
A
insvn status
, however, the diff file was still empty. Finally, I found the difference insvn status
outputs, the fourth columns in my case are all populated with+
, like:This means the item is scheduled for
addition-with-history
[1]. This typically happens when yousvn move
orsvn copy
a file or directory[2]. In my case, theNew.java
issvn merged
from another branch, including previous commit history in that branch. Let's removed these history information.First, find all
addition-with-history
items:Optionally, remove directory paths in
/tmp/add_list
to avoid warnings in next step.Next, remove their history commit information by
svn remove
:Then, go back to Alexandre's solution to add them to subversion again and get the diff.
References: