Skip to content

Commit 02f55e6

Browse files
committed
Merge git://bogomips.org/git-svn
* git://bogomips.org/git-svn: git-svn: teach find-rev to find near matches git svn: do not overescape URLs (fallback case) Git::SVN::Editor::T: pass $deletions to ->A and ->D
2 parents bbc6f64 + 2934a48 commit 02f55e6

File tree

4 files changed

+23
-5
lines changed

4 files changed

+23
-5
lines changed

Documentation/git-svn.txt

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -346,6 +346,16 @@ Any other arguments are passed directly to 'git log'
346346
corresponding git commit hash (this can optionally be followed by a
347347
tree-ish to specify which branch should be searched). When given a
348348
tree-ish, returns the corresponding SVN revision number.
349+
+
350+
--before;;
351+
Don't require an exact match if given an SVN revision, instead find
352+
the commit corresponding to the state of the SVN repository (on the
353+
current branch) at the specified revision.
354+
+
355+
--after;;
356+
Don't require an exact match if given an SVN revision; if there is
357+
not an exact match return the closest match searching forward in the
358+
history.
349359

350360
'set-tree'::
351361
You should consider using 'dcommit' instead of this command.

git-svn.perl

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -114,6 +114,7 @@ sub _req_svn {
114114
$_message, $_file, $_branch_dest,
115115
$_template, $_shared,
116116
$_version, $_fetch_all, $_no_rebase, $_fetch_parent,
117+
$_before, $_after,
117118
$_merge, $_strategy, $_preserve_merges, $_dry_run, $_local,
118119
$_prefix, $_no_checkout, $_url, $_verbose,
119120
$_commit_url, $_tag, $_merge_info, $_interactive);
@@ -258,7 +259,8 @@ sub _req_svn {
258259
} ],
259260
'find-rev' => [ \&cmd_find_rev,
260261
"Translate between SVN revision numbers and tree-ish",
261-
{} ],
262+
{ 'before' => \$_before,
263+
'after' => \$_after } ],
262264
'rebase' => [ \&cmd_rebase, "Fetch and rebase your working directory",
263265
{ 'merge|m|M' => \$_merge,
264266
'verbose|v' => \$_verbose,
@@ -1191,7 +1193,13 @@ sub cmd_find_rev {
11911193
"$head history\n";
11921194
}
11931195
my $desired_revision = substr($revision_or_hash, 1);
1194-
$result = $gs->rev_map_get($desired_revision, $uuid);
1196+
if ($_before) {
1197+
$result = $gs->find_rev_before($desired_revision, 1);
1198+
} elsif ($_after) {
1199+
$result = $gs->find_rev_after($desired_revision, 1);
1200+
} else {
1201+
$result = $gs->rev_map_get($desired_revision, $uuid);
1202+
}
11951203
} else {
11961204
my (undef, $rev, undef) = cmt_metadata($revision_or_hash);
11971205
$result = $rev;

perl/Git/SVN/Editor.pm

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -358,12 +358,12 @@ sub T {
358358
mode_a => $m->{mode_a}, mode_b => '000000',
359359
sha1_a => $m->{sha1_a}, sha1_b => '0' x 40,
360360
chg => 'D', file_b => $m->{file_b}
361-
});
361+
}, $deletions);
362362
$self->A({
363363
mode_a => '000000', mode_b => $m->{mode_b},
364364
sha1_a => '0' x 40, sha1_b => $m->{sha1_b},
365365
chg => 'A', file_b => $m->{file_b}
366-
});
366+
}, $deletions);
367367
return;
368368
}
369369

perl/Git/SVN/Utils.pm

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -155,7 +155,7 @@ sub _canonicalize_url_path {
155155

156156
my @parts;
157157
foreach my $part (split m{/+}, $uri_path) {
158-
$part =~ s/([^~\w.%+-]|%(?![a-fA-F0-9]{2}))/sprintf("%%%02X",ord($1))/eg;
158+
$part =~ s/([^!\$%&'()*+,.\/\w:=\@_`~-]|%(?![a-fA-F0-9]{2}))/sprintf("%%%02X",ord($1))/eg;
159159
push @parts, $part;
160160
}
161161

0 commit comments

Comments
 (0)