Subversion pissing me off

xsawyerx on 2009-06-01T11:34:54

While working on a project, I realized I wanted to add some code that parts of it existed in a file I deleted along with other deprecated old files. It would shorten my work to copy/paste (or at least view) some of the code I had in that old file.

$ svn log -v
This command showed me very nicely a lot of commit messages, but.. something is off.
  • I definitely committed more than that!
  • I can't see the file I'm looking for
  • I find the file, it shows commits on it but not a delete.

I try this instead:

$ svn log -v | perl -nle'/\s+D\w/ && print'

Nothing. Since I don't know when I have finished committing changes to it, I don't know which revision of it I should get. I'm beginning to dislike subversion...

In Git, by the way:

$ git --no-pager log --name-status | perl -nle'/^D\s+/ && print'

You may say

"this is pretty long"
or
"see? that's complex"
but:

  • it's not really long, quit fscking complaing
  • it took me less than 10 seconds to figure it out, with subversion I'm still stuck
  • THIS WORKS!


svn log is alright

perrin on 2009-06-01T17:22:34

Sorry, but svn log -v works. You're either not looking at the code or you didn't commit a delete on the file.

Re:svn log is alright

xsawyerx on 2009-06-02T08:11:03

Even though Shlomi Fish grilled me for about half an hour on what I did and how I did it to find the missing file, I will show it here as well anyway, because "Seeing is believing".

xsawyerx@gnubuntu:~/code/admin/My-App$ svn status
?      output_log.txt
M      Changes

xsawyerx@gnubuntu:~/code/admin/My-App$ svn log -v | grep 10-eg_server.t -B 6
------------------------------------------------------------------------
r12 529 | yaronm | 2009-04-12 18:34:49 +0300 (Sun, 12 Apr 2009) | 1 line
Changed paths:
   A /admin/devel
   A /admin/devel/My-App
   A /admin/devel/My-App/.cvsignore
   A /admin/devel/My-App/10-eg_server.t

xsawyerx@gnubuntu:~/code/admin/My-App$ svn log -v -r 13831
------------------------------------------------------------------------
r13831 | yaronm | 2009-05-25 18:50:13 +0300 (Mon, 25 May 2009) | 1 line
Changed paths:
   D /admin/devel/My-App/10-eg_server.t
   D /admin/devel/My-App/configure_server_service.pl

removing deprecated helper scripts
----------------------------------------------------------------------- -

As you can see, svn status shows that I have one changed file (Changes) and one untracked file (output_log.txt), so I have no uncommitted deletions or additions.

When I search svn log for a file called 10-eg_server.t, I can only see that it was added, along with the actual path.

However, when I ask for the log of a specific revision (r13831), I can see the deletion of the file 10-eg_server.t, along with another file. The problem here is that svn log -v will return only certain things without any persistency (it will show changes as well as additions and deletions but this time it only showed the addition of the file, not deletion), and return other things when asking for the log of a specific revision.

So, subversion is stupid.

But thank you for automatically assuming Subversion is impeccable, and I was wrong.

Re:svn log is alright

perrin on 2009-06-02T15:40:39

I wasn't trying to be insulting. It's only reasonable to look for user mistakes or misunderstanding before assuming that a behavior in a widely used piece of software is a bug. Think of how many times people have reported they found a bug in Perl and how many times they actually had.

I suspect there's an answer for this one involving either how the paths under CWD are figured or which revisions are shown when no number is specified. If you actually want to solve it, I suspect you'd be better off asking on the svn list.

try specifying the URL

oliver on 2009-06-01T21:34:23

svn log is brain-dead and will display more/different information for the URL than the working copy path (the command's default). So try using the URL at the end of the command.

Re:try specifying the URL

xsawyerx on 2009-06-02T07:37:48

I did.

But thank you anyway.

Pay attention to your cwd

revdiablo on 2009-06-01T22:14:31

I'm guessing git is like mercurial, in that it shows you the commit log for the entire repo no matter what your cwd. Subversion, on the other hand, only shows you the commit log for any paths at your cwd or deeper. If you cd into the root of your repo's trunk, svn log may list more of your commits.

--no-pager not needed

srezic on 2009-06-03T21:35:13

Maybe the 'less' command is still fired, but it does the right thing if it's in the middle of a pipe.