threads / rfc / 9818

[RFC] svnimport/cvsimport: force creation of tags that already exist.

Subject: [RFC] svnimport/cvsimport: force creation of tags that already exist.

## tl;dr

3 messages between Sep 7, 2007 and Sep 7, 2007.

replies: 2people: 2as markdown or json

Michael Smith· Sep 7, 2007, 15:42 UTC · lore
Hi all,

git-svnimport was changed recently to use git-tag to make tags (47ee8ed2). I've had to add the "-f" option to import a repository where a tag was moved. I think git-cvsimport would have the same problem.

I understand moving tags is frowned upon in Git. I don't know how common the practise is in Subversion and CVS, or whether it makes sense to make the import scripts force tag creation by default.

Mike
---
 git-cvsimport.perl |    2 +-
 git-svnimport.perl |    2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/git-cvsimport.perl b/git-cvsimport.perl
index ba23eb8..2954fb8 100755
--- a/git-cvsimport.perl
+++ b/git-cvsimport.perl
@@ -779,7 +779,7 @@ sub commit {
 		$xtag =~ tr/_/\./ if ( $opt_u );
 		$xtag =~ s/[\/]/$opt_s/g;
 
-		system('git-tag', $xtag, $cid) == 0
+		system('git-tag', '-f', $xtag, $cid) == 0
 			or die "Cannot create tag $xtag: $!\n";
 
 		print "Created tag '$xtag' on '$branch'\n" if $opt_v;
diff --git a/git-svnimport.perl b/git-svnimport.perl
index 8c17fb5..d3ad5b9 100755
--- a/git-svnimport.perl
+++ b/git-svnimport.perl
@@ -873,7 +873,7 @@ sub commit {
 
 		$dest =~ tr/_/\./ if $opt_u;
 
-		system('git-tag', $dest, $cid) == 0
+		system('git-tag', '-f', $dest, $cid) == 0
 			or die "Cannot create tag $dest: $!\n";
 
 		print "Created tag '$dest' on '$branch'\n" if $opt_v;
-- 
1.5.2.1
Junio C Hamano· Sep 7, 2007, 20:54 UTC · re: Michael Smith · lore

Re: [RFC] svnimport/cvsimport: force creation of tags that already exist.

Michael Smith <msmith@cbnco.com> writes:
> I understand moving tags is frowned upon in Git. I don't know how common 
> the practise is in Subversion and CVS, or whether it makes sense to 
> make the import scripts force tag creation by default.

I think the patch itself makes sense. If for some reason the importer detects that the CVS or SVN history moved a tag, we either:

    (1) have a way to keep track of the versions of the tag; or
    (2) allow it and make it "last one wins" semantics; or
    (3) ignore it and make it "first one wins" semantics.  

Erroring out complaining that the tag cannot be created, as the current code does, does not make any sense.

The patch needs to be accompanied with a better commit log description. I am guessing that with your change the semantics would become (2) above (assuming that cvsps or whoever reads the history of the other side gives events in chronological order), but you should not force readers of your commit log message to guess.

Michael Smith· Sep 7, 2007, 21:35 UTC · re: Junio C Hamano · lore

[PATCH] (cvs|svn)import: Ask git-tag to overwrite old tags.

If the tag was moved in CVS or SVN history, it will be moved in the
imported history as well. Tag history is not tracked.
---
 git-cvsimport.perl |    2 +-
 git-svnimport.perl |    2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/git-cvsimport.perl b/git-cvsimport.perl
index ba23eb8..2954fb8 100755
--- a/git-cvsimport.perl
+++ b/git-cvsimport.perl
@@ -779,7 +779,7 @@ sub commit {
 		$xtag =~ tr/_/\./ if ( $opt_u );
 		$xtag =~ s/[\/]/$opt_s/g;
 
-		system('git-tag', $xtag, $cid) == 0
+		system('git-tag', '-f', $xtag, $cid) == 0
 			or die "Cannot create tag $xtag: $!\n";
 
 		print "Created tag '$xtag' on '$branch'\n" if $opt_v;
diff --git a/git-svnimport.perl b/git-svnimport.perl
index 8c17fb5..d3ad5b9 100755
--- a/git-svnimport.perl
+++ b/git-svnimport.perl
@@ -873,7 +873,7 @@ sub commit {
 
 		$dest =~ tr/_/\./ if $opt_u;
 
-		system('git-tag', $dest, $cid) == 0
+		system('git-tag', '-f', $dest, $cid) == 0
 			or die "Cannot create tag $dest: $!\n";
 
 		print "Created tag '$dest' on '$branch'\n" if $opt_v;
-- 
1.5.3.1.20.gb860

← back to recent threads