Christoffer
Christoffer

Reputation: 26865

How do I get the latest updated revision via SVN?

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.

Upvotes: 2

Views: 2738

Answers (6)

Rishi
Rishi

Reputation: 6199

Pls check this documentation svnversion

I think you need to use svnversion command with -c option.

--committed (-c) Uses the last-changed revisions rather than the current (i.e., highest locally available) revisions.

Hope this help!

Upvotes: 0

Jason S
Jason S

Reputation: 189856

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.

Upvotes: 5

guerda
guerda

Reputation: 24069

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.

Upvotes: 0

Jeff Paquette
Jeff Paquette

Reputation: 7127

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.

Upvotes: 0

Stefan
Stefan

Reputation: 43575

Use the svnversion command.

$ svnversion
1234

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

Upvotes: 3

JesperE
JesperE

Reputation: 64444

You can use the svnversion program.

Upvotes: 2

Related Questions