I doubted that weather the command I run svn info
on my machine, hits/requests my svn server? Or it just finds the ServerRevision & local revision locallly?
Here is the output of svn info for reference:
Path: ....
URL: https://....
Repository Root: https://...
Repository UUID: ....
Revision: 1787
Node Kind: directory
Schedule: normal
Last Changed Author: ....
Last Changed Rev: 1785
Last Changed Date: 2015-01-06 07:44:21 -0600 (Tue, 06 Jan 2015)
How does 1787 came in here? If they send a request to my server, will it request every time I run the command? Or it sends request only when necessary?
The last revision is stored locally in your local svn repository cache. There is no request sent to the server when you run svn info
. The revision is downloaded when you run svn update
. Therefore, it may not be up-to-date.
If we turn off the network, svn info
still works. Observe:
dionyziz@erdos ~/valgrind % ping google.com
ping: cannot resolve google.com: Unknown host
dionyziz@erdos ~/valgrind % svn info|grep Rev
Revision: 14853
Last Changed Rev: 14853
dionyziz@erdos ~/valgrind % svn update
Updating '.':
svn: E670008: Unable to connect to a repository at URL 'svn://svn.valgrind.org/valgrind/trunk'
svn: E670008: Unknown hostname 'svn.valgrind.org'
As you can see, svn info
works without a network connection, but svn update
doesn't. This indicates that the data is cached locally.
Indeed, let's take a look at SVN's meta directory .svn
. This contains a SQLite database which contains all the information you need to extract the most recent revision:
dionyziz@erdos ~/valgrind/.svn % sqlite3 wc.db
SQLite version 3.8.5 2014-08-15 22:37:57
sqlite> SELECT revision FROM nodes ORDER BY revision DESC LIMIT 1;
14853