tags:

views:

108

answers:

5

Hi, Just a quick question I haven't found an answer for by searching...

How do I get the current checked out revision number from my SVN-dir?

More clearly: I don't want the latest revision number since that can be my own commit, but the revision number of the latest update I made in my local repo.

Or, if that is easier, I want to be able to retrieve a list of all files that have been committed to the repo since my last update, preferably without the files I have committed myself since then.

Cheers.

+1  A: 

You can use the svnversion program.

JesperE
A: 
svn info <your local WC>

Any additional info:

C:\>svn help info
info: Display information about a local or remote item.
usage: info [TARGET[@REV]...]

  Print information about each TARGET (default: '.')
  TARGET may be either a working-copy path or URL.  If specified, REV
  determines in which revision the target is first looked up.

Valid options:
  -r [--revision] ARG      : ARG (some commands also take ARG1:ARG2 range)
                             A revision argument can be one of:
                                NUMBER       revision number
                                '{' DATE '}' revision at start of the date
                                'HEAD'       latest in repository
                                'BASE'       base rev of item's working copy
                                'COMMITTED'  last commit at or before BASE
                                'PREV'       revision just before COMMITTED
  -R [--recursive]         : descend recursively, same as --depth=infinity
  --depth ARG              : limit operation by depth ARG ('empty', 'files',
                            'immediates', or 'infinity')
  --targets ARG            : pass contents of file ARG as additional args
  --incremental            : give output suitable for concatenation
  --xml                    : output in XML
  --changelist ARG         : operate only on members of changelist ARG
                             [aliases: --cl]

Global options:
  --username ARG           : specify a username ARG
  --password ARG           : specify a password ARG
  --no-auth-cache          : do not cache authentication tokens
  --non-interactive        : do no interactive prompting
  --config-dir ARG         : read user configuration files from directory ARG

To the second part of your question:
You can use svn diff -r BASE:HEAD. BASE describes your current revision, HEAD the latest in the repository.

furtelwart
+2  A: 

Use the svnversion command.

$ svnversion
1234

would mean that 1234 is the highest revision your working copy was updated to.

Stefan
+3  A: 

svnversion displays a range of numbers

> svnversion
2:3

The first number is the last updated / checked-out version. The second number is the last checked-in version. If they are the same, you'll only see one number.

edit: be aware that if you are doing complicated checkin/checkout/merges, different parts of your working copy may be at different revisions, and svnversion will tell you the range of revision numbers. see the svnversion documentation.

Jason S
Thank you, that's what I wanted to know :)
Christoffer
thanks for asking -- I figured it out by messing around, wasn't aware of this feature until I tried it.
Jason S
A: 

If you want to know what's changed in the repo that's not in your working copy you're looking for the -u switch to the svn status command:

svn status -u

It will show you what would happen if you did an svn up, but without actually performing the update.

Jeff Paquette
No -- the OP is looking for the version number of the last updated version. svn status -u compares against the last checked-in version which may be greater than the last updated version.
Jason S
Ugh. That's what happens when I switch to decaf!
Jeff Paquette