Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Check for a subversion update

Tags:

svn

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?

like image 447
Rob Avatar asked Nov 20 '08 13:11

Rob


People also ask

What is svn update command?

The SVN update Command. The svn update command lets you refresh your locally checked out repository with any changes in the repository HEAD on the server. It also tells you what has been changed, added, deleted. If a change has been made to a file you have also changed locally, svn will try to merge those changes.

What is svn checkin?

When a developer has made changes to the code, those changes are not yet in the repository, but remain on his/her own computer (working copy) until they are 'checked in'. By checking in these changes (or committing them) the developer adds their changes to the repository.


2 Answers

Use the show updates option of the status command:

svn status -u

or

svn status --show-updates
like image 63
flolo Avatar answered Sep 29 '22 07:09

flolo


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.

like image 24
jan Avatar answered Sep 29 '22 05:09

jan