From: Mark Allen <mrallen1@yahoo.com>
To: git@vger.kernel.org
Subject: [PATCH] Make cvs2git support remote CVS repos
Date: Wed, 25 May 2005 11:11:32 -0700 (PDT) [thread overview]
Message-ID: <20050525181132.75705.qmail@web41204.mail.yahoo.com> (raw)
[-- Attachment #1: Type: text/plain, Size: 630 bytes --]
Added a "--module=cvsmodule" command line option and (since we're going to process argv
anyway) made "-v" for verbose mode a command line option too, instead of a compile time
option.
I've tested it on some (small) private CVS repos and it *seems* to work, although some of
the initial commit ordering is wrong, but I think this is due to the commit time being
wrong within my CVS repo itself.
I didn't make author and email prettyprint, but I really want to make it a command line
option, the discussion from yesterday about whether prettyprinting should be at the
plumbing or porcelain layer notwithstanding.
Regards,
--Mark
[-- Attachment #2: 1888918109-add-remote-cvs.patch --]
[-- Type: application/octet-stream, Size: 1580 bytes --]
Index: cvs2git.c
===================================================================
--- a0e0d3940c350f14545a481b179217f626c93440/cvs2git.c (mode:100644)
+++ uncommitted/cvs2git.c (mode:100644)
@@ -32,6 +32,8 @@
};
static char *rcsdir;
+static char *cvsroot;
+static char *cvsmodule;
static char date[100];
static char author[100];
@@ -194,9 +196,13 @@
if (dir)
printf("mkdir -p %.*s\n", (int)(dir - name), name);
- get_rcs_name(rcspathname, name, dir);
-
- printf("co -q -p -r%s '%s' > '%s'\n", version, rcspathname, name);
+ if ( !cvsmodule ) {
+ get_rcs_name(rcspathname, name, dir);
+ printf("co -q -p -r%s '%s' > '%s'\n", version, rcspathname, name);
+ } else {
+ printf("cvs -d %s checkout -r%s -p '%s/%s' > '%s'\n", cvsroot, version, cvsmodule, name, name);
+ }
+
printf("git-update-cache --add -- '%s'\n", name);
}
@@ -217,13 +223,34 @@
{
static char line[1000];
enum state state = Header;
+ int i;
+
+ for (i = 1; i < argc; i++) {
+ const char *arg = argv[i];
+ if (!memcmp(arg, "--module=", 9)) {
+ cvsroot = getenv("CVSROOT");
+ cvsmodule = (char *)arg+9;
+ continue;
+ }
+ if (!strcmp(arg, "-v")) {
+ verbose = 1;
+ continue;
+ }
+ }
+
+ if (!cvsmodule)
+ rcsdir = getenv("RCSDIR");
- rcsdir = getenv("RCSDIR");
- if (!rcsdir) {
+ if (!cvsmodule && !rcsdir) {
fprintf(stderr, "I need an $RCSDIR\n");
exit(1);
}
+ if (cvsmodule && !cvsroot) {
+ fprintf(stderr, "I need a $CVSROOT\n");
+ exit(1);
+ }
+
printf("[ -d .git ] && exit 1\n");
printf("git-init-db\n");
printf("mkdir -p .git/refs/heads\n");
next reply other threads:[~2005-05-25 18:10 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2005-05-25 18:11 Mark Allen [this message]
2005-05-26 2:42 ` [PATCH] Make cvs2git support remote CVS repos Linus Torvalds
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20050525181132.75705.qmail@web41204.mail.yahoo.com \
--to=mrallen1@yahoo.com \
--cc=git@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).