SVN rolls back to previous version of Shell script

Source: Internet
Author: User
Tags diff log log svn update

#!/bin/SH###############################        -- -- the# # author Jackluo # # email [email protected] ############################## #version_list=$ (SVN log--limit2|sed '1d'|sed '$d'|awk-F'|' '{print $}'|awk-V rs="" '{gsub ("\ n", "");p Rint}') #找出最近的版本, and formatEcho 'verions finding ....'Echo$version _list #版本号 The last two rocback_version=$ (SVN log--limit2|TAC|sed-N 4p|awk '{print $}') #要回滚的前一个版本号Echo-E"\ r \ n"Echo 'Version number that want'Echo-E"\ r \ n"Echo$rocback _version #版本号Echo-E"\ r \ n"Echo 'Is you sure of'$rocback _version'Yes or No' #确定要回滚过去Echo-E"\ r \ n"Read Answer #读取用户输入if[$answer = ="Yes" ] ThenSVN up-r $rocback _version #回滚代码Echo-E"\ r \ n"        Echo 'Code is rocback is OK!!! ^__^!!!'Else        Echo "abandoned Operation program Exit"#放弃操作fi

1, ensure that we get the latest code:

SVN update

Suppose the latest version number is 28.

2. Then find out the exact version number to roll back:

SVN log [somefile]

If log is many, you can use the parameter--limit

SVN log--limit [somefile]

Assume that the version number to rollback is 25 based on the SVN log log, where the somefile can be a file, a directory, or an entire project

If you want to know more about the situation, you can use

SVN diff-r 28:25 [Somefile]

3. Roll back to version number 25:

SVN merge-r 28:25 [Somefile]

For insurance purposes, confirm the results of the rollback again:

SVN diff [Somefile]

Found correct, submit.

4. Submit rollback:

SVN commit-m "Revert revision from R28 to R25,because of ..."

The post-commit version becomes 29.

Summarize the above actions as follows: three

1. SVN update,svn log, find the latest version (latest revision)

2. Find the version number you want to roll back (rollback revision)

3. Roll back with svn merge: svn merge-r 28:25 somefile

Note: Although SVN up-r somefile can also make the file rollback, but when the submission is not the latest version and cannot be submitted, it needs to be updated, copied, and then submitted, so it is not recommended.

Add:

SVN ignores files or folders

SVN propset svn:ignore ' * ' template_c/

SVN rolls back to previous version of Shell script

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.