From 195643f2fc80b4d06a75b954b9a8ef2300976755 Mon Sep 17 00:00:00 2001 From: Ben Jackson Date: Wed, 3 Jun 2009 20:45:52 -0700 Subject: Add 'git svn reset' to unwind 'git svn fetch' Add a command to unwind the effects of fetch by moving the rev_map and refs/remotes/git-svn back to an old SVN revision. This allows revisions to be re-fetched. Ideally SVN revs would be immutable, but permissions changes in the SVN repository or indiscriminate use of '--ignore-paths' can create situations where fetch cannot make progress. Signed-off-by: Ben Jackson Acked-by: Eric Wong --- Documentation/git-svn.txt | 59 ++++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 58 insertions(+), 1 deletion(-) (limited to 'Documentation/git-svn.txt') diff --git a/Documentation/git-svn.txt b/Documentation/git-svn.txt index 5027f9fbd7..3f0fa5e6f1 100644 --- a/Documentation/git-svn.txt +++ b/Documentation/git-svn.txt @@ -216,7 +216,7 @@ config key: svn.commiturl (overwrites all svn-remote..commiturl options) The following features from `svn log' are supported: + -- ---revision=[:];; +-r/--revision=[:];; is supported, non-numeric args are not: HEAD, NEXT, BASE, PREV, etc ... -v/--verbose;; @@ -314,6 +314,63 @@ Any other arguments are passed directly to 'git-log' Shows the Subversion externals. Use -r/--revision to specify a specific revision. +'reset':: + Undoes the effects of 'fetch' back to the specified revision. + This allows you to re-'fetch' an SVN revision. Normally the + contents of an SVN revision should never change and 'reset' + should not be necessary. However, if SVN permissions change, + or if you alter your --ignore-paths option, a 'fetch' may fail + with "not found in commit" (file not previously visible) or + "checksum mismatch" (missed a modification). If the problem + file cannot be ignored forever (with --ignore-paths) the only + way to repair the repo is to use 'reset'. + +Only the rev_map and refs/remotes/git-svn are changed. Follow 'reset' +with a 'fetch' and then 'git-reset' or 'git-rebase' to move local +branches onto the new tree. + +-r/--revision=;; + Specify the most recent revision to keep. All later revisions + are discarded. +-p/--parent;; + Discard the specified revision as well, keeping the nearest + parent instead. +Example:;; +Assume you have local changes in "master", but you need to refetch "r2". + +------------ + r1---r2---r3 remotes/git-svn + \ + A---B master +------------ + +Fix the ignore-paths or SVN permissions problem that caused "r2" to +be incomplete in the first place. Then: + +[verse] +git svn reset -r2 -p +git svn fetch + +------------ + r1---r2'--r3' remotes/git-svn + \ + r2---r3---A---B master +------------ + +Then fixup "master" with 'git-rebase'. +Do NOT use 'git-merge' or your history will not be compatible with a +future 'dcommit'! + +[verse] +git rebase --onto remotes/git-svn A^ master + +------------ + r1---r2'--r3' remotes/git-svn + \ + A'--B' master +------------ + + -- OPTIONS -- cgit v1.2.3