From 47263f5875cc16055e8d5ff3d000f3d41434fcf6 Mon Sep 17 00:00:00 2001 From: Jonathan Nieder Date: Wed, 10 Oct 2012 14:02:18 -0700 Subject: Git::SVN::Editor::T: pass $deletions to ->A and ->D This shouldn't make a difference because the $deletions hash is only used when adding a directory (see 379862ec, 2012-02-20) but it's nice to be consistent to make reading smoother anyway. No functional change intended. Signed-off-by: Jonathan Nieder Signed-off-by: Eric Wong diff --git a/perl/Git/SVN/Editor.pm b/perl/Git/SVN/Editor.pm index 3bbc20a..178920c 100644 --- a/perl/Git/SVN/Editor.pm +++ b/perl/Git/SVN/Editor.pm @@ -358,12 +358,12 @@ sub T { mode_a => $m->{mode_a}, mode_b => '000000', sha1_a => $m->{sha1_a}, sha1_b => '0' x 40, chg => 'D', file_b => $m->{file_b} - }); + }, $deletions); $self->A({ mode_a => '000000', mode_b => $m->{mode_b}, sha1_a => '0' x 40, sha1_b => $m->{sha1_b}, chg => 'A', file_b => $m->{file_b} - }); + }, $deletions); return; } -- cgit v0.10.2-6-g49f6 From 9012f571b46d882dbaed3f31ab59a30d187b2d05 Mon Sep 17 00:00:00 2001 From: Jonathan Nieder Date: Sun, 14 Oct 2012 04:45:21 -0700 Subject: git svn: do not overescape URLs (fallback case) Subversion's canonical URLs are intended to make URL comparison easy and therefore have strict rules about what characters are special enough to urlencode and what characters should be left alone. When in the fallback codepath because unable to use libsvn's own canonicalization function for some reason, escape special characters in URIs according to the svn_uri__char_validity[] table in subversion/libsvn_subr/path.c (r935829). The libsvn versions that trigger this code path are not likely to be strict enough to care, but it's nicer to be consistent. Noticed by using SVN 1.6.17 perl bindings, which do not provide SVN::_Core::svn_uri_canonicalize (triggering the fallback code), with libsvn 1.7.5, whose do_switch is fussy enough to care: Committing to file:///home/jrn/src/git/t/trash%20directory.\ t9118-git-svn-funky-branch-names/svnrepo/pr%20ject/branches\ /more%20fun%20plugin%21 ... svn: E235000: In file '[...]/subversion/libsvn_subr/dirent_uri.c' \ line 2291: assertion failed (svn_uri_is_canonical(url, pool)) error: git-svn died of signal 6 not ok - 3 test dcommit to funky branch After this change, the '!' in 'more%20fun%20plugin!' is not urlencoded and t9118 passes again. Signed-off-by: Jonathan Nieder Signed-off-by: Eric Wong diff --git a/perl/Git/SVN/Utils.pm b/perl/Git/SVN/Utils.pm index 8b8cf37..3d1a093 100644 --- a/perl/Git/SVN/Utils.pm +++ b/perl/Git/SVN/Utils.pm @@ -155,7 +155,7 @@ sub _canonicalize_url_path { my @parts; foreach my $part (split m{/+}, $uri_path) { - $part =~ s/([^~\w.%+-]|%(?![a-fA-F0-9]{2}))/sprintf("%%%02X",ord($1))/eg; + $part =~ s/([^!\$%&'()*+,.\/\w:=\@_`~-]|%(?![a-fA-F0-9]{2}))/sprintf("%%%02X",ord($1))/eg; push @parts, $part; } -- cgit v0.10.2-6-g49f6 From 2934a484fdaf9ceea4da2e9402a2f54dcaf59fb1 Mon Sep 17 00:00:00 2001 From: John Keeping Date: Thu, 17 Jan 2013 22:19:33 +0000 Subject: git-svn: teach find-rev to find near matches When a single SVN repository is split into multiple Git repositories many SVN revisions will exist in only one of the Git repositories created. For some projects the only way to build a working artifact is to check out corresponding versions of various repositories, with no indication of what those are in the Git world - in the SVN world the revision numbers are sufficient. By adding "--before" to "git-svn find-rev" we can say "tell me what this repository looked like when that other repository looked like this": git svn find-rev --before \ r$(git --git-dir=/over/there.git svn find-rev HEAD) Signed-off-by: John Keeping Signed-off-by: Eric Wong diff --git a/Documentation/git-svn.txt b/Documentation/git-svn.txt index 69decb1..34d438b 100644 --- a/Documentation/git-svn.txt +++ b/Documentation/git-svn.txt @@ -346,6 +346,16 @@ Any other arguments are passed directly to 'git log' corresponding git commit hash (this can optionally be followed by a tree-ish to specify which branch should be searched). When given a tree-ish, returns the corresponding SVN revision number. ++ +--before;; + Don't require an exact match if given an SVN revision, instead find + the commit corresponding to the state of the SVN repository (on the + current branch) at the specified revision. ++ +--after;; + Don't require an exact match if given an SVN revision; if there is + not an exact match return the closest match searching forward in the + history. 'set-tree':: You should consider using 'dcommit' instead of this command. diff --git a/git-svn.perl b/git-svn.perl index bd5266c..d086694 100755 --- a/git-svn.perl +++ b/git-svn.perl @@ -114,6 +114,7 @@ my ($_stdin, $_help, $_edit, $_message, $_file, $_branch_dest, $_template, $_shared, $_version, $_fetch_all, $_no_rebase, $_fetch_parent, + $_before, $_after, $_merge, $_strategy, $_preserve_merges, $_dry_run, $_local, $_prefix, $_no_checkout, $_url, $_verbose, $_commit_url, $_tag, $_merge_info, $_interactive); @@ -258,7 +259,8 @@ my %cmd = ( } ], 'find-rev' => [ \&cmd_find_rev, "Translate between SVN revision numbers and tree-ish", - {} ], + { 'before' => \$_before, + 'after' => \$_after } ], 'rebase' => [ \&cmd_rebase, "Fetch and rebase your working directory", { 'merge|m|M' => \$_merge, 'verbose|v' => \$_verbose, @@ -1191,7 +1193,13 @@ sub cmd_find_rev { "$head history\n"; } my $desired_revision = substr($revision_or_hash, 1); - $result = $gs->rev_map_get($desired_revision, $uuid); + if ($_before) { + $result = $gs->find_rev_before($desired_revision, 1); + } elsif ($_after) { + $result = $gs->find_rev_after($desired_revision, 1); + } else { + $result = $gs->rev_map_get($desired_revision, $uuid); + } } else { my (undef, $rev, undef) = cmt_metadata($revision_or_hash); $result = $rev; -- cgit v0.10.2-6-g49f6