397 文字
2 分
svnコマンドでロールバック

コマンドラインでロールバックの方法を発見。

ロールバックそのものはできないけど、merge -> commit で似たことができる。
TortoiseSVNの「Revert changes from this revision」をと同義です。

Terminal window
$ svn merge -c -303 http://svn.example.com/repos/calc/trunk
U integer.c
Terminal window
$ svn status
M integer.c
Terminal window
$ svn diff
# verify that the change is removed
Terminal window
$ svn commit -m "Undoing change committed in r303."
Sending integer.c
Transmitting file data .
Committed revision 350.

mergeスイッチにはたくさんオプションがあって、様々なロールバックを行える。

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
-c [--change] ARG : the change made by revision ARG (like -r ARG-1:ARG)
If ARG is negative this is like -r ARG:ARG-1
-N [--non-recursive] : obsolete; try --depth=files or --depth=immediates
--depth ARG : limit operation by depth ARG ('empty', 'files',
'immediates', or 'infinity')
-q [--quiet] : print nothing, or only summary information
--force : force operation to run
--dry-run : try operation but make no changes
--diff3-cmd ARG : use ARG as merge command
--record-only : mark revisions as merged (use with -r)
-x [--extensions] ARG : Default: '-u'. When Subversion is invoking an
external diff program, ARG is simply passed along
to the program. But when Subversion is using its
default internal diff implementation, or when
Subversion is displaying blame annotations, ARG
could be any of the following:
-u (--unified):
Output 3 lines of unified context.
-b (--ignore-space-change):
Ignore changes in the amount of white space.
-w (--ignore-all-space):
Ignore all white space.
--ignore-eol-style:
Ignore changes in EOL style
-p (--show-c-function):
Show C function name in diff output.
--ignore-ancestry : ignore ancestry when calculating merges
--accept ARG : specify automatic conflict resolution action
('postpone', 'base', 'mine-full', 'theirs-full',
'edit', 'launch')
--reintegrate : lump-merge all of source URL's unmerged changes

http://www.rustyrazorblade.com/2007/04/06/how-to-roll-back-commits-to-an-earlier-version-of-a-repository-in-svn/

あるコミットを無かったことにする方法が書いてある。
スマートではないけど、正攻法。ダウンタイムあるのが良くない
http://timhatch.com/ark/2006/04/18/howto-svn-commit-rollback

svnコマンドでロールバック
https://blog.teraren.com/posts/svnコマンドでロールバック/
作者
Yuki Matsukura
公開日
2008-11-15
ライセンス
CC BY-NC-SA 4.0

コメント