Добавил:
Опубликованный материал нарушает ваши авторские права? Сообщите нам.
Вуз: Предмет: Файл:
Collins-Sussman B.Version control with Subversion 1.1.pdf
Скачиваний:
8
Добавлен:
23.08.2013
Размер:
1.53 Mб
Скачать

Guided Tour

svn revert

Now suppose you see the above diff output, and realize that your changes to README are a mistake; perhaps you accidentally typed that text into the wrong file in your editor.

This is a perfect opportunity to use svn revert.

$ svn revert README Reverted 'README'

Subversion reverts the file to its pre-modified state by overwriting it with the cached “pristine” copy from the .svn area. But also note that svn revert can undo any scheduled operations—for example, you might decide that you don't want to add a new file after all:

$ svn status foo

?foo

$ svn add foo A foo

$ svn revert foo Reverted 'foo'

$ svn status foo

?foo

Note

svn revert ITEM has exactly the same effect as deleting ITEM from your working copy and then running svn update -r BASE ITEM. However, if you're reverting a file, svn revert has one very noticeable differ- ence—it doesn't have to communicate with the repository to restore your file.

Or perhaps you mistakenly removed a file from version control:

$ svn status README README

$ svn delete README D README

$ svn revert README Reverted 'README'

$ svn status README README

Look Ma! No Network!

All three of these commands (svn status, svn diff, and svn revert) can be used without any network access. This makes it easy to manage your changes-in-progress when you are somewhere without a network connection, such as traveling on an airplane, riding a commuter train or hacking on the beach.

Subversion does this by keeping private caches of pristine versions of each versioned file inside of the .svn admin-

30

Соседние файлы в предмете Электротехника