82

Note: This is probably a no-brainer for experienced SVN users, but it stumped me for quite a while...so here's hoping this will help someone like me!

After issuing svn log from the command line, I noticed that several recent commit messages were missing. I knew that these messages were correctly saved in my repository because they were showing up in my SVN client (RapidSVN). I just couldn't figure out why they wouldn't be visible using the command line version of svn.

Answer below...

4 Answers 4

127

The problem had to do with my poor understanding of what svn log was showing. With no other arguments supplied, it outputs log messages from the working copy of the log, not from the actual repository. Thus, issuing svn update will bring the working copy up-to-date with the repository, and then svn log will reflect all recent commits. Duh! ;-)

6
  • 7
    Shouldn't svn commit run svn update as well after successful commit? Jan 29, 2014 at 6:07
  • 7
    Some client programs may actually do this, but the actual "svn commit" command does not (per my understanding). This is according to the "Red Bean" user manual (svnbook.red-bean.com/en/1.7/svn.basic.in-action.html): "One of the fundamental rules of Subversion is that a “push” action does not cause a “pull” nor vice versa. Just because you're ready to submit new changes to the repository doesn't mean you're ready to receive changes from other people." The rest of the paragraph explains in more detail why "svn commit" and "svn update" are separate. Jan 30, 2014 at 14:22
  • Revision Number is for the entire SVN repository. Assume there are multiple branches in your repository. show log only shows the revisions of the branch that your working copy is based on but not revisions of the trunk and the remaining branches. I can vouch for this on TortoiseSVN client :)
    – Rakesh N
    Oct 4, 2015 at 16:08
  • Something that makes this tricky/weird is that, at least for my installation (and repository), svn log requires my password. So then I assumed that it needs to hit the server in order to get the most recent log. If it didn't prompt for my password I would more readily assume that it was using my working copy's log. Feb 19, 2016 at 12:31
  • 1
    This is even more confusing because "git log" shows the commits of your local working copy. Jan 16, 2018 at 9:23
21

If you would like to see the full log without updating (as I sometimes do when working on an old revision) you can run:

svn log -r HEAD:0

Or, for easier viewing:

svn log -r HEAD:0 | less
3

I hit the same issue today and was horrified thinking I lost my changes.

It happens just because of weirdness of subversion. There is a concept of working copy that is set to the revision that was checked out originally. Working copy revision is not changed by new commits. svn update is required to update/sync working copy revision to the repository. Not sure I would like to do that in every scenario.

PS: git is so much better.

2
  • ahh... but svn doesn't require a push. The two systems use different conceptual structures. svn has certain advantages depending on the type of data you are managing. They are more about being different than better or worse Apr 8, 2022 at 3:15
  • jefferey-cave.medium.com/… Apr 15, 2022 at 18:35
1

You can also explicitly tell svn log to go to the server by specifying the URL of the repository.

e.g.

svn log svn://your-server/trunk

Or more generally and succinctly:

svn log ^/

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.