c0dem4gnetic
c0dem4gnetic

Reputation: 942

Selective revert on locally modified files

When reverting files that have been modified locally, is there a way to exclude files? Due to circumstances beyond my control, my current workflow is to:

  1. Create a diff of files I want to include
  2. svn status to get a list of modifications
  3. svn revert, copypasting the files that were included in the diff
  4. rm'ing leftovers - i.e. added files not under version control

What I'm after would look something like

svn revert -R --exclude file1 --exclude file2 /my/path

Upvotes: 3

Views: 4667

Answers (2)

aaz
aaz

Reputation: 5196

Using changelists.

Tag all files as to_revert:
$ svn changelist to_revert -R /my/path

Untag some files:
$ svn changelist --remove file1 file2

Revert only tagged files:
$ svn revert --changelist to_revert -R /my/path

Upvotes: 4

aaz
aaz

Reputation: 5196

Use find to do the matching.

find . -name .svn -prune -o -name file1 -o -name file2 -o -print0 |
    xargs -0 svn revert --
  • -name file1 excludes by file name in any subdirectory,
  • -path ./src/file1 excludes by specific path,
  • -path ./src/dir1 -prune excludes an entire directory.

Upvotes: 0

Related Questions