Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/gnu/dist/cvs/src resolve conflicts. I have not tested ipv6 o...
details: https://anonhg.NetBSD.org/src/rev/fc637ae2d14f
branches: trunk
changeset: 539862:fc637ae2d14f
user: christos <christos%NetBSD.org@localhost>
date: Thu Nov 28 05:59:06 2002 +0000
description:
resolve conflicts. I have not tested ipv6 or gssapi.
diffstat:
gnu/dist/cvs/src/checkout.c | 253 ++++++----
gnu/dist/cvs/src/client.c | 1049 ++++++++++++++++++++++-------------------
gnu/dist/cvs/src/commit.c | 102 +--
gnu/dist/cvs/src/cvs.h | 64 +-
gnu/dist/cvs/src/history.c | 85 +-
gnu/dist/cvs/src/lock.c | 36 +-
gnu/dist/cvs/src/logmsg.c | 202 ++++++--
gnu/dist/cvs/src/main.c | 237 ++++----
gnu/dist/cvs/src/mkmodules.c | 22 +-
gnu/dist/cvs/src/parseinfo.c | 26 +-
gnu/dist/cvs/src/rcs.c | 507 ++++++++++----------
gnu/dist/cvs/src/recurse.c | 27 +-
gnu/dist/cvs/src/server.c | 611 +++++++++++++++---------
gnu/dist/cvs/src/tag.c | 627 +++++++++++++++++++++----
gnu/dist/cvs/src/update.c | 155 ++++--
15 files changed, 2452 insertions(+), 1551 deletions(-)
diffs (truncated from 7666 to 300 lines):
diff -r 8622efdca31f -r fc637ae2d14f gnu/dist/cvs/src/checkout.c
--- a/gnu/dist/cvs/src/checkout.c Thu Nov 28 05:57:55 2002 +0000
+++ b/gnu/dist/cvs/src/checkout.c Thu Nov 28 05:59:06 2002 +0000
@@ -44,7 +44,7 @@
static const char *const checkout_usage[] =
{
- "Usage:\n %s %s [-ANPRcflnps] [-r rev | -D date] [-d dir]\n",
+ "Usage:\n %s %s [-ANPRcflnps] [-r rev] [-D date] [-d dir]\n",
" [-j rev1] [-j rev2] [-k kopt] modules...\n",
"\t-A\tReset any sticky tags/date/kopts.\n",
"\t-N\tDon't shorten module paths if -d specified.\n",
@@ -59,7 +59,7 @@
"\t-r rev\tCheck out revision or tag. (implies -P) (is sticky)\n",
"\t-D date\tCheck out revisions as of date. (implies -P) (is sticky)\n",
"\t-d dir\tCheck out into dir instead of module name.\n",
- "\t-k kopt\tUse RCS kopt -k option on checkout.\n",
+ "\t-k kopt\tUse RCS kopt -k option on checkout. (is sticky)\n",
"\t-j rev\tMerge in changes made between current revision and rev.\n",
"(Specify the --help global option for a list of other help options)\n",
NULL
@@ -67,7 +67,7 @@
static const char *const export_usage[] =
{
- "Usage: %s %s [-NRfln] [-r rev | -D date] [-d dir] [-k kopt] module...\n",
+ "Usage: %s %s [-NRfln] [-r rev] [-D date] [-d dir] [-k kopt] module...\n",
"\t-N\tDon't shorten module paths if -d specified.\n",
"\t-f\tForce a head revision match if tag/date not found.\n",
"\t-l\tLocal directory only, not recursive\n",
@@ -82,18 +82,18 @@
};
static int checkout_prune_dirs;
-static int force_tag_match = 1;
+static int force_tag_match;
static int pipeout;
static int aflag;
-static char *options = NULL;
-static char *tag = NULL;
-static int tag_validated = 0;
-static char *date = NULL;
-static char *join_rev1 = NULL;
-static char *join_rev2 = NULL;
-static int join_tags_validated = 0;
-static char *preload_update_dir = NULL;
-static char *history_name = NULL;
+static char *options;
+static char *tag;
+static int tag_validated;
+static char *date;
+static char *join_rev1;
+static char *join_rev2;
+static int join_tags_validated;
+static char *preload_update_dir;
+static char *history_name;
static enum mtype m_type;
int
@@ -112,6 +112,18 @@
char *valid_options;
const char *const *valid_usage;
+ /* initialize static options */
+ force_tag_match = 1;
+ if (options)
+ {
+ free (options);
+ options = NULL;
+ }
+ tag = date = join_rev1 = join_rev2 = preload_update_dir = NULL;
+ history_name = NULL;
+ tag_validated = join_tags_validated = 0;
+
+
/*
* A smaller subset of options are allowed for the export command, which
* is essentially like checkout, except that it hard-codes certain
@@ -190,7 +202,7 @@
shorten = 1;
break;
case 's':
- status = 1;
+ cat = status = 1;
break;
case 'f':
force_tag_match = 0;
@@ -223,10 +235,10 @@
if (shorten == -1)
shorten = 0;
- if ((cat || status) && argc != 0)
+ if (cat && argc != 0)
error (1, 0, "-c and -s must not get any arguments");
- if (!(cat || status) && argc == 0)
+ if (!cat && argc == 0)
error (1, 0, "must specify at least one module or directory");
if (where && pipeout)
@@ -248,12 +260,12 @@
}
#endif
- if (!safe_location()) {
+ if (!cat && !pipeout && !safe_location( where )) {
error(1, 0, "Cannot check out files into the repository itself");
}
#ifdef CLIENT_SUPPORT
- if (client_active)
+ if (current_parsed_root->isremote)
{
int expand_modules;
@@ -269,7 +281,7 @@
below in !expand_modules), those files (CVS/Checkin.prog
or CVS/Update.prog) don't get created. Grrr. */
- expand_modules = (!cat && !status && !pipeout
+ expand_modules = (!cat && !pipeout
&& supported_request ("expand-modules"));
if (expand_modules)
@@ -296,7 +308,7 @@
if (checkout_prune_dirs && m_type == CHECKOUT)
send_arg("-P");
client_prune_dirs = checkout_prune_dirs;
- if (cat)
+ if (cat && !status)
send_arg("-c");
if (where != NULL)
option_with_arg ("-d", where);
@@ -329,11 +341,14 @@
}
#endif /* CLIENT_SUPPORT */
- if (cat || status)
+ if (cat)
{
cat_module (status);
if (options)
+ {
free (options);
+ options = NULL;
+ }
return (0);
}
db = open_module ();
@@ -351,27 +366,32 @@
/* If we will be calling history_write, work out the name to pass
it. */
- if (m_type == CHECKOUT && !pipeout)
+ if (!pipeout)
{
- if (tag && date)
+ if (!date)
+ history_name = tag;
+ else if (!tag)
+ history_name = date;
+ else
{
history_name = xmalloc (strlen (tag) + strlen (date) + 2);
sprintf (history_name, "%s:%s", tag, date);
}
- else if (tag)
- history_name = tag;
- else
- history_name = date;
}
for (i = 0; i < argc; i++)
err += do_module (db, argv[i], m_type, "Updating", checkout_proc,
- where, shorten, local, run_module_prog,
+ where, shorten, local, run_module_prog, !pipeout,
(char *) NULL);
close_module (db);
if (options)
+ {
free (options);
+ options = NULL;
+ }
+ if (history_name != tag && history_name != date && history_name != NULL)
+ free (history_name);
return (err);
}
@@ -379,9 +399,11 @@
reasons, probably want to move them. */
int
-safe_location ()
+safe_location (where)
+ char *where;
{
char *current;
+ char *where_location;
char hardpath[PATH_MAX+5];
size_t hardpath_len;
int x;
@@ -391,21 +413,80 @@
/* FIXME-arbitrary limit: should be retrying this like xgetwd.
But how does readlink let us know that the buffer was too small?
(by returning sizeof hardpath - 1?). */
- x = readlink(CVSroot_directory, hardpath, sizeof hardpath - 1);
+ x = readlink(current_parsed_root->directory, hardpath, sizeof hardpath - 1);
#else
x = -1;
#endif
if (x == -1)
{
- strcpy(hardpath, CVSroot_directory);
+ strcpy(hardpath, current_parsed_root->directory);
}
else
{
hardpath[x] = '\0';
}
+
+ /* set current - even if where is set we'll need to cd back... */
current = xgetwd ();
if (current == NULL)
error (1, errno, "could not get working directory");
+
+ /* if where is set, set current to where, where - last_component( where ),
+ * or fail, depending on whether the directories exist or not.
+ */
+ if( where != NULL )
+ {
+ if( chdir( where ) != -1 )
+ {
+ /* where */
+ where_location = xgetwd();
+ if( where_location == NULL )
+ error( 1, errno, "could not get working directory" );
+
+ if( chdir( current ) == -1 )
+ error( 1, errno, "could not change directory to `%s'", current );
+
+ free( current );
+ current = where_location;
+ }
+ else if( errno == ENOENT )
+ {
+ if ( last_component( where ) != where )
+ {
+ /* where - last_component( where ) */
+ char *parent;
+
+ /* strip the last_component */
+ where_location = strdup( where );
+ parent = last_component( where_location );
+ parent[-1] = '\0';
+
+ if( chdir( where_location ) != -1 )
+ {
+ where_location = xgetwd();
+ if( where_location == NULL )
+ error( 1, errno, "could not get working directory (nominally `%s')", where_location );
+
+ if( chdir( current ) == -1 )
+ error( 1, errno, "could not change directory to `%s'", current );
+
+ free( current );
+ current = where_location;
+ }
+ else
+ /* fail */
+ error( 1, errno, "could not change directory to requested checkout directory `%s'", where_location );
+ }
+ /* else: ERRNO == ENOENT & last_component(where) == where
+ * for example, 'cvs co -d newdir module', where newdir hasn't
+ * been created yet, so leave current set to '.' and check that
+ */
+ }
+ else
+ /* fail */
+ error( 1, errno, "could not change directory to requested checkout directory `%s'", where );
+ }
+
hardpath_len = strlen (hardpath);
if (strlen (current) >= hardpath_len
&& strncmp (current, hardpath, hardpath_len) == 0)
@@ -466,8 +547,8 @@
error (1, 0, "there is no repository %s", repository);
if (Create_Admin (".", dirpath, repository,
- sticky ? (char *) NULL : tag,
- sticky ? (char *) NULL : date,
+ sticky ? tag : (char *) NULL,
+ sticky ? date : (char *) NULL,
/* FIXME? This is a guess. If it is important
for nonbranch to be set correctly here I
@@ -529,11 +610,11 @@
/* Set up the repository (maybe) for the bottom directory.
Allocate more space than we need so we don't need to keep
reallocating this string. */
Home |
Main Index |
Thread Index |
Old Index