[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
patch: new 'cvs import -X' option.
From: |
Chris G. Demetriou |
Subject: |
patch: new 'cvs import -X' option. |
Date: |
22 Jun 2004 23:24:09 +0000 |
User-agent: |
Gnus/5.09 (Gnus v5.9.0) Emacs/21.3 |
Hi folks,
I've implemented a new 'cvs import' option, -X, which addresses a
problem which i commonly encounter when maintaining sources imported
into a CVS repository.
Background:
I typically do what i think of as 'normal' development w/ CVS. (Of
course! 8-) Specifically, that is: import on to a vendor branch.
Merge on to the main trunk. Also, periodically branch off of the main
trunk for several purposes (release branch, also to help with
difficult merges).
Fundamentally, there are two problems that occur when doing new
imports, following this model:
* the cvs/rcs default-branch behaviour means that after an
import, if you 'cvs update -PA' on the trunk, files which
have never been modified on the trunk get the latest version
from the vendor branch.
This can be overcome by using 'cvs commit -F' or by
otherwise resetting the default branch for every file in the
source tree, after every import.
* new files automatically show up on the branch.
There's no easy way to overcome this, short of
post-processing the list of imported files and using it to
'cvs delete' or otherwise tweak the sources.
If you post-process, there's still a time when your CVS tree
will be in a 'bad' state (i.e., a state where unintended
changes appear on the trunk, dur to the import).
I've attached a script that i've been using to post-process imports
for several years. It's not perfect (it doesn't respect CVS locking,
and it doesn't do client-server environments at all), but it's been
working for me.
The primary advantage of following a methodology that involves
importing using this script (or having CVS do the processing of the
script automatically) is that, on import, your trunk *does not
change*. No stray files show up on the trunk, and no files are
"upgraded" by the default-branch behaviour. What this means, among
other things, is that you can take a long long time to do your merge
and test it, before committing.
Doing this via post-processing has a few disadvantages:
* it adds steps to your 'cvs import' process,
* it leaves a (possibly short) period of time during which
your CVS tree is in a weird state, and
* of course, it's subject to *cough* limitations of the
post-processing implementation. ("Mine sucks." 8-)
The correct way to support this is by putting the functionality into
CVS itself. That way, new files are always created in the correct
state, it's easy to use as part of an import process (just use the
flag), and it works in all environments where CVS works.
Therefore, I've coded up a patch to put this into CVS. It's attached.
Includes documentation and test case.
I think it would be a good, valuable addition to CVS. (I also think
it makes the existing code a teensy bit cleaner, by extracting some
duplicated code into common functions -- i figured better to do that
than duplicate again!) I'm willing to make changes to the patch to
address feedback that you have.
What do you think?
cgd
--
New-feature entry for the NEWS file:
* `cvs import' now has a new option, `-X', which causes new files to be
imported in a way that they appear only on the vendor branch, and do not
automatically appear on the main trunk.
[ doc/ChangeLog ]
2004-06-22 Chris Demetriou <cgd@netbsd.org>
* cvs.texinfo (Vendor branch): Document that sometimes
the default branch won't be set to the vendor branch.
(import options): Add -X.
* cvsclient.texi (MT importmergecmd tag): Document that this
can also be used with the 'cvs import -X' command, and
that it can occur when there are no conflicts.
[ src/ChangeLog ]
2004-06-22 Chris Demetriou <cgd@broadcom.com>
* import.c (import_usage): Add new -X flag.
(import): Handle new -X flag.
(process_import_file): Handle new -X flag.
(killnew): New static flag variable to indicate use of -X flag.
(preserve_initial_permissions): New function, extracted from
add_rcs_file().
(expand_and_copy_contents): Likewise.
(add_rcs_file): New argument, do_killnew, to cause "import -X" flag
processing. Implement -X flag, and use newly abstracted functions.
* rcs.h (add_rcs_file): Update prototype for do_killnew argument.
* commit.c (checkaddfile): Update for add_rcs_file function change.
* mkmodules.c (init): Likewise.
* client.c (handle_mt): Handle an importmergecmd tag without
any conflicts (for 'import -X' support).
* sanity.sh (importX): New test.
cvsimport_killnew
Description: Text document
DIFFS-1.12.9-submit
Description: Text document
- patch: new 'cvs import -X' option.,
Chris G. Demetriou <=
- Re: patch: new 'cvs import -X' option., Chris G. Demetriou, 2004/06/22
- Re: patch: new 'cvs import -X' option., Mark D. Baushke, 2004/06/22
- Re: patch: new 'cvs import -X' option., Chris G. Demetriou, 2004/06/22
- Re: patch: new 'cvs import -X' option., Chris G. Demetriou, 2004/06/24
- Re: patch: new 'cvs import -X' option., Chris G. Demetriou, 2004/06/24
- Re: patch: new 'cvs import -X' option., Mark D. Baushke, 2004/06/26
- Re: patch: new 'cvs import -X' option., cgd, 2004/06/27
- new ForceImportKillNewFiles 'config' option., cgd, 2004/06/27
- Re: new ForceImportKillNewFiles 'config' option., cgd, 2004/06/27
- Re: new ForceImportKillNewFiles 'config' option., Mark D. Baushke, 2004/06/27