* [PATCH] git-cvsimport: Add -N option to force a new import
@ 2007-10-24 23:28 Matt McCutchen
2007-10-25 3:17 ` Junio C Hamano
0 siblings, 1 reply; 7+ messages in thread
From: Matt McCutchen @ 2007-10-24 23:28 UTC (permalink / raw)
To: Junio C Hamano; +Cc: git
I had a git repository for development of rsync and wanted to start
importing the upstream CVS with git-cvsimport, but git-cvsimport saw
that the git repository existed and insisted on updating a previous
import. This patch adds an -N option to git-cvsimport to force a new
import and updates the documentation appropriately.
Signed-off-by: Matt McCutchen <matt@mattmccutchen.net>
---
I implemented this because I needed it; adopt it in the main git if you
like it.
Documentation/git-cvsimport.txt | 5 ++++-
git-cvsimport.perl | 9 ++++++---
2 files changed, 10 insertions(+), 4 deletions(-)
diff --git a/Documentation/git-cvsimport.txt b/Documentation/git-cvsimport.txt
index fdd7ec7..f595957 100644
--- a/Documentation/git-cvsimport.txt
+++ b/Documentation/git-cvsimport.txt
@@ -13,7 +13,7 @@ SYNOPSIS
[-A <author-conv-file>] [-p <options-for-cvsps>] [-P <file>]
[-C <git_repository>] [-z <fuzz>] [-i] [-k] [-u] [-s <subst>]
[-a] [-m] [-M <regex>] [-S <regex>] [-L <commitlimit>]
- [-r <remote>] [<CVS_module>]
+ [-r <remote>] [-N] [<CVS_module>]
DESCRIPTION
@@ -144,6 +144,9 @@ It is not recommended to use this feature if you intend to
export changes back to CVS again later with
gitlink:git-cvsexportcommit[1].
+-N::
+ Do a new import even if the git repository already exists.
+
-h::
Print a short usage message and exit.
diff --git a/git-cvsimport.perl b/git-cvsimport.perl
index 2954fb8..6f03be9 100755
--- a/git-cvsimport.perl
+++ b/git-cvsimport.perl
@@ -29,7 +29,7 @@ use IPC::Open2;
$SIG{'PIPE'}="IGNORE";
$ENV{'TZ'}="UTC";
-our ($opt_h,$opt_o,$opt_v,$opt_k,$opt_u,$opt_d,$opt_p,$opt_C,$opt_z,$opt_i,$opt_P, $opt_s,$opt_m,$opt_M,$opt_A,$opt_S,$opt_L, $opt_a, $opt_r);
+our ($opt_h,$opt_o,$opt_v,$opt_k,$opt_u,$opt_d,$opt_p,$opt_C,$opt_z,$opt_i,$opt_P, $opt_s,$opt_m,$opt_M,$opt_A,$opt_S,$opt_L, $opt_a, $opt_r, $opt_N);
my (%conv_author_name, %conv_author_email);
sub usage(;$) {
@@ -40,7 +40,7 @@ Usage: ${\basename $0} # fetch/update GIT from CVS
[-o branch-for-HEAD] [-h] [-v] [-d CVSROOT] [-A author-conv-file]
[-p opts-for-cvsps] [-P file] [-C GIT_repository] [-z fuzz] [-i] [-k]
[-u] [-s subst] [-a] [-m] [-M regex] [-S regex] [-L commitlimit]
- [-r remote] [CVS_module]
+ [-r remote] [-N] [CVS_module]
END
exit(1);
}
@@ -114,7 +114,7 @@ sub read_repo_config {
}
}
-my $opts = "haivmkuo:d:p:r:C:z:s:M:P:A:S:L:";
+my $opts = "haivmkuNo:d:p:r:C:z:s:M:P:A:S:L:";
read_repo_config($opts);
getopts($opts) or usage();
usage if $opt_h;
@@ -563,7 +563,10 @@ unless (-d $git_dir) {
die "Cannot init the GIT db at $git_tree: $?\n" if $?;
system("git-read-tree");
die "Cannot init an empty tree: $?\n" if $?;
+ $opt_N = 1;
+}
+if ($opt_N) {
$last_branch = $opt_o;
$orig_branch = "";
} else {
--
1.5.3.3.128.g56927
^ permalink raw reply related [flat|nested] 7+ messages in thread
* Re: [PATCH] git-cvsimport: Add -N option to force a new import
2007-10-24 23:28 [PATCH] git-cvsimport: Add -N option to force a new import Matt McCutchen
@ 2007-10-25 3:17 ` Junio C Hamano
2007-10-25 4:01 ` Matt McCutchen
2007-11-06 3:36 ` Matt McCutchen
0 siblings, 2 replies; 7+ messages in thread
From: Junio C Hamano @ 2007-10-25 3:17 UTC (permalink / raw)
To: Matt McCutchen; +Cc: git
Matt McCutchen <matt@mattmccutchen.net> writes:
> I had a git repository for development of rsync and wanted to start
> importing the upstream CVS with git-cvsimport, but git-cvsimport saw
> that the git repository existed and insisted on updating a previous
> import. This patch adds an -N option to git-cvsimport to force a new
> import and updates the documentation appropriately.
Sounds like a useful addition. Tests?
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH] git-cvsimport: Add -N option to force a new import
2007-10-25 3:17 ` Junio C Hamano
@ 2007-10-25 4:01 ` Matt McCutchen
2007-10-25 9:56 ` Johannes Schindelin
2007-10-25 19:45 ` Robin Rosenberg
2007-11-06 3:36 ` Matt McCutchen
1 sibling, 2 replies; 7+ messages in thread
From: Matt McCutchen @ 2007-10-25 4:01 UTC (permalink / raw)
To: Junio C Hamano; +Cc: git
On Wed, 2007-10-24 at 20:17 -0700, Junio C Hamano wrote:
> Matt McCutchen <matt@mattmccutchen.net> writes:
>
> > I had a git repository for development of rsync and wanted to start
> > importing the upstream CVS with git-cvsimport, but git-cvsimport saw
> > that the git repository existed and insisted on updating a previous
> > import. This patch adds an -N option to git-cvsimport to force a new
> > import and updates the documentation appropriately.
>
> Sounds like a useful addition. Tests?
Are there existing tests for git-cvsimport somewhere whose example I
could follow? (I didn't see any in t/ .) If not, I suppose I will just
write a simple script that runs git-cvsimport with and without -N and
with and without an existing, empty git repository and checks that the
right things happen.
Matt
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH] git-cvsimport: Add -N option to force a new import
2007-10-25 4:01 ` Matt McCutchen
@ 2007-10-25 9:56 ` Johannes Schindelin
2007-10-25 19:45 ` Robin Rosenberg
1 sibling, 0 replies; 7+ messages in thread
From: Johannes Schindelin @ 2007-10-25 9:56 UTC (permalink / raw)
To: Matt McCutchen; +Cc: Junio C Hamano, git
Hi,
On Thu, 25 Oct 2007, Matt McCutchen wrote:
> On Wed, 2007-10-24 at 20:17 -0700, Junio C Hamano wrote:
> > Matt McCutchen <matt@mattmccutchen.net> writes:
> >
> > > I had a git repository for development of rsync and wanted to start
> > > importing the upstream CVS with git-cvsimport, but git-cvsimport saw
> > > that the git repository existed and insisted on updating a previous
> > > import. This patch adds an -N option to git-cvsimport to force a new
> > > import and updates the documentation appropriately.
> >
> > Sounds like a useful addition. Tests?
>
> Are there existing tests for git-cvsimport somewhere whose example I
> could follow? (I didn't see any in t/ .) If not, I suppose I will just
> write a simple script that runs git-cvsimport with and without -N and
> with and without an existing, empty git repository and checks that the
> right things happen.
My best bet: t/t9200-cvsexportcommit.sh
Hth,
Dscho
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH] git-cvsimport: Add -N option to force a new import
2007-10-25 4:01 ` Matt McCutchen
2007-10-25 9:56 ` Johannes Schindelin
@ 2007-10-25 19:45 ` Robin Rosenberg
1 sibling, 0 replies; 7+ messages in thread
From: Robin Rosenberg @ 2007-10-25 19:45 UTC (permalink / raw)
To: Matt McCutchen; +Cc: Junio C Hamano, git
torsdag 25 oktober 2007 skrev Matt McCutchen:
> On Wed, 2007-10-24 at 20:17 -0700, Junio C Hamano wrote:
> > Matt McCutchen <matt@mattmccutchen.net> writes:
> >
> > > I had a git repository for development of rsync and wanted to start
> > > importing the upstream CVS with git-cvsimport, but git-cvsimport saw
> > > that the git repository existed and insisted on updating a previous
> > > import. This patch adds an -N option to git-cvsimport to force a new
> > > import and updates the documentation appropriately.
> >
> > Sounds like a useful addition. Tests?
>
> Are there existing tests for git-cvsimport somewhere whose example I
> could follow? (I didn't see any in t/ .) If not, I suppose I will just
> write a simple script that runs git-cvsimport with and without -N and
> with and without an existing, empty git repository and checks that the
> right things happen.
None, but there should be. I also think cvsps should be included in the git
repo since it is required and AFAIK, only git people maintain it.
Now I don't use cvsimport to import my CVS repos, so I'll pass on adding test
cases. It is a non-trivial task
I did it for cvsexportcommit which didn't have any tests when I started
hacking it.
-- robin
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH] git-cvsimport: Add -N option to force a new import
2007-10-25 3:17 ` Junio C Hamano
2007-10-25 4:01 ` Matt McCutchen
@ 2007-11-06 3:36 ` Matt McCutchen
2007-11-06 21:35 ` Piet Delaney
1 sibling, 1 reply; 7+ messages in thread
From: Matt McCutchen @ 2007-11-06 3:36 UTC (permalink / raw)
To: Junio C Hamano; +Cc: git
On Wed, 2007-10-24 at 20:17 -0700, Junio C Hamano wrote:
> Matt McCutchen <matt@mattmccutchen.net> writes:
>
> > I had a git repository for development of rsync and wanted to start
> > importing the upstream CVS with git-cvsimport, but git-cvsimport saw
> > that the git repository existed and insisted on updating a previous
> > import. This patch adds an -N option to git-cvsimport to force a new
> > import and updates the documentation appropriately.
>
> Sounds like a useful addition. Tests?
Good call! As I was dismayed to discover, the existing files in the
working tree confused the import, so -N as I implemented it is useless.
I ended up doing the import a different way; I'll notify the list if I
get around to implementing -N properly.
Matt
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH] git-cvsimport: Add -N option to force a new import
2007-11-06 3:36 ` Matt McCutchen
@ 2007-11-06 21:35 ` Piet Delaney
0 siblings, 0 replies; 7+ messages in thread
From: Piet Delaney @ 2007-11-06 21:35 UTC (permalink / raw)
To: git; +Cc: piet delaney
Matt McCutchen wrote:
> On Wed, 2007-10-24 at 20:17 -0700, Junio C Hamano wrote:
>> Matt McCutchen <matt@mattmccutchen.net> writes:
>>
>>> I had a git repository for development of rsync and wanted to start
>>> importing the upstream CVS with git-cvsimport, but git-cvsimport saw
>>> that the git repository existed and insisted on updating a previous
>>> import. This patch adds an -N option to git-cvsimport to force a new
>>> import and updates the documentation appropriately.
>> Sounds like a useful addition. Tests?
>
> Good call! As I was dismayed to discover, the existing files in the
> working tree confused the import,\
What's the confusion? I thought updating of the git repo from cvs
worked. Sigh.
-piet
> so -N as I implemented it is useless.
> I ended up doing the import a different way; I'll notify the list if I
> get around to implementing -N properly.
>
> Matt
>
^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2007-11-06 21:40 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-10-24 23:28 [PATCH] git-cvsimport: Add -N option to force a new import Matt McCutchen
2007-10-25 3:17 ` Junio C Hamano
2007-10-25 4:01 ` Matt McCutchen
2007-10-25 9:56 ` Johannes Schindelin
2007-10-25 19:45 ` Robin Rosenberg
2007-11-06 3:36 ` Matt McCutchen
2007-11-06 21:35 ` Piet Delaney
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).