Rob
Rob

Reputation: 78648

Check for a subversion update

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?

Upvotes: 14

Views: 12678

Answers (2)

jan
jan

Reputation: 2830

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.

Upvotes: 5

flolo
flolo

Reputation: 15486

Use the show updates option of the status command:

svn status -u

or

svn status --show-updates

Upvotes: 22

Related Questions