Limit start revision of find_rev_before to max existing revision
PATCH v2 1/2 Limit start revision of find_rev_before to max existing revision
---
Quoted 3 lines · Eric Wong
find_rev_beforecan certainly be improved. I haven't noticed performance issues with it myself, but you should be able to improve it.
This avoids a long wait if you do 'git svn reset -r 9999999'. The linear search within the contiguous revisions doesn't seem to be a problem.
git-svn.perl | 2 ++ 1 files changed, 2 insertions(+), 0 deletions(-)
git-svn.perl +2 -0
@@ -3130,6 +3130,8 @@ sub find_rev_before { my ($self, $rev, $eq_ok, $min_rev) = @_; --$rev unless $eq_ok; $min_rev ||= 1; + my $max_rev = $self->rev_map_max; + $rev = $max_rev if ($rev > $max_rev); while ($rev >= $min_rev) { if (my $c = $self->rev_map_get($rev)) { return ($rev, $c);
Signature · 1 line
1.6.3.GIT
PATCH v2 2/2 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.
---
Update ensures revision input is numeric.
Quoted 7 lines · Eric Wong
Quoted 2 lines · Ben Jackson
3. Without --parent it should probably fail for a nonexistent rev rather than automatically
find_rev_before..Probably best to ignore the --parent flag and just pass 1 as the second argument to
find_rev_before. That's how SVN operations work when a non-exact revision is specified..
That is how '-r' works. Passing '1' to find_rev_before *skips* the input rev. The theory is that you may know that r1000 is "bad" and so you use 'git svn reset -r1000 --parent' to discard r1000 (while 'reset -r1000' *keeps* r1000, analagous to 'git reset SHA'). You could get the same effect with 'git svn reset -r999' (and internally that's identical). I looked for a SVN syntax to copy, eg '-r1000^' if it were like GIT, but I didn't see one. I know I am overloading --parent which means something else for other git-svn commands, so I'm happy to remove that if you don't like it.
Documentation/git-svn.txt | 59 +++++++++++++++++++++++++++++++++++++++- git-svn.perl | 45 +++++++++++++++++++++++++++--- t/t9139-git-svn-reset.sh | 66 +++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 164 insertions(+), 6 deletions(-) create mode 100755 t/t9139-git-svn-reset.sh
Documentation/git-svn.txt +58 -1
@@ -215,7 +215,7 @@ config key: svn.commiturl (overwrites all svn-remote.<name>.commiturl options) The following features from `svn log' are supported: + -- ---revision=<n>[:<n>];; +-r/--revision=<n>[:<n>];; is supported, non-numeric args are not: HEAD, NEXT, BASE, PREV, etc ... -v/--verbose;;
@@ -313,6 +313,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=<n>;; + 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
git-svn.perl +40 -5
101 lines not on this page · raw message
t/t9139-git-svn-reset.sh new file +66 -0
66 lines not on this page · raw message
Signature · 1 line
1.6.3.GIT
Re: [PATCHv2 2/2] Add 'git svn reset' to unwind 'git svn fetch'
Quoted 21 lines · Ben Jackson
Add a command to unwind the effects of fetch by moving the
rev_mapand 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 <[email protected]>---
Update ensures revision input is numeric.
Quoted 7 lines · Eric Wong
Quoted 2 lines · Ben Jackson
3. Without --parent it should probably fail for a nonexistent rev rather than automatically
find_rev_before..Probably best to ignore the --parent flag and just pass 1 as the second argument to
find_rev_before. That's how SVN operations work when a non-exact revision is specified..
Quoted 9 lines
That is how '-r' works. Passing '1' to
find_rev_before*skips* the input rev. The theory is that you may know that r1000 is "bad" and so you use 'git svn reset -r1000 --parent' to discard r1000 (while 'reset -r1000' *keeps* r1000, analagous to 'git reset SHA'). You could get the same effect with 'git svn reset -r999' (and internally that's identical). I looked for a SVN syntax to copy, eg '-r1000^' if it were like GIT, but I didn't see one. I know I am overloading --parent which means something else for other git-svn commands, so I'm happy to remove that if you don't like it.
Ah, I always subconciously just decremented the revision number by 1 myself. Maybe adding "^"/"~" handling to git-svn to handle SVN revisions would work, too, but --parent is fine, I guess.
This series acked and pushed out to git://git.bogomips.org/git-svn
Signature · 1 line
Eric Wong