I am putting together a build system and wanted to know if there is a reliable way to find out if a checked out SVN folder needs updating (i.e. is it out of sync with the repository). I want to avoid a nightly build unless something has changed. I could write a script that parses the results of the svn update
command I guess, but I wondered if there as a command that would tell me if an update is actually required?
Asked
Active
Viewed 1.2k times
14

Rob
- 76,700
- 56
- 158
- 197
2 Answers
22
-
3i would suggest -q to skip junk files – Peter Miehle Nov 20 '08 at 13:31
5
The answer of flolo does not work good for subversion externals (which is also discussed in Don't show svn:externals in svn status). A better solution if you only need the information that the current folder needs a update (not exactly which files itself), this solution is better:
cd somedir;
svn info -r HEAD | grep -i "Last Changed Rev"
Last Changed Rev: 8544
svn info | grep -i "Last Changed Rev"
Last Changed Rev: 8531
If these numbers are not the same, an update is needed.
-
“The answer of Rob does not work good for subversion externals.” This seems to be not true anymore (tested with SVN 1.8.8). However, _your_ solution does not work for externals (unless being run on each external). – Melebius Mar 16 '17 at 09:17
-
@Melebius: I don't have a SVN repository here anymore at all, i.e. cannot test what you mean. Do you mean that if svn externals are included in `somedir` and they have changes, that my solution does not show different numbers leading to the assumption that no update is needed? If that is the case and SVN 1.8.8 does not print unnecessary informations for externals, I would also use that original solution again (untested). – jan Mar 16 '17 at 12:31
-
Yes, your solution does not show different numbers for the working copy root. The revision number is only meaningful inside a single repository and a single `svn info` call cannot mix the _Last Changed Rev_’s for different repositories which can be brought in by externals. – Melebius Mar 16 '17 at 14:34