summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: d2b6f7c)
raw | patch | inline | side by side (parent: d2b6f7c)
author | Linus Torvalds <torvalds@ppc970.osdl.org> | |
Tue, 31 May 2005 04:00:09 +0000 (21:00 -0700) | ||
committer | Linus Torvalds <torvalds@ppc970.osdl.org> | |
Tue, 31 May 2005 04:00:09 +0000 (21:00 -0700) |
file versions.
This allows you to do the conversion (although slowly) from
a remote repository, and besides, it's one less thing to worry
about when you don't need to look up the CVS Attic directories
etc.
This allows you to do the conversion (although slowly) from
a remote repository, and besides, it's one less thing to worry
about when you don't need to look up the CVS Attic directories
etc.
cvs2git.c | patch | blob | history |
diff --git a/cvs2git.c b/cvs2git.c
index 1adc918f51d668fe818468213f64b5d476148bb3..06dd74b36840824d910cab72965b871f819a494e 100644 (file)
--- a/cvs2git.c
+++ b/cvs2git.c
* Hopefully David Mansfield will update his distribution soon
* enough (he's the one who wrote the patch, so at least we don't
* have to figt maintainer issues ;)
+ *
+ * Usage:
+ *
+ * TZ=UTC cvsps -A |
+ * cvs2git --cvsroot=[root] --module=[module] > script
+ *
+ * Creates a shell script that will generate the .git archive of
+ * the names CVS repository.
+ *
+ * IMPORTANT NOTE ABOUT "cvsps"! This requires version 2.1 or better,
+ * and the "TZ=UTC" and the "-A" flag is required for sane results!
*/
enum state {
Header,
Members
};
-static char *rcsdir;
+static const char *cvsroot;
+static const char *cvsmodule;
static char date[100];
static char author[100];
initial_commit = 0;
}
-static void get_rcs_name(char *rcspathname, char *name, char *dir)
-{
- sprintf(rcspathname, "%s/%s,v", rcsdir, name);
- if (!access(rcspathname, R_OK))
- return;
-
- sprintf(rcspathname, "%s/Attic/%s,v", rcsdir, name);
- if (!access(rcspathname, R_OK))
- return;
-
- if (dir) {
- sprintf(rcspathname, "%s/%.*s/Attic/%s,v", rcsdir, (int)(dir - name), name, dir+1);
- if (!access(rcspathname, R_OK))
- return;
- }
- fprintf(stderr, "Unable to find RCS file for %s\n", name);
- exit(1);
-}
-
static void update_file(char *line)
{
- static char rcspathname[4096];
char *name, *version;
char *dir;
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);
+ printf("cvs -q -d %s checkout -r%s -p '%s/%s' > '%s'\n", cvsroot, version, cvsmodule, name, name);
printf("git-update-cache --add -- '%s'\n", name);
}
{
static char line[1000];
enum state state = Header;
+ int i;
+
+ for (i = 1; i < argc; i++) {
+ const char *arg = argv[i];
+ if (!memcmp(arg, "--cvsroot=", 10)) {
+ cvsroot = arg + 10;
+ continue;
+ }
+ if (!memcmp(arg, "--module=", 9)) {
+ cvsmodule = arg+9;
+ continue;
+ }
+ if (!strcmp(arg, "-v")) {
+ verbose = 1;
+ continue;
+ }
+ }
+
+
+ if (!cvsroot)
+ cvsroot = getenv("CVSROOT");
- rcsdir = getenv("RCSDIR");
- if (!rcsdir) {
- fprintf(stderr, "I need an $RCSDIR\n");
+ if (!cvsmodule || !cvsroot) {
+ fprintf(stderr, "I need a CVSROOT and module name\n");
exit(1);
}