@matheusbsbs / matheus-bagliano / commits / fee3365fe1
Fork 0

archimport: allow for old style branch and public tag names

This patch adds the -o switch, which lets old trees tracked by git-archmirror continue working with their old branch and tag names to make life easier for people tracking your tree. Private tags that are only used internally by git-archimport continue to be new-style, and automatically converted upon first run. [ ml: rebased to skip import overhaul ] Signed-off-by:: Eric Wong <normalperson@yhbt.net> Signed-off-by: Martin Langhoff <martin@catalyst.net.nz>

Martin Langhoff committed Nov 17, 2005 at 21:20 UTC fee3365fe13f36fdd432b1ede9980062cf744663
1 file changed +17 -6
git-archimport.perl
+17 -6
@@ -72,13 +72,12 @@ my $git_dir = $ENV{"GIT_DIR"} || ".git";
72 $ENV{"GIT_DIR"} = $git_dir;
73 my $ptag_dir = "$git_dir/archimport/tags";
74
75 -our($opt_h,$opt_v, $opt_T,
76 - $opt_C,$opt_t);
75 +our($opt_h,$opt_v, $opt_T,$opt_t,$opt_o);
76
77 sub usage() {
78 print STDERR <<END;
79 Usage: ${\basename $0} # fetch/update GIT from Arch
81 - [ -h ] [ -v ] [ -T ] [ -t tempdir ]
80 + [ -o ] [ -h ] [ -v ] [ -T ] [ -t tempdir ]
81 repository/arch-branch [ repository/arch-branch] ...
82 END
83 exit(1);
@@ -263,7 +262,15 @@ sub tree_dirname {
262 return $name;
263 }
264
266 -*git_branchname = *tree_dirname;
265 +# old versions of git-archimport just use the <category--branch> part:
266 +sub old_style_branchname {
267 + my $id = shift;
268 + my $ret = safe_pipe_capture($TLA,'parse-package-name','-p',$id);
269 + chomp $ret;
270 + return $ret;
271 +}
272 +
273 +*git_branchname = $opt_o ? *old_style_branchname : *tree_dirname;
274
275 # process patchsets
276 foreach my $ps (@psets) {
@@ -629,8 +636,12 @@ sub parselog {
636 sub tag {
637 my ($tag, $commit) = @_;
638
632 - # don't use subdirs for tags yet, it could screw up other porcelains
633 - $tag =~ s|/|,|;
639 + if ($opt_o) {
640 + $tag =~ s|/|--|g;
641 + } else {
642 + # don't use subdirs for tags yet, it could screw up other porcelains
643 + $tag =~ s|/|,|g;
644 + }
645
646 if ($commit) {
647 open(C,">","$git_dir/refs/tags/$tag")