tags:

views:

39

answers:

2

I usually check in a file at a particular location in my svn repo.

what svn command i can use to find the last checked in file? I always check in only one file

A: 

svn log.

(But I suggest taking advantage of committing multiple files at once, with atomic commits.)

You can use the -l option to limit the log entries to 1.

In fact, I would recommend viewing svn help log and then choosing the options best for you, and then making an alias in your shell for your own frequent use.

To get the path of the last changed file, along with basic revision information, use

svn log -l1 -qv

(The -qv is for quiet and verbose. They actually do different things, even though they sound contradictory.)

The output will look like

------------------------------------------------------------------------
r123 | JXG | 2010-03-03 11:23:47 +0000 (Wed, 03 Mar 2010)
Changed paths:
   M /foo/bar/baz/qux.c
------------------------------------------------------------------------

If you absolutely, positively must have only the filename, you can run the output through grep, awk, basename, or whatever tools you enjoy.

JXG
The OP wanted to know the path that was last commited, hence you need at least -v and it doesn't make sense to assume "filename".
p00ya
@p00ya -- you're right, except it was the name, not the path.
JXG
+1  A: 

You probably want something like this:

svn log <repository> -l 1 -v
Patrick
this gives me the log added while commiting the file. I just want the file name
Vik
Run the result of the svn log command through find or grep to extract the filename, e.g: SVN LOG http://myserver/myrepo -l 1 -v | findstr ".cpp" (I'm sure there are other commands that are better suited to get the filename from the output, but basically you need the SVN command shown above).
Patrick