* [PATCH] Also handle CVS branches with a '/' in their name
@ 2005-08-17 6:39 Johannes Schindelin
2005-08-17 7:02 ` Junio C Hamano
0 siblings, 1 reply; 5+ messages in thread
From: Johannes Schindelin @ 2005-08-17 6:39 UTC (permalink / raw)
To: Junio C Hamano, git
I track a CVS project which has a branch with a '/' in the branch name.
Since git wants the branch name to be a file name at the same time,
translate that character to a '-'. This should work well, despite the
fact that a division and a difference are completely different :-)
Signed-off-by: Johannes Schindelin <Johannes.Schindelin@gmx.de>
---
git-cvsimport-script | 1 +
1 files changed, 1 insertions(+), 0 deletions(-)
787879e1e16d6cece75dc4744358ba0073e908cc
diff --git a/git-cvsimport-script b/git-cvsimport-script
--- a/git-cvsimport-script
+++ b/git-cvsimport-script
@@ -621,6 +621,7 @@ while(<CVS>) {
$state = 4;
} elsif($state == 4 and s/^Branch:\s+//) {
s/\s+$//;
+ s/\//-/g;
$branch = $_;
$state = 5;
} elsif($state == 5 and s/^Ancestor branch:\s+//) {
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] Also handle CVS branches with a '/' in their name
2005-08-17 6:39 [PATCH] Also handle CVS branches with a '/' in their name Johannes Schindelin
@ 2005-08-17 7:02 ` Junio C Hamano
2005-08-17 7:09 ` Johannes Schindelin
0 siblings, 1 reply; 5+ messages in thread
From: Junio C Hamano @ 2005-08-17 7:02 UTC (permalink / raw)
To: Johannes Schindelin; +Cc: git
Johannes Schindelin <Johannes.Schindelin@gmx.de> writes:
> I track a CVS project which has a branch with a '/' in the branch name.
> Since git wants the branch name to be a file name at the same time,
> translate that character to a '-'. This should work well, despite the
> fact that a division and a difference are completely different :-)
My feeling is that there should be nothing to prevent you from
having a non-flat namespace in .git/refs/heads; i.e. we should
allow ".git/refs/heads/foo/bar". Some of the existing tools may
be forgetting to call either "mkdir -p $(dirname $ref)" if they
are written in shell, or safe_create_leading_directories(ref) in
C, but I consider that is a bug.
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] Also handle CVS branches with a '/' in their name
2005-08-17 7:02 ` Junio C Hamano
@ 2005-08-17 7:09 ` Johannes Schindelin
2005-08-17 7:27 ` Junio C Hamano
0 siblings, 1 reply; 5+ messages in thread
From: Johannes Schindelin @ 2005-08-17 7:09 UTC (permalink / raw)
To: Junio C Hamano; +Cc: git
[-- Attachment #1: Type: TEXT/PLAIN, Size: 893 bytes --]
Hi,
On Wed, 17 Aug 2005, Junio C Hamano wrote:
> Johannes Schindelin <Johannes.Schindelin@gmx.de> writes:
>
> > I track a CVS project which has a branch with a '/' in the branch name.
> > Since git wants the branch name to be a file name at the same time,
> > translate that character to a '-'. This should work well, despite the
> > fact that a division and a difference are completely different :-)
>
> My feeling is that there should be nothing to prevent you from
> having a non-flat namespace in .git/refs/heads; i.e. we should
> allow ".git/refs/heads/foo/bar".
That may be true, but CVS branches being named "Hänsel/Gretel" do not
logically denote hierarchies. I never ever saw hierarchical CVS branch
names with a "/" separator. I saw some with a "." separator.
My feeling is that it would be wrong to map CVS branch names to a
hierarchy.
Ciao,
Dscho
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] Also handle CVS branches with a '/' in their name
2005-08-17 7:09 ` Johannes Schindelin
@ 2005-08-17 7:27 ` Junio C Hamano
2005-08-17 9:19 ` [PATCH 2nd try] " Johannes Schindelin
0 siblings, 1 reply; 5+ messages in thread
From: Junio C Hamano @ 2005-08-17 7:27 UTC (permalink / raw)
To: Johannes Schindelin; +Cc: git
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain; charset=iso-2022-jp-2, Size: 717 bytes --]
Johannes Schindelin <Johannes.Schindelin@gmx.de> writes:
> That may be true, but CVS branches being named "H^[.A^[Ndnsel/Gretel" do not
> logically denote hierarchies. I never ever saw hierarchical CVS branch
> names with a "/" separator. I saw some with a "." separator.
>
> My feeling is that it would be wrong to map CVS branch names to a
> hierarchy.
Although I've used / in CVS branch names to denote hierarchy,
I now agree with you for a different reason. A CVS repository
can have branches "Hnsel" and "Hnsel/Gretel" at the same time,
which we cannot express it with '/'.
However, this may make CVS tags Hnsel/Gretel and Hnsel-Gretel
clash, so maybe the name mangling should be made somehow
configurable?
^ permalink raw reply [flat|nested] 5+ messages in thread
* [PATCH 2nd try] Also handle CVS branches with a '/' in their name
2005-08-17 7:27 ` Junio C Hamano
@ 2005-08-17 9:19 ` Johannes Schindelin
0 siblings, 0 replies; 5+ messages in thread
From: Johannes Schindelin @ 2005-08-17 9:19 UTC (permalink / raw)
To: Junio C Hamano; +Cc: git
I track a CVS project which has a branch with a '/' in the branch name.
Since git wants the branch name to be a file name at the same time,
substitute that character to a '-' by default (override with "-s <subst>").
This should work well, despite the fact that a division and a difference
are completely different :-)
Signed-off-by: Johannes Schindelin <Johannes.Schindelin@gmx.de>
---
Documentation/git-cvsimport-script.txt | 6 +++++-
git-cvsimport-script | 8 +++++---
2 files changed, 10 insertions(+), 4 deletions(-)
b4327595f6cd2a0a4e573ceb12983765321f4790
diff --git a/Documentation/git-cvsimport-script.txt b/Documentation/git-cvsimport-script.txt
--- a/Documentation/git-cvsimport-script.txt
+++ b/Documentation/git-cvsimport-script.txt
@@ -11,7 +11,8 @@ SYNOPSIS
--------
'git-cvsimport-script' [ -o <branch-for-HEAD> ] [ -h ] [ -v ]
[ -d <CVSROOT> ] [ -p <options-for-cvsps> ]
- [ -C <GIT_repository> ] [ -i ] [ -k ] [ <CVS_module> ]
+ [ -C <GIT_repository> ] [ -i ] [ -k ]
+ [ -s <subst> ] [ <CVS_module> ]
DESCRIPTION
@@ -69,6 +70,9 @@ OPTIONS
-z <fuzz>::
Pass the timestamp fuzz factor to cvsps.
+-s <subst>::
+ Substitute the character "/" in branch names with <subst>
+
OUTPUT
------
If '-v' is specified, the script reports what it is doing.
diff --git a/git-cvsimport-script b/git-cvsimport-script
--- a/git-cvsimport-script
+++ b/git-cvsimport-script
@@ -28,19 +28,19 @@ use POSIX qw(strftime dup2);
$SIG{'PIPE'}="IGNORE";
$ENV{'TZ'}="UTC";
-our($opt_h,$opt_o,$opt_v,$opt_k,$opt_d,$opt_p,$opt_C,$opt_z,$opt_i);
+our($opt_h,$opt_o,$opt_v,$opt_k,$opt_d,$opt_p,$opt_C,$opt_z,$opt_i,$opt_s);
sub usage() {
print STDERR <<END;
Usage: ${\basename $0} # fetch/update GIT from CVS
[ -o branch-for-HEAD ] [ -h ] [ -v ] [ -d CVSROOT ]
[ -p opts-for-cvsps ] [ -C GIT_repository ] [ -z fuzz ]
- [ -i ] [ -k ] [ CVS_module ]
+ [ -i ] [ -k ] [-s subst] [ CVS_module ]
END
exit(1);
}
-getopts("hivko:d:p:C:z:") or usage();
+getopts("hivko:d:p:C:z:s:") or usage();
usage if $opt_h;
@ARGV <= 1 or usage();
@@ -59,6 +59,7 @@ if($opt_d) {
die "CVSROOT needs to be set";
}
$opt_o ||= "origin";
+$opt_s ||= "-";
my $git_tree = $opt_C;
$git_tree ||= ".";
@@ -621,6 +622,7 @@ while(<CVS>) {
$state = 4;
} elsif($state == 4 and s/^Branch:\s+//) {
s/\s+$//;
+ s/[\/]/$opt_s/g;
$branch = $_;
$state = 5;
} elsif($state == 5 and s/^Ancestor branch:\s+//) {
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2005-08-17 9:20 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2005-08-17 6:39 [PATCH] Also handle CVS branches with a '/' in their name Johannes Schindelin
2005-08-17 7:02 ` Junio C Hamano
2005-08-17 7:09 ` Johannes Schindelin
2005-08-17 7:27 ` Junio C Hamano
2005-08-17 9:19 ` [PATCH 2nd try] " Johannes Schindelin
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).