Skip to contentSkip to conversation

git-svn: add --prefix= option to multi-init

PATCH New Eric Wong 1 participant 2 messages Jun 15, 2016 Documentation

lore
Share & tools
lore

Eric Wong

author
#0 lore raw

PATCH 1/2 git-svn: add --prefix= option to multi-init

Also, document --{trunk,branches,tags} options while we're documenting multi-init options.

---
 Documentation/git-svn.txt |   18 ++++++++++++++++++
 git-svn.perl              |    8 +++++---
 2 files changed, 23 insertions(+), 3 deletions(-)
Documentation/git-svn.txt +18 -0
index ce63def..8df43cb 100644
@@ -139,6 +139,24 @@ manually joining branches on commit.
 	where the repository URL ends and where the repository path
 	begins.
 
+-T<trunk_subdir>::
+--trunk=<trunk_subdir>::
+-t<tags_subdir>::
+--tags=<tags_subdir>::
+-b<branches_subdir>::
+--branches=<branches_subdir>::
+	These are the command-line options for multi-init.  Each of
+	these flags can point to a relative repository path
+	(--tags=project/tags') or a full url
+	(--tags=https://foo.org/project/tags)
+
+--prefix=<prefix>
+	This allows one to specify a prefix which is prepended to the
+	names of remotes.  The prefix does not automatically include a
+	trailing slash, so be sure you include one in the argument if
+	that is what you want.  This is useful if you wish to track
+	multiple projects that share a common repository.
+
 'multi-fetch'::
 	This runs fetch on all known SVN branches we're tracking.  This
 	will NOT discover new branches (unlike git-svnimport), so
git-svn.perl +5 -3
index 1da31fd..a092be8 100755
@@ -70,7 +70,7 @@ my ($_revision,$_stdin,$_no_ignore_ext,$_no_stop_copy,$_help,$_rmdir,$_edit,
 	$_version, $_upgrade, $_authors, $_branch_all_refs, @_opt_m,
 	$_merge, $_strategy, $_dry_run, $_ignore_nodate, $_non_recursive,
 	$_username, $_config_dir, $_no_auth_cache,
-	$_pager, $_color);
+	$_pager, $_color, $_prefix);
 my (@_branch_from, %tree_map, %users, %rusers, %equiv);
 my ($_svn_can_do_switch);
 my @repo_path_split_cache;
@@ -134,6 +134,7 @@ my %cmd = (
 			 'username=s' => \$_username,
 			 'config-dir=s' => \$_config_dir,
 			 'no-auth-cache' => \$_no_auth_cache,
+			 'prefix=s' => \$_prefix,
 			} ],
 	'multi-fetch' => [ \&multi_fetch,
 			'Fetch multiple trees (like git-svnimport)',
@@ -595,8 +596,9 @@ sub multi_init {
 			command_noisy('repo-config', 'svn.trunk', $trunk_url);
 		}
 	}
-	complete_url_ls_init($url, $_branches, '--branches/-b', '');
-	complete_url_ls_init($url, $_tags, '--tags/-t', 'tags/');
+	$_prefix = '' unless defined $_prefix;
+	complete_url_ls_init($url, $_branches, '--branches/-b', $_prefix);
+	complete_url_ls_init($url, $_tags, '--tags/-t', $_prefix . 'tags/');
 }
 
 sub multi_fetch {
Signature · 1 line
1.5.0.rc0.ge21b-dirty
author
#1 lore raw

PATCH 2/2 git-svn: pass an unambiguous ref to rev-list when grafting-branches

Some users apparently create local heads with the same basename as the remote branch they're tracking.

---
 git-svn.perl |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
git-svn.perl +1 -1
index a092be8..56f1700 100755
@@ -1086,7 +1086,7 @@ sub graft_merge_msg {
 	my ($grafts, $l_map, $u, $p, @re) = @_;
 
 	my $x = $l_map->{$u}->{$p};
-	my $rl = rev_list_raw($x);
+	my $rl = rev_list_raw("refs/remotes/$x");
 	while (my $c = next_rev_list_entry($rl)) {
 		foreach my $re (@re) {
 			my (@br) = ($c->{m} =~ /$re/g);
Signature · 1 line
1.5.0.rc0.ge21b-dirty