Learn how to know which files will be modified in your working copy with the SVN cli.

Sometimes, due to wrong commits, a feeling of security before updating a project in production from a SVN repository, you will need or want to see which files or directories will be commited, updated etc before issuing your update, this in order to verify if you need to make backup of some files with sensitive information in your server.

In this article, we'll share with you 2 ways to list which files will be updated if you execute svn update without actually updating your working copy.

A. Show update status

To list the files that will be added, updated or deleted from the working copy after executing the svn update command, you can use the svn status command with the --show-updates flag:

svn status --show-updates

Or with a short syntax:

REM First short syntax
svn status -u

REM Or even shorter
svn st -u

This command will provide a list of files in the cli with some symbols and revision when available, like the following output:

SVN Show files that will be updated on working copy

Where the first column, where the symbol is indicates that an item was added, deleted, or otherwise changed with the following symbols:

  • ' ' - Means that were no modifications.
  • 'A' Item is scheduled for addition.
  • 'D' - Item is scheduled for deletion.
  • 'M' - Item has been modified.
  • 'R' - Item has been replaced in your working copy. This means the file was scheduled for deletion, and then a new file with the same name was scheduled for addition in its place.
  • 'C' - The contents (as opposed to the properties) of the item conflict with updates received from the repository.
  • 'X' - Item is present because of an externals definition.
  • 'I' - Item is being ignored (e.g., with the svn:ignore property).
  • '?' - Item is not under version control.
  • '!' - Item is missing (e.g., you moved or deleted it without using svn). This also indicates that a directory is incomplete (a checkout or update was interrupted).
  • '~' - Item is versioned as one kind of object (file, directory, link), but has been replaced by a different kind of object.

The second column tells the status of a file's or directory's properties:

  • ' ' - No modifications.
  • 'M' - Properties for this item have been modified.
  • 'C' - Properties for this item are in conflict with property updates received from the repository.

The third column is populated only if the working copy directory is locked :

  • ' ' - Item is not locked.
  • 'L' - Item is locked.

The fourth column is populated only if the item is scheduled for addition-with-history:

  • ' ' - No history scheduled with commit.
  • '+' - History scheduled with commit.

The fifth column is populated only if the item is switched relative to its parent:

  • ' ' - Item is a child of its parent directory.
  • 'S' - Item is switched.

The sixth column is populated with lock information:

  • ' ' - When --show-updates (-u) is used, this means the file is not locked. If --show-updates (-u) is not used, this merely means that the file is not locked in this working copy.
  • 'K' - File is locked in this working copy.
  • 'O' - File is locked either by another user or in another working copy. This appears only when --show-updates (-u) is used.
  • 'T' - File was locked in this working copy, but the lock has been “stolen” and is invalid. The file is currently locked in the repository. This appears only when --show-updates (-u) is used.
  • 'B' - File was locked in this working copy, but the lock has been “broken” and is invalid. The file is no longer locked. This appears only when --show-updates (-u) is used.

The seventh column is populated only if the item is the victim of a tree conflict:

  • ' ' - Item is not the victim of a tree conflict.
  • 'C' - Item is the victim of a tree conflict.

The eighth column is always blank.The out-of-date information appears in the ninth column (only if you pass the --show-updates (-u) option):

  • ' ' - The item in your working copy is up to date.
  • '*' - A newer revision of the item exists on the server.

B. Merge with dry run

Alternatively, if your working doesn't have missing subtrees, you will be able to list the files that will be added, removed or updated with the following command:

svn merge --dry-run -r BASE:HEAD .

This method won't list a detailed description about the files, but a list with the files and a short description about what will happen with the item.

Happy coding !


Senior Software Engineer at Software Medico. Interested in programming since he was 14 years old, Carlos is a self-taught programmer and founder and author of most of the articles at Our Code World.

Sponsors