Re: [PATCH] git-archimport: allow remapping branch names
- From
Junio C Hamano <junkio@cox.net>
- Date
- Mar 7, 2007, 08:09 UTC
- Message-ID
- <7vodn5iiew.fsf@assigned-by-dhcp.cox.net>
- In-Reply-To
- <eslrcr$9rc$1@sea.gmane.org>
Paolo Bonzini <bonzini@gnu.org> writes:
Show 6 quoted lines
> The new command-line syntax should not be a problem, since a colon > in a branch name would be a pretty weird choice even for > Arch standards. > > The new feature is implemented so that archives rotated every > year can be remapped into a single git archive.
Show 10 quoted lines
> 'git-archimport' [-h] [-v] [-o] [-a] [-f] [-T] [-D depth] [-t tempdir]
> - <archive/branch> [ <archive/branch> ]
> + <archive/branch>[:<git-branch>] ...
> ...
> -my %arch_branches = map { $_ => 1 } @ARGV;
> +my %arch_branches = map { my $branch = $_; $branch =~ s/:.*//; $branch => 1 } @ARGV;
> +
> +# $branch_name_map:
> +# maps arch branches to git branch names
> +my %branch_name_map = map { m/^([^:]*):(.*)/; $1 => $2 } grep { m/:/ } @ARGV;I am no arch/tla expert, but at least git does not allow colon in branch names at all, so if you make your command line parser to match left-greedy-anything, colon and then right-non-colon (i.e. m/^(.*):([^:]*)$/), you should be able to handle colons in arch archive names.