History log of /openbsd-current/usr.bin/cvs/commit.c
Revision (<<< Hide revision tags) (Show revision tags >>>) Date Author Comments
# 1.160 28-Jun-2019 deraadt

When system calls indicate an error they return -1, not some arbitrary
value < 0. errno is only updated in this case. Change all (most?)
callers of syscalls to follow this better, and let's see if this strictness
helps us in the future.


Revision tags: OPENBSD_6_5_BASE
# 1.159 30-Dec-2018 guenther

Delete unnecessary <libgen.h> #includes

ok deraadt@


Revision tags: OPENBSD_6_2_BASE OPENBSD_6_3_BASE OPENBSD_6_4_BASE
# 1.158 01-Jun-2017 joris

Stop looking at current_cvsroot->cr_method to figure out if we're remote or not.

Instead use cvsroot_is_local() and cvsroot_is_remote().


# 1.157 31-May-2017 joris

Do not use CVS_LOCK_REPO for committing.

This flag tells our file recursion code that for each directory entered
we should lock it. Commit however locks all relevant directories on its
own when it is about to make changes and should not depend on the file
recursion code to do so.


# 1.156 28-May-2017 joris

Don't allow opencvs to commit towards tags that are not branches.

Gets rid of the old logic that wasn't working and replaced it with
a simplified version.

ok stsp@


Revision tags: OPENBSD_6_1_BASE
# 1.155 13-Oct-2016 fcambus

rcsnum_free() -> free() cleanups. From Michael W. Bombardieri.

OK millert@


Revision tags: OPENBSD_5_9_BASE OPENBSD_6_0_BASE
# 1.154 05-Nov-2015 nicm

Remove xfree(), like already done for RCS. From Michael W Bombardieri,
ok mmcc


Revision tags: OPENBSD_5_7_BASE OPENBSD_5_8_BASE
# 1.153 16-Jan-2015 deraadt

Replace <sys/param.h> with <limits.h> and other less dirty headers where
possible. Annotate <sys/param.h> lines with their current reasons. Switch
to PATH_MAX, NGROUPS_MAX, HOST_NAME_MAX+1, LOGIN_NAME_MAX, etc. Change
MIN() and MAX() to local definitions of MINIMUM() and MAXIMUM() where
sensible to avoid pulling in the pollution. These are the files confirmed
through binary verification.
ok guenther, millert, doug (helped with the verification protocol)


Revision tags: OPENBSD_5_1_BASE OPENBSD_5_2_BASE OPENBSD_5_3_BASE OPENBSD_5_4_BASE OPENBSD_5_5_BASE OPENBSD_5_6_BASE
# 1.152 27-Dec-2011 nicm

Move some global variables/statics to locals, from Michael W
Bombardieri.


Revision tags: OPENBSD_5_0_BASE
# 1.151 20-Apr-2011 nicm

Trivial code simplifying, from Michael W Bombardieri.


Revision tags: OPENBSD_4_8_BASE OPENBSD_4_9_BASE
# 1.150 23-Jul-2010 ray

Reduce variable/function name and whitespace differences between
cvs/rcs.

OK xsa zinovik


Revision tags: OPENBSD_4_6_BASE OPENBSD_4_7_BASE
# 1.149 07-Jun-2009 ray

More cvs/diff/rcs convergence:
1. Mostly variable/function renaming, SIZE_T_MAX->SIZE_MAX, and
spacing.
2. One strchr -> strncspn.
3. diff had a weird thing where it set file[12] = ofile[12] but
never updated file or ofile, then if file and ofile were different
it freed it. I removed it.

OK millert


# 1.148 06-Jun-2009 ray

Sync some rcsdiff changes to cvsdiff. As a side effect,
cvs diff -t now works. There should be no functional change
otherwise.

OK millert


# 1.147 26-Mar-2009 joris

fix the way Attic is handled in our recursion code, so we
do not skip files or run over them twice.

also fixes -l and -r for checkout/update when a file in
Attic exists with that tag that in HEAD is a directory
in the normal repository like gnu/usr.bin/gcc/INSTALL.

as a bonus, we do not run fstat() twice per file or dir
anymore...

spotted by deraadt@


# 1.146 25-Mar-2009 joris

switch our file and directory lists to RB trees (see tree(3)),
so we can benefit from faster lookup times while recursing.


Revision tags: OPENBSD_4_5_BASE
# 1.145 29-Aug-2008 tobias

Pre-commit checks (CVSROOT/commitinfo) are run before log message is
requested. Do this for GNU cvs compatibility, too.

ok joris


Revision tags: OPENBSD_4_4_BASE
# 1.144 08-Jul-2008 joris

make these compile cleanly


# 1.143 15-Jun-2008 tobias

Support the addition of new files in branches.

ok joris


# 1.142 14-Jun-2008 tobias

Conforming to RCS specification, it is possible but unlikely to encounter
an RCS file which has no head revision set. Some commands actually can
work with them (log, status) so support these files. Fixes A LOT of
possible segmentation faults.

ok joris


# 1.141 14-Jun-2008 joris

don't always re-open the same CVS/Entries file, instead keep the
last opened CVS/Entries around to operate on and close it whenever
we switch directory. gives us a small performance boost, obviously.

while doing this, switch the way we write revisions to disk by
using fwrite(3) so stuff can get written to disk in chunks
instead of writing everything line by line, another win.

with help from otto@
ok tobias@


# 1.140 10-Jun-2008 joris

set tag_new if its available so it can get passed to loginfo


# 1.139 10-Jun-2008 joris

switch back to a single log message in local mode so we are compliant
with a remote setup.

fixes a very annoying bug with loginfo as well.

ok tobias@


# 1.138 10-Jun-2008 joris

style


# 1.137 10-Jun-2008 joris

New trigger framework that allows us to run the required scripts
defined in CVSROOT/commitinfo and CVSROOT/loginfo and so on.

This enables the use of log_accum2 and all that other nice stuff we like.

This was mostly written by Jonathan Armani with help from tobias@ and myself.

ok tobias@


# 1.136 09-Jun-2008 tobias

Properly handle merged files and conflicts which may arrise while merge.
Instead of ignoring all files which contain possible conflict markers,
only watch out for files which have actually been merged.

With input by and ok joris.


# 1.135 08-Jun-2008 tobias

Handle commits on a per-directory basis instead handling all of them at
once in local setup. Also added '!' to reuse typed log message for all
following directories.

ok joris


# 1.134 08-Jun-2008 tobias

Properly build up path to description files (descr entry in RCS files if
you add a file with -m message).

ok joris


# 1.133 17-May-2008 tobias

Full support of branches added. We lacked proper support of multiple
branch entry points in one revision as well as branches which started from
other branches.

ok joris


# 1.132 09-Mar-2008 joris

proper repository locking:
- all read operations now look for a lock, and wait if present but never
try to lock the tree themselfs anymore.
- all write operations lock the tree where needed.
- commit locks all relevant directories before even attempting to start.


Revision tags: OPENBSD_4_3_BASE
# 1.131 27-Feb-2008 joris

prevent file races

ok tobias@


# 1.130 20-Feb-2008 tobias

With latest buf cleanup, rcs_rev_getbuf won't return NULL anymore.

OK joris@


# 1.129 11-Feb-2008 tobias

Cleanup buf implementation:

* Don't check for NULL on buffer creation, because it calls fatal() when
something's wrong.
* All buffers are supposed to expand if there is no space left in them,
so zap flags as well.
* Remove code that is now dead.

OK joris@

> Inspired by a diff from Igor Zinovik about unchecked return value.


# 1.128 10-Feb-2008 joris

do not allow commits to files that have a sticky date set


# 1.127 04-Feb-2008 joris

CVSROOT/modules:

correct -i and -o usage

-i runs the program specified on commit
-o runs the program specified on checkout


# 1.126 04-Feb-2008 tobias

Added -k flag support for all commands which support it.

OK joris@


# 1.125 31-Jan-2008 joris

free RCSNUM's when we are done with them;

ok tobias@


# 1.124 31-Jan-2008 tobias

Replaced the unused cvs_command variable cmd_req with cmd_flags, which states
if the current command is supposed to use a working directory or if it is a
repository-only command (as of now checkout -p, rtag, rlog).

Makes the code simpler, easier to read and automagically fixes some issues
we encountered with these commands (for example if a working directory
exists, or "." operations are performed).

OK joris@, niallo@


# 1.123 29-Jan-2008 tobias

Properly free dynamically allocated memory. Also skip needless checks.

> Diff from Igor Zinovik


# 1.122 28-Jan-2008 tobias

Zapped some variables which made the source harder to read (and to verify).

> Diff from Igor Zinovik


# 1.121 28-Jan-2008 tobias

checkout's options -m and -F are mutually exclusive. Also watch out to
properly free arguments if options are supplied multiple times.

OK ray@

> Diff from Igor Zinovik


# 1.120 28-Jan-2008 tobias

Properly handle -R -- although it is default, it may be overwritten mit -l
in front of it.

OK joris@, xsa@

> Diff from Igor Zinovik


# 1.119 13-Jan-2008 tobias

Revision buffers are supposed to be of size CVS_REV_BUFSZ (32) instead
of 24.

OK xsa@

> Diff from Igor Zinovik.


# 1.118 13-Jan-2008 tobias

Typos fixed.

OK xsa@

> Diff from Igor Zinovik.


# 1.117 10-Jan-2008 tobias

Our keyword expansion had a big flaw, due to this construction:
if (!(mode & RCS_KWEXP_NONE))

RCS_KWEXP_NONE is defined to 0, so expansion happened always.

Left shifted all RCS_KWEXP defines and looked carefully at hard-coded values
throughout the code.


# 1.116 10-Jan-2008 tobias

RCS files without head keyword mustn't segfault our implementation. Only
command that supports such files is "cvs status", therefore properly handle
them in all other commands, too.


# 1.115 08-Oct-2007 joris

do not try to reset the default branch if the RCS file
does not exist, fixes a segfault when commiting a new file.

found by tobias@ who is going to make a nice little regression test for this.


# 1.114 03-Oct-2007 joris

reset the default branch early on so rcs_head_get() does not screw us up
and returns a possibly wrong revision as 'current revision'.

noticed by tobias@ his regress testing


# 1.113 24-Sep-2007 joris

unused vars


# 1.112 24-Sep-2007 joris

add support to commit modified files to branches.


# 1.111 23-Sep-2007 joris

make sure when running update -r on existing files to overwrite
the sticky directory tag with it. since -r gets priority.


# 1.110 22-Sep-2007 joris

better branching/sticky tag support, no branch commits yet though.


# 1.109 30-Aug-2007 joris

properly send our log message to the server using Argumentx, so we
no longer break when the log message has multiple lines.

from Tobias Stoeckmann, thanks for doing my work!


Revision tags: OPENBSD_4_2_BASE
# 1.108 28-Jun-2007 joris

When commiting to a server in a remote setup classify
the files based upon their entry in CVS/Entries instead of
using the local classifying code and trying to locate the RCSfile
on our local disks, which ofc does not work correctly.

OK niallo@


# 1.107 18-Jun-2007 joris

first stab at history stuff for opencvs, currently only writes
to CVSROOT/history but cannot parse it yet with the 'history' command.

"Commit it." ray@


# 1.106 01-Jun-2007 niallo

add support for local and remote branch checkout. for example,
cvs co -rOPENBSD_3_0 works now.
along the way, simplify and rationalise code and fix a few nits.

ok joris@ xsa@ ray@


Revision tags: OPENBSD_4_1_BASE
# 1.105 22-Feb-2007 otto

general includes cleanup sweep. ok joris@ niallo@


# 1.104 09-Feb-2007 joris

remove the cvs_file_classify() `loud' argument, it was used
in the old school days and serves no purpose what so ever now.

otto@ mentioned this to me a while ago


# 1.103 01-Feb-2007 otto

change mode of a newly created rcs file in the repository to 0444
ok jorix@ xsa@


# 1.102 31-Jan-2007 xsa

snprintf() -> xsnprintf()


# 1.101 26-Jan-2007 xsa

- support [-k mode] for the add command
- do not let the file keyword expension options (-k) disappear
from the Entries file when doing a commit/update/checkout
- be sure the expension mode gets written to the RCS file when a file
is added/committed in the first place
problems raised by otto@; tests/ok otto@ and joris@.


# 1.100 25-Jan-2007 otto

use more stack allocations for fixed size buffers. ok xsa@ joris@


# 1.99 18-Jan-2007 xsa

send -l Argument to server when appropriate.


# 1.98 14-Jan-2007 joris

move things around in rcs_rev_getbuf() and rcs_rev_write_fd()
so that we do keyword expansion on-the-fly if required instead
of obtaining the revision in memory first, running over the revision
lines while expanding keywords and only then writing them to the fd
or memory buffer.

this drasticly decreases cpu usage by opencvs on very large trees (like src).

OK niallo@


# 1.97 13-Jan-2007 joris

switch commit code to the new RCS api.
kay niallo@


# 1.96 13-Jan-2007 joris

plug 3 memleaks


# 1.95 13-Jan-2007 joris

remove BUF * argument from cvs_checkout_file() it will
no longer be used, ever.


# 1.94 12-Jan-2007 niallo

major re-work of the RCS api. this results in 100x performance improvements in some places and much
reduced memory usage. note that only checkout has been fully converted to use the new high-performance
functions. other codepaths (e.g. update) still use the old method which is provided for backwards
compatibility. we can convert the remaining slow bits over to the new api piece-by-piece.

"commit this, now" joris@
brad@ tested, too.


# 1.93 12-Jan-2007 joris

do not leak memory from rcs_head_get()

ok niallo@


# 1.92 12-Jan-2007 joris

if we have no files to be commited, stop commiting.


# 1.91 12-Jan-2007 joris

complete binary support for opencvs,
adding/importing binary files now works too

partially taken from openrcs


# 1.90 11-Jan-2007 jasper

silence some warnings.

ok joris@


# 1.89 11-Jan-2007 joris

in a remote setup:
do not connect to the remote server until we are sure all the options
passed to the commands are valid.

noticed by xsa@


# 1.88 07-Jan-2007 joris

use cvs_logmsg_read() for -F for simplicity.


# 1.87 07-Jan-2007 joris

free the filelists we pass to cvs_logmsg_create()
after we obtain our logmessage.


# 1.86 07-Jan-2007 joris

rewrite of the logmessage code, which allows you to
enter a logmessage into your favorite editor when commiting.


# 1.85 03-Jan-2007 joris

add support for 'remove' in a remote setup.
testing appriciated, as always.


# 1.84 03-Jan-2007 joris

if we are commiting a file, do not let the server resend it
with an 'Updated' response, seeing as the client will already have the
latest version. Instead, send the correct 'Checked-in' response.


# 1.83 02-Jan-2007 joris

- fix cvs_client_remove_entry to correctly handle the passed data
- when commiting in a remote setup, allow the opencvs server to send
the correct response to the client when a file has been removed


# 1.82 31-Dec-2006 xsa

minor nits;


Revision tags: OPENBSD_4_0_BASE
# 1.81 08-Jul-2006 ray

Remove file mode argument from {cvs|rcs}_buf_write_stmp(). We
always set the temporary file to mode 600, which is already done
by mkstemp().

OK joris@ and xsa@ over a month ago.


# 1.80 07-Jul-2006 joris

first part of opencvs remote, fairly useable on existing trees
although i advise against using it on real development trees for now.

only a few commands work right so far:
- commit
- diff
- status
- log
- update (partially working)

if you feel like testing remote and run into bugs feel free to
contact me, and please include a full trace (-t).


# 1.79 02-Jul-2006 joris

- abort the commit when files are not correctly up to date.
- do not try to attempt to check for conflict markers when the file is not on disk.

found by and okay reyk@


# 1.78 29-Jun-2006 joris

it is a really good idea to store the result cvs_buf_load_fd returns
in bp, considering we depend on that.

found by reyk who is now my favorite german person, 10x.


# 1.77 28-Jun-2006 reyk

print less verbose messages for cvs commit and add if the -q/-Q flag
has been specified.

ok joris@


# 1.76 28-Jun-2006 joris

do not fail when we are trying to commit a newly added file when the CVS/*,t
file is not present for the file.

spotted and tested by reyk@
okay xsa@


# 1.75 19-Jun-2006 joris

kill local and remote callback and just have one called fileproc.
we let the commands pass the correct function.

all in preparation for remote.


# 1.74 16-Jun-2006 joris

in preparation for the new remote code, proto.h becomes obsolete.


# 1.73 14-Jun-2006 joris

add cvs_buf_load_fd() which does the same as cvs_buf_load()
except it takes a decriptor as argument instead of a path.

modified cvs_buf_load() to open the descriptor then pass
it to cvs_buf_load_fd().

change all the calls to cvs_buf_load() that have a descriptor
open for the path to cvs_buf_load_fd() to prevent races.


# 1.72 13-Jun-2006 joris

files that are not checked out are not up-to-date, consider
this a conflict and block the commit when we encounter any of these.

and make an error message a bit more fluffy and accurate.


# 1.71 07-Jun-2006 xsa

add support for <name>,t file:
- add: creates <name>,t file with initial description if -m option was used.
- commit: uses <name>,t content (if it exists) to set the file description
OK joris@.


# 1.70 06-Jun-2006 joris

hello commit -F support


# 1.69 04-Jun-2006 joris

sprinkle -n voodoo over the add, commit and import commands.


# 1.68 01-Jun-2006 joris

major rewrite of some rcs parsing stuff:

- rework rcs_getrev() to correctly support branches
- rework rcs_translate_tag() to correctly translate given symbols or
branches into their matching revisions
- rework rcs_rev_add() to correctly update its 'next' pointers
and insert the new revision in the correct place on the list.
- rework rcs_head_get() to return the latest revision on the default
branch if it has been set or the normal HEAD revision otherwise.
- no longer access the rf_head member of the RCSFILE struct manually,
use the rcs_head_get() function which correctly returns the HEAD
revision, there might be a default branch that has to be used.
- for now, when commiting a new revision reset the default branch.


# 1.67 31-May-2006 joris

when adding a new file that already exists set the previous
deltatext (the dead revision) to the correct rcs diff if the file
was modified in any way.


# 1.66 31-May-2006 joris

allow commit to ressurect added files that exist in Attic/


# 1.65 30-May-2006 joris

fill in the correct revision number we will want in file_rcsrev
for each cvs_file struct, this will help us with sticky tags,
commiting to branches and importing into existing repositories.


# 1.64 30-May-2006 joris

the moment we are done commiting a removed file, move the RCS file
into the Attic and out of our way.


# 1.63 28-May-2006 joris

enable basic add command, only works on files right now.


# 1.62 28-May-2006 joris

allow commands to shut up the output from cvs_file_classify
if the commands want to output certain stuff themselfs


# 1.61 28-May-2006 joris

teach opencvs ci how to commit files that have been added,
opencvs can now commit modified files, removed files and added files.

hip hip hurray!


# 1.60 28-May-2006 joris

enable merging on update. if your file in your working copy
has been modified by yourself and there is a newer revision
we try and merge them together.

if the merge fails and has conflicts it will mark them inside
the file, you will need to resolve these by hand first before
you will be able to commit your modified file.

works transparent with gnu cvs, as it is suppose to.


# 1.59 27-May-2006 joris

show which directory we are examining in our pre-commit checks.


# 1.58 27-May-2006 joris

allow commands to respect the -l flag, if the -l flag is
specified certain commands will not recurse into directories.

at the same time introduce a method of specifying wether or not
a command should look in the repository for files.


# 1.57 27-May-2006 joris

dont allow commit to continue if the file that is being
commited needs to be updated or merged first.


# 1.56 27-May-2006 joris

commiting removed files now works


# 1.55 27-May-2006 joris

commit the new opencvs code, i have been hacking on
this for the past 2 weeks now and it should go in at
the start of the hackathon so others can help out.

this code is a lot safer, smarter, faster and best of
all it is actually doing what it is suppose to do!

basic checkout, update, status, diff and commit are
working in local mode only.
there is no support for any remote setups now.


# 1.54 14-Apr-2006 deraadt

remove a metric buttload of excessive ()
no binary change; ok ray


# 1.53 01-Apr-2006 joris

fix some bugs that lint discovered for us.
ok niallo@


# 1.52 16-Mar-2006 xsa

zap more unused variables.


Revision tags: OPENBSD_3_9_BASE
# 1.51 02-Jan-2006 xsa

#include's cleanup; ok joris@ niallo@.


# 1.50 30-Dec-2005 joris

major cleanup of the functions handling the remote cvs protocol.
makes the code a lot more readable and understandable.

ok xsa@ and niallo@


# 1.49 22-Dec-2005 xsa

cvs_rcs_getpath() cannot fail anymore;


# 1.48 21-Dec-2005 xsa

cvs_logmsg_open() and cvs_logmsg_get() cannot fail anymore;


# 1.47 10-Dec-2005 joris

switch to xmalloc stuff, me and xsa@ agreed on this a long
time ago, but we were being held back by jfb. too bad for him.

next step is to use fatal() through out the code for unrecoverable
errors instead of trying to be all nice and fluffy and reach main() again.

ok niallo@ and xsa@


Revision tags: OPENBSD_3_8_BASE
# 1.46 27-Jul-2005 xsa

use LP_NOTICE instead of LP_INFO where appropriate;


# 1.45 25-Jul-2005 xsa

KNF;


# 1.44 23-Jul-2005 joris

rewrite of the file code. the previous one was just
a mess and not clean.
this code is much cleaner, faster, and uses less memory overall.

tested by xsa@, brad@, Michael Knudsen, and myself.
okay xsa@


# 1.43 23-Jul-2005 joris

correctly seperate added, modified and removed files for use in the
construction of the log message in the editor.

ok jfb@


# 1.42 22-Jul-2005 joris

use the cf_name field of the CVSFILE struct instead of using the old
CVS_FILE_NAME macro. This macro used to be nifty because of all
the referencing for the names, but since we don't do that anymore and
use cf_name directly... byebye CVS_FILE_NAME()

okay xsa@


# 1.41 19-Jul-2005 joris

unbreak the commit command.


# 1.40 14-Jul-2005 xsa

use cvs_rcs_getpath();


# 1.39 12-Jul-2005 xsa

split this into cvs_commit_{remote,local}() functions;
ok jfb@ (Yes, Yes he IS back!!)


# 1.38 07-Jul-2005 joris

remove trailing whitespaces

from deraadt@


# 1.37 31-May-2005 xsa

headers ordering (alphabetically) and cleanup, from mbalmer@ and myself;


# 1.36 30-May-2005 joris

don't forget to send the log message, this fixes the commit command.

ok xsa@


# 1.35 30-May-2005 xsa

handle -r option; ok joris@


# 1.34 24-May-2005 jfb

Merge the cvs_cmd and cvs_cmd_info structures and add the necessary
fields to hook local versions of the commands. This needs to go in
before it gets any bigger

ok joris


# 1.33 20-May-2005 joris

correct wrong error code usage.

ok jfb@, xsa@


# 1.32 20-May-2005 joris

execute the command callback at the same time we are building
the in-memory filelist. cuts down on execution time for larger trees.

"put it in!" jfb@


# 1.31 24-Apr-2005 joris

don't send a Modified request and the file its contents when
it has been removed.


# 1.30 24-Apr-2005 joris

add missing CVS_CMD_ALLOWSPEC flag


# 1.29 19-Apr-2005 jfb

handle removed files as well when checking files to commit

ok joris


# 1.28 19-Apr-2005 joris

remove debug code


# 1.27 19-Apr-2005 joris

make sure we pick up newly added files.


# 1.26 18-Apr-2005 jfb

Modify the CVSFILE structure using a union to keep information about
both files and directories. We can now keep the revision number for
regular files, and don't need to fetch the appropriate entry in the
command callbacks. This saves a huge amount of parsing on Entries
files.

ok joris@


# 1.25 16-Apr-2005 xsa

missing cvs_ent_free(); joris ok


# 1.24 15-Apr-2005 xsa

snprintf() return values checks; joris ok


# 1.23 12-Apr-2005 joris

introduce our own set of error codes used by the commands to report
what exactly went wrong in case of an error.

ok jfb@


# 1.22 11-Apr-2005 joris

don't include sysexits.h now we don't use those error codes
anymore.


# 1.21 11-Apr-2005 joris

remove EX_USAGE error codes

ok jfb@


# 1.20 03-Apr-2005 xsa

first round of EX_* exit codes removal; ok joris@.


# 1.19 31-Mar-2005 joris

fix prototype for cvs_commit_prepare()


# 1.18 30-Mar-2005 joris

move all the client commands to the new command framework.
eliminates a lot of duplicate code.

ok jfb@


# 1.17 29-Mar-2005 joris

fix memleak

ok jfb@


Revision tags: OPENBSD_3_7_BASE
# 1.16 02-Mar-2005 joris

- make sure we are using a remote method before calling
cvs_sendreq() and cvs_sendfile().
- don't leak entp on errors.

ok jfb@


# 1.15 22-Feb-2005 jfb

more error checking on protocol calls when running in client mode


# 1.14 13-Jan-2005 jfb

more widespread use of cvs_msg, and free it when we are done

diff by Joris Vink and me


# 1.13 21-Dec-2004 jfb

modify the directory handling portion to behave like the one in add.c,
which does not attempt to send data when running on a local
repository. This will be needed to support local repository access


# 1.12 14-Dec-2004 jfb

First attempt at syncing the command code and doing a lot more error
checking on all the protocol calls


# 1.11 13-Dec-2004 jfb

return early if no files are ready to be commited


# 1.10 08-Dec-2004 jfb

embrace and extend (!) cvs_logmsg_get() so we can now display
information based on its availability and have separate sections for
the Added, Modified and Removed file lists. this will allow us to
use the same call for add, commit, import and possibly others

Original patch by Joris Vink, some rework from me for the other
sections


# 1.9 07-Dec-2004 tedu

less whitespace, more pretty. ok jfb


# 1.8 06-Dec-2004 deraadt

tighten vertical spacing for else; jfb ok


# 1.7 02-Dec-2004 jfb

This commit is brought to you by the brand new improved and better tasting
OpenCVS commit code.


# 1.6 26-Nov-2004 jfb

Rewrite the internals of the file management code so that we do not keep
a full path to each file we load, and cache file names so we can have
multiple references to a single name. This saves a lot of memory on large
trees such as /usr/src, especially on 'Makefile', 'README' and such.


# 1.5 09-Nov-2004 krapht

Better handling of log message input and removal of crufty code


# 1.4 09-Nov-2004 krapht

at least compile


# 1.3 09-Nov-2004 krapht

Editor invocation code, still needs some work


# 1.2 30-Jul-2004 jfb

Move to the new API for the client-server protocol. All functions now
take a cvs root structure as parameter. This will allow for much easier
management of CVS trees that make use of multiple roots.


# 1.1 13-Jul-2004 jfb

branches: 1.1.1;
Initial revision


# 1.159 30-Dec-2018 guenther

Delete unnecessary <libgen.h> #includes

ok deraadt@


Revision tags: OPENBSD_6_2_BASE OPENBSD_6_3_BASE OPENBSD_6_4_BASE
# 1.158 01-Jun-2017 joris

Stop looking at current_cvsroot->cr_method to figure out if we're remote or not.

Instead use cvsroot_is_local() and cvsroot_is_remote().


# 1.157 31-May-2017 joris

Do not use CVS_LOCK_REPO for committing.

This flag tells our file recursion code that for each directory entered
we should lock it. Commit however locks all relevant directories on its
own when it is about to make changes and should not depend on the file
recursion code to do so.


# 1.156 28-May-2017 joris

Don't allow opencvs to commit towards tags that are not branches.

Gets rid of the old logic that wasn't working and replaced it with
a simplified version.

ok stsp@


Revision tags: OPENBSD_6_1_BASE
# 1.155 13-Oct-2016 fcambus

rcsnum_free() -> free() cleanups. From Michael W. Bombardieri.

OK millert@


Revision tags: OPENBSD_5_9_BASE OPENBSD_6_0_BASE
# 1.154 05-Nov-2015 nicm

Remove xfree(), like already done for RCS. From Michael W Bombardieri,
ok mmcc


Revision tags: OPENBSD_5_7_BASE OPENBSD_5_8_BASE
# 1.153 16-Jan-2015 deraadt

Replace <sys/param.h> with <limits.h> and other less dirty headers where
possible. Annotate <sys/param.h> lines with their current reasons. Switch
to PATH_MAX, NGROUPS_MAX, HOST_NAME_MAX+1, LOGIN_NAME_MAX, etc. Change
MIN() and MAX() to local definitions of MINIMUM() and MAXIMUM() where
sensible to avoid pulling in the pollution. These are the files confirmed
through binary verification.
ok guenther, millert, doug (helped with the verification protocol)


Revision tags: OPENBSD_5_1_BASE OPENBSD_5_2_BASE OPENBSD_5_3_BASE OPENBSD_5_4_BASE OPENBSD_5_5_BASE OPENBSD_5_6_BASE
# 1.152 27-Dec-2011 nicm

Move some global variables/statics to locals, from Michael W
Bombardieri.


Revision tags: OPENBSD_5_0_BASE
# 1.151 20-Apr-2011 nicm

Trivial code simplifying, from Michael W Bombardieri.


Revision tags: OPENBSD_4_8_BASE OPENBSD_4_9_BASE
# 1.150 23-Jul-2010 ray

Reduce variable/function name and whitespace differences between
cvs/rcs.

OK xsa zinovik


Revision tags: OPENBSD_4_6_BASE OPENBSD_4_7_BASE
# 1.149 07-Jun-2009 ray

More cvs/diff/rcs convergence:
1. Mostly variable/function renaming, SIZE_T_MAX->SIZE_MAX, and
spacing.
2. One strchr -> strncspn.
3. diff had a weird thing where it set file[12] = ofile[12] but
never updated file or ofile, then if file and ofile were different
it freed it. I removed it.

OK millert


# 1.148 06-Jun-2009 ray

Sync some rcsdiff changes to cvsdiff. As a side effect,
cvs diff -t now works. There should be no functional change
otherwise.

OK millert


# 1.147 26-Mar-2009 joris

fix the way Attic is handled in our recursion code, so we
do not skip files or run over them twice.

also fixes -l and -r for checkout/update when a file in
Attic exists with that tag that in HEAD is a directory
in the normal repository like gnu/usr.bin/gcc/INSTALL.

as a bonus, we do not run fstat() twice per file or dir
anymore...

spotted by deraadt@


# 1.146 25-Mar-2009 joris

switch our file and directory lists to RB trees (see tree(3)),
so we can benefit from faster lookup times while recursing.


Revision tags: OPENBSD_4_5_BASE
# 1.145 29-Aug-2008 tobias

Pre-commit checks (CVSROOT/commitinfo) are run before log message is
requested. Do this for GNU cvs compatibility, too.

ok joris


Revision tags: OPENBSD_4_4_BASE
# 1.144 08-Jul-2008 joris

make these compile cleanly


# 1.143 15-Jun-2008 tobias

Support the addition of new files in branches.

ok joris


# 1.142 14-Jun-2008 tobias

Conforming to RCS specification, it is possible but unlikely to encounter
an RCS file which has no head revision set. Some commands actually can
work with them (log, status) so support these files. Fixes A LOT of
possible segmentation faults.

ok joris


# 1.141 14-Jun-2008 joris

don't always re-open the same CVS/Entries file, instead keep the
last opened CVS/Entries around to operate on and close it whenever
we switch directory. gives us a small performance boost, obviously.

while doing this, switch the way we write revisions to disk by
using fwrite(3) so stuff can get written to disk in chunks
instead of writing everything line by line, another win.

with help from otto@
ok tobias@


# 1.140 10-Jun-2008 joris

set tag_new if its available so it can get passed to loginfo


# 1.139 10-Jun-2008 joris

switch back to a single log message in local mode so we are compliant
with a remote setup.

fixes a very annoying bug with loginfo as well.

ok tobias@


# 1.138 10-Jun-2008 joris

style


# 1.137 10-Jun-2008 joris

New trigger framework that allows us to run the required scripts
defined in CVSROOT/commitinfo and CVSROOT/loginfo and so on.

This enables the use of log_accum2 and all that other nice stuff we like.

This was mostly written by Jonathan Armani with help from tobias@ and myself.

ok tobias@


# 1.136 09-Jun-2008 tobias

Properly handle merged files and conflicts which may arrise while merge.
Instead of ignoring all files which contain possible conflict markers,
only watch out for files which have actually been merged.

With input by and ok joris.


# 1.135 08-Jun-2008 tobias

Handle commits on a per-directory basis instead handling all of them at
once in local setup. Also added '!' to reuse typed log message for all
following directories.

ok joris


# 1.134 08-Jun-2008 tobias

Properly build up path to description files (descr entry in RCS files if
you add a file with -m message).

ok joris


# 1.133 17-May-2008 tobias

Full support of branches added. We lacked proper support of multiple
branch entry points in one revision as well as branches which started from
other branches.

ok joris


# 1.132 09-Mar-2008 joris

proper repository locking:
- all read operations now look for a lock, and wait if present but never
try to lock the tree themselfs anymore.
- all write operations lock the tree where needed.
- commit locks all relevant directories before even attempting to start.


Revision tags: OPENBSD_4_3_BASE
# 1.131 27-Feb-2008 joris

prevent file races

ok tobias@


# 1.130 20-Feb-2008 tobias

With latest buf cleanup, rcs_rev_getbuf won't return NULL anymore.

OK joris@


# 1.129 11-Feb-2008 tobias

Cleanup buf implementation:

* Don't check for NULL on buffer creation, because it calls fatal() when
something's wrong.
* All buffers are supposed to expand if there is no space left in them,
so zap flags as well.
* Remove code that is now dead.

OK joris@

> Inspired by a diff from Igor Zinovik about unchecked return value.


# 1.128 10-Feb-2008 joris

do not allow commits to files that have a sticky date set


# 1.127 04-Feb-2008 joris

CVSROOT/modules:

correct -i and -o usage

-i runs the program specified on commit
-o runs the program specified on checkout


# 1.126 04-Feb-2008 tobias

Added -k flag support for all commands which support it.

OK joris@


# 1.125 31-Jan-2008 joris

free RCSNUM's when we are done with them;

ok tobias@


# 1.124 31-Jan-2008 tobias

Replaced the unused cvs_command variable cmd_req with cmd_flags, which states
if the current command is supposed to use a working directory or if it is a
repository-only command (as of now checkout -p, rtag, rlog).

Makes the code simpler, easier to read and automagically fixes some issues
we encountered with these commands (for example if a working directory
exists, or "." operations are performed).

OK joris@, niallo@


# 1.123 29-Jan-2008 tobias

Properly free dynamically allocated memory. Also skip needless checks.

> Diff from Igor Zinovik


# 1.122 28-Jan-2008 tobias

Zapped some variables which made the source harder to read (and to verify).

> Diff from Igor Zinovik


# 1.121 28-Jan-2008 tobias

checkout's options -m and -F are mutually exclusive. Also watch out to
properly free arguments if options are supplied multiple times.

OK ray@

> Diff from Igor Zinovik


# 1.120 28-Jan-2008 tobias

Properly handle -R -- although it is default, it may be overwritten mit -l
in front of it.

OK joris@, xsa@

> Diff from Igor Zinovik


# 1.119 13-Jan-2008 tobias

Revision buffers are supposed to be of size CVS_REV_BUFSZ (32) instead
of 24.

OK xsa@

> Diff from Igor Zinovik.


# 1.118 13-Jan-2008 tobias

Typos fixed.

OK xsa@

> Diff from Igor Zinovik.


# 1.117 10-Jan-2008 tobias

Our keyword expansion had a big flaw, due to this construction:
if (!(mode & RCS_KWEXP_NONE))

RCS_KWEXP_NONE is defined to 0, so expansion happened always.

Left shifted all RCS_KWEXP defines and looked carefully at hard-coded values
throughout the code.


# 1.116 10-Jan-2008 tobias

RCS files without head keyword mustn't segfault our implementation. Only
command that supports such files is "cvs status", therefore properly handle
them in all other commands, too.


# 1.115 08-Oct-2007 joris

do not try to reset the default branch if the RCS file
does not exist, fixes a segfault when commiting a new file.

found by tobias@ who is going to make a nice little regression test for this.


# 1.114 03-Oct-2007 joris

reset the default branch early on so rcs_head_get() does not screw us up
and returns a possibly wrong revision as 'current revision'.

noticed by tobias@ his regress testing


# 1.113 24-Sep-2007 joris

unused vars


# 1.112 24-Sep-2007 joris

add support to commit modified files to branches.


# 1.111 23-Sep-2007 joris

make sure when running update -r on existing files to overwrite
the sticky directory tag with it. since -r gets priority.


# 1.110 22-Sep-2007 joris

better branching/sticky tag support, no branch commits yet though.


# 1.109 30-Aug-2007 joris

properly send our log message to the server using Argumentx, so we
no longer break when the log message has multiple lines.

from Tobias Stoeckmann, thanks for doing my work!


Revision tags: OPENBSD_4_2_BASE
# 1.108 28-Jun-2007 joris

When commiting to a server in a remote setup classify
the files based upon their entry in CVS/Entries instead of
using the local classifying code and trying to locate the RCSfile
on our local disks, which ofc does not work correctly.

OK niallo@


# 1.107 18-Jun-2007 joris

first stab at history stuff for opencvs, currently only writes
to CVSROOT/history but cannot parse it yet with the 'history' command.

"Commit it." ray@


# 1.106 01-Jun-2007 niallo

add support for local and remote branch checkout. for example,
cvs co -rOPENBSD_3_0 works now.
along the way, simplify and rationalise code and fix a few nits.

ok joris@ xsa@ ray@


Revision tags: OPENBSD_4_1_BASE
# 1.105 22-Feb-2007 otto

general includes cleanup sweep. ok joris@ niallo@


# 1.104 09-Feb-2007 joris

remove the cvs_file_classify() `loud' argument, it was used
in the old school days and serves no purpose what so ever now.

otto@ mentioned this to me a while ago


# 1.103 01-Feb-2007 otto

change mode of a newly created rcs file in the repository to 0444
ok jorix@ xsa@


# 1.102 31-Jan-2007 xsa

snprintf() -> xsnprintf()


# 1.101 26-Jan-2007 xsa

- support [-k mode] for the add command
- do not let the file keyword expension options (-k) disappear
from the Entries file when doing a commit/update/checkout
- be sure the expension mode gets written to the RCS file when a file
is added/committed in the first place
problems raised by otto@; tests/ok otto@ and joris@.


# 1.100 25-Jan-2007 otto

use more stack allocations for fixed size buffers. ok xsa@ joris@


# 1.99 18-Jan-2007 xsa

send -l Argument to server when appropriate.


# 1.98 14-Jan-2007 joris

move things around in rcs_rev_getbuf() and rcs_rev_write_fd()
so that we do keyword expansion on-the-fly if required instead
of obtaining the revision in memory first, running over the revision
lines while expanding keywords and only then writing them to the fd
or memory buffer.

this drasticly decreases cpu usage by opencvs on very large trees (like src).

OK niallo@


# 1.97 13-Jan-2007 joris

switch commit code to the new RCS api.
kay niallo@


# 1.96 13-Jan-2007 joris

plug 3 memleaks


# 1.95 13-Jan-2007 joris

remove BUF * argument from cvs_checkout_file() it will
no longer be used, ever.


# 1.94 12-Jan-2007 niallo

major re-work of the RCS api. this results in 100x performance improvements in some places and much
reduced memory usage. note that only checkout has been fully converted to use the new high-performance
functions. other codepaths (e.g. update) still use the old method which is provided for backwards
compatibility. we can convert the remaining slow bits over to the new api piece-by-piece.

"commit this, now" joris@
brad@ tested, too.


# 1.93 12-Jan-2007 joris

do not leak memory from rcs_head_get()

ok niallo@


# 1.92 12-Jan-2007 joris

if we have no files to be commited, stop commiting.


# 1.91 12-Jan-2007 joris

complete binary support for opencvs,
adding/importing binary files now works too

partially taken from openrcs


# 1.90 11-Jan-2007 jasper

silence some warnings.

ok joris@


# 1.89 11-Jan-2007 joris

in a remote setup:
do not connect to the remote server until we are sure all the options
passed to the commands are valid.

noticed by xsa@


# 1.88 07-Jan-2007 joris

use cvs_logmsg_read() for -F for simplicity.


# 1.87 07-Jan-2007 joris

free the filelists we pass to cvs_logmsg_create()
after we obtain our logmessage.


# 1.86 07-Jan-2007 joris

rewrite of the logmessage code, which allows you to
enter a logmessage into your favorite editor when commiting.


# 1.85 03-Jan-2007 joris

add support for 'remove' in a remote setup.
testing appriciated, as always.


# 1.84 03-Jan-2007 joris

if we are commiting a file, do not let the server resend it
with an 'Updated' response, seeing as the client will already have the
latest version. Instead, send the correct 'Checked-in' response.


# 1.83 02-Jan-2007 joris

- fix cvs_client_remove_entry to correctly handle the passed data
- when commiting in a remote setup, allow the opencvs server to send
the correct response to the client when a file has been removed


# 1.82 31-Dec-2006 xsa

minor nits;


Revision tags: OPENBSD_4_0_BASE
# 1.81 08-Jul-2006 ray

Remove file mode argument from {cvs|rcs}_buf_write_stmp(). We
always set the temporary file to mode 600, which is already done
by mkstemp().

OK joris@ and xsa@ over a month ago.


# 1.80 07-Jul-2006 joris

first part of opencvs remote, fairly useable on existing trees
although i advise against using it on real development trees for now.

only a few commands work right so far:
- commit
- diff
- status
- log
- update (partially working)

if you feel like testing remote and run into bugs feel free to
contact me, and please include a full trace (-t).


# 1.79 02-Jul-2006 joris

- abort the commit when files are not correctly up to date.
- do not try to attempt to check for conflict markers when the file is not on disk.

found by and okay reyk@


# 1.78 29-Jun-2006 joris

it is a really good idea to store the result cvs_buf_load_fd returns
in bp, considering we depend on that.

found by reyk who is now my favorite german person, 10x.


# 1.77 28-Jun-2006 reyk

print less verbose messages for cvs commit and add if the -q/-Q flag
has been specified.

ok joris@


# 1.76 28-Jun-2006 joris

do not fail when we are trying to commit a newly added file when the CVS/*,t
file is not present for the file.

spotted and tested by reyk@
okay xsa@


# 1.75 19-Jun-2006 joris

kill local and remote callback and just have one called fileproc.
we let the commands pass the correct function.

all in preparation for remote.


# 1.74 16-Jun-2006 joris

in preparation for the new remote code, proto.h becomes obsolete.


# 1.73 14-Jun-2006 joris

add cvs_buf_load_fd() which does the same as cvs_buf_load()
except it takes a decriptor as argument instead of a path.

modified cvs_buf_load() to open the descriptor then pass
it to cvs_buf_load_fd().

change all the calls to cvs_buf_load() that have a descriptor
open for the path to cvs_buf_load_fd() to prevent races.


# 1.72 13-Jun-2006 joris

files that are not checked out are not up-to-date, consider
this a conflict and block the commit when we encounter any of these.

and make an error message a bit more fluffy and accurate.


# 1.71 07-Jun-2006 xsa

add support for <name>,t file:
- add: creates <name>,t file with initial description if -m option was used.
- commit: uses <name>,t content (if it exists) to set the file description
OK joris@.


# 1.70 06-Jun-2006 joris

hello commit -F support


# 1.69 04-Jun-2006 joris

sprinkle -n voodoo over the add, commit and import commands.


# 1.68 01-Jun-2006 joris

major rewrite of some rcs parsing stuff:

- rework rcs_getrev() to correctly support branches
- rework rcs_translate_tag() to correctly translate given symbols or
branches into their matching revisions
- rework rcs_rev_add() to correctly update its 'next' pointers
and insert the new revision in the correct place on the list.
- rework rcs_head_get() to return the latest revision on the default
branch if it has been set or the normal HEAD revision otherwise.
- no longer access the rf_head member of the RCSFILE struct manually,
use the rcs_head_get() function which correctly returns the HEAD
revision, there might be a default branch that has to be used.
- for now, when commiting a new revision reset the default branch.


# 1.67 31-May-2006 joris

when adding a new file that already exists set the previous
deltatext (the dead revision) to the correct rcs diff if the file
was modified in any way.


# 1.66 31-May-2006 joris

allow commit to ressurect added files that exist in Attic/


# 1.65 30-May-2006 joris

fill in the correct revision number we will want in file_rcsrev
for each cvs_file struct, this will help us with sticky tags,
commiting to branches and importing into existing repositories.


# 1.64 30-May-2006 joris

the moment we are done commiting a removed file, move the RCS file
into the Attic and out of our way.


# 1.63 28-May-2006 joris

enable basic add command, only works on files right now.


# 1.62 28-May-2006 joris

allow commands to shut up the output from cvs_file_classify
if the commands want to output certain stuff themselfs


# 1.61 28-May-2006 joris

teach opencvs ci how to commit files that have been added,
opencvs can now commit modified files, removed files and added files.

hip hip hurray!


# 1.60 28-May-2006 joris

enable merging on update. if your file in your working copy
has been modified by yourself and there is a newer revision
we try and merge them together.

if the merge fails and has conflicts it will mark them inside
the file, you will need to resolve these by hand first before
you will be able to commit your modified file.

works transparent with gnu cvs, as it is suppose to.


# 1.59 27-May-2006 joris

show which directory we are examining in our pre-commit checks.


# 1.58 27-May-2006 joris

allow commands to respect the -l flag, if the -l flag is
specified certain commands will not recurse into directories.

at the same time introduce a method of specifying wether or not
a command should look in the repository for files.


# 1.57 27-May-2006 joris

dont allow commit to continue if the file that is being
commited needs to be updated or merged first.


# 1.56 27-May-2006 joris

commiting removed files now works


# 1.55 27-May-2006 joris

commit the new opencvs code, i have been hacking on
this for the past 2 weeks now and it should go in at
the start of the hackathon so others can help out.

this code is a lot safer, smarter, faster and best of
all it is actually doing what it is suppose to do!

basic checkout, update, status, diff and commit are
working in local mode only.
there is no support for any remote setups now.


# 1.54 14-Apr-2006 deraadt

remove a metric buttload of excessive ()
no binary change; ok ray


# 1.53 01-Apr-2006 joris

fix some bugs that lint discovered for us.
ok niallo@


# 1.52 16-Mar-2006 xsa

zap more unused variables.


Revision tags: OPENBSD_3_9_BASE
# 1.51 02-Jan-2006 xsa

#include's cleanup; ok joris@ niallo@.


# 1.50 30-Dec-2005 joris

major cleanup of the functions handling the remote cvs protocol.
makes the code a lot more readable and understandable.

ok xsa@ and niallo@


# 1.49 22-Dec-2005 xsa

cvs_rcs_getpath() cannot fail anymore;


# 1.48 21-Dec-2005 xsa

cvs_logmsg_open() and cvs_logmsg_get() cannot fail anymore;


# 1.47 10-Dec-2005 joris

switch to xmalloc stuff, me and xsa@ agreed on this a long
time ago, but we were being held back by jfb. too bad for him.

next step is to use fatal() through out the code for unrecoverable
errors instead of trying to be all nice and fluffy and reach main() again.

ok niallo@ and xsa@


Revision tags: OPENBSD_3_8_BASE
# 1.46 27-Jul-2005 xsa

use LP_NOTICE instead of LP_INFO where appropriate;


# 1.45 25-Jul-2005 xsa

KNF;


# 1.44 23-Jul-2005 joris

rewrite of the file code. the previous one was just
a mess and not clean.
this code is much cleaner, faster, and uses less memory overall.

tested by xsa@, brad@, Michael Knudsen, and myself.
okay xsa@


# 1.43 23-Jul-2005 joris

correctly seperate added, modified and removed files for use in the
construction of the log message in the editor.

ok jfb@


# 1.42 22-Jul-2005 joris

use the cf_name field of the CVSFILE struct instead of using the old
CVS_FILE_NAME macro. This macro used to be nifty because of all
the referencing for the names, but since we don't do that anymore and
use cf_name directly... byebye CVS_FILE_NAME()

okay xsa@


# 1.41 19-Jul-2005 joris

unbreak the commit command.


# 1.40 14-Jul-2005 xsa

use cvs_rcs_getpath();


# 1.39 12-Jul-2005 xsa

split this into cvs_commit_{remote,local}() functions;
ok jfb@ (Yes, Yes he IS back!!)


# 1.38 07-Jul-2005 joris

remove trailing whitespaces

from deraadt@


# 1.37 31-May-2005 xsa

headers ordering (alphabetically) and cleanup, from mbalmer@ and myself;


# 1.36 30-May-2005 joris

don't forget to send the log message, this fixes the commit command.

ok xsa@


# 1.35 30-May-2005 xsa

handle -r option; ok joris@


# 1.34 24-May-2005 jfb

Merge the cvs_cmd and cvs_cmd_info structures and add the necessary
fields to hook local versions of the commands. This needs to go in
before it gets any bigger

ok joris


# 1.33 20-May-2005 joris

correct wrong error code usage.

ok jfb@, xsa@


# 1.32 20-May-2005 joris

execute the command callback at the same time we are building
the in-memory filelist. cuts down on execution time for larger trees.

"put it in!" jfb@


# 1.31 24-Apr-2005 joris

don't send a Modified request and the file its contents when
it has been removed.


# 1.30 24-Apr-2005 joris

add missing CVS_CMD_ALLOWSPEC flag


# 1.29 19-Apr-2005 jfb

handle removed files as well when checking files to commit

ok joris


# 1.28 19-Apr-2005 joris

remove debug code


# 1.27 19-Apr-2005 joris

make sure we pick up newly added files.


# 1.26 18-Apr-2005 jfb

Modify the CVSFILE structure using a union to keep information about
both files and directories. We can now keep the revision number for
regular files, and don't need to fetch the appropriate entry in the
command callbacks. This saves a huge amount of parsing on Entries
files.

ok joris@


# 1.25 16-Apr-2005 xsa

missing cvs_ent_free(); joris ok


# 1.24 15-Apr-2005 xsa

snprintf() return values checks; joris ok


# 1.23 12-Apr-2005 joris

introduce our own set of error codes used by the commands to report
what exactly went wrong in case of an error.

ok jfb@


# 1.22 11-Apr-2005 joris

don't include sysexits.h now we don't use those error codes
anymore.


# 1.21 11-Apr-2005 joris

remove EX_USAGE error codes

ok jfb@


# 1.20 03-Apr-2005 xsa

first round of EX_* exit codes removal; ok joris@.


# 1.19 31-Mar-2005 joris

fix prototype for cvs_commit_prepare()


# 1.18 30-Mar-2005 joris

move all the client commands to the new command framework.
eliminates a lot of duplicate code.

ok jfb@


# 1.17 29-Mar-2005 joris

fix memleak

ok jfb@


Revision tags: OPENBSD_3_7_BASE
# 1.16 02-Mar-2005 joris

- make sure we are using a remote method before calling
cvs_sendreq() and cvs_sendfile().
- don't leak entp on errors.

ok jfb@


# 1.15 22-Feb-2005 jfb

more error checking on protocol calls when running in client mode


# 1.14 13-Jan-2005 jfb

more widespread use of cvs_msg, and free it when we are done

diff by Joris Vink and me


# 1.13 21-Dec-2004 jfb

modify the directory handling portion to behave like the one in add.c,
which does not attempt to send data when running on a local
repository. This will be needed to support local repository access


# 1.12 14-Dec-2004 jfb

First attempt at syncing the command code and doing a lot more error
checking on all the protocol calls


# 1.11 13-Dec-2004 jfb

return early if no files are ready to be commited


# 1.10 08-Dec-2004 jfb

embrace and extend (!) cvs_logmsg_get() so we can now display
information based on its availability and have separate sections for
the Added, Modified and Removed file lists. this will allow us to
use the same call for add, commit, import and possibly others

Original patch by Joris Vink, some rework from me for the other
sections


# 1.9 07-Dec-2004 tedu

less whitespace, more pretty. ok jfb


# 1.8 06-Dec-2004 deraadt

tighten vertical spacing for else; jfb ok


# 1.7 02-Dec-2004 jfb

This commit is brought to you by the brand new improved and better tasting
OpenCVS commit code.


# 1.6 26-Nov-2004 jfb

Rewrite the internals of the file management code so that we do not keep
a full path to each file we load, and cache file names so we can have
multiple references to a single name. This saves a lot of memory on large
trees such as /usr/src, especially on 'Makefile', 'README' and such.


# 1.5 09-Nov-2004 krapht

Better handling of log message input and removal of crufty code


# 1.4 09-Nov-2004 krapht

at least compile


# 1.3 09-Nov-2004 krapht

Editor invocation code, still needs some work


# 1.2 30-Jul-2004 jfb

Move to the new API for the client-server protocol. All functions now
take a cvs root structure as parameter. This will allow for much easier
management of CVS trees that make use of multiple roots.


# 1.1 13-Jul-2004 jfb

branches: 1.1.1;
Initial revision


Revision tags: OPENBSD_6_2_BASE
# 1.158 01-Jun-2017 joris

Stop looking at current_cvsroot->cr_method to figure out if we're remote or not.

Instead use cvsroot_is_local() and cvsroot_is_remote().


# 1.157 31-May-2017 joris

Do not use CVS_LOCK_REPO for committing.

This flag tells our file recursion code that for each directory entered
we should lock it. Commit however locks all relevant directories on its
own when it is about to make changes and should not depend on the file
recursion code to do so.


# 1.156 28-May-2017 joris

Don't allow opencvs to commit towards tags that are not branches.

Gets rid of the old logic that wasn't working and replaced it with
a simplified version.

ok stsp@


Revision tags: OPENBSD_6_1_BASE
# 1.155 13-Oct-2016 fcambus

rcsnum_free() -> free() cleanups. From Michael W. Bombardieri.

OK millert@


Revision tags: OPENBSD_5_9_BASE OPENBSD_6_0_BASE
# 1.154 05-Nov-2015 nicm

Remove xfree(), like already done for RCS. From Michael W Bombardieri,
ok mmcc


Revision tags: OPENBSD_5_7_BASE OPENBSD_5_8_BASE
# 1.153 16-Jan-2015 deraadt

Replace <sys/param.h> with <limits.h> and other less dirty headers where
possible. Annotate <sys/param.h> lines with their current reasons. Switch
to PATH_MAX, NGROUPS_MAX, HOST_NAME_MAX+1, LOGIN_NAME_MAX, etc. Change
MIN() and MAX() to local definitions of MINIMUM() and MAXIMUM() where
sensible to avoid pulling in the pollution. These are the files confirmed
through binary verification.
ok guenther, millert, doug (helped with the verification protocol)


Revision tags: OPENBSD_5_1_BASE OPENBSD_5_2_BASE OPENBSD_5_3_BASE OPENBSD_5_4_BASE OPENBSD_5_5_BASE OPENBSD_5_6_BASE
# 1.152 27-Dec-2011 nicm

Move some global variables/statics to locals, from Michael W
Bombardieri.


Revision tags: OPENBSD_5_0_BASE
# 1.151 20-Apr-2011 nicm

Trivial code simplifying, from Michael W Bombardieri.


Revision tags: OPENBSD_4_8_BASE OPENBSD_4_9_BASE
# 1.150 23-Jul-2010 ray

Reduce variable/function name and whitespace differences between
cvs/rcs.

OK xsa zinovik


Revision tags: OPENBSD_4_6_BASE OPENBSD_4_7_BASE
# 1.149 07-Jun-2009 ray

More cvs/diff/rcs convergence:
1. Mostly variable/function renaming, SIZE_T_MAX->SIZE_MAX, and
spacing.
2. One strchr -> strncspn.
3. diff had a weird thing where it set file[12] = ofile[12] but
never updated file or ofile, then if file and ofile were different
it freed it. I removed it.

OK millert


# 1.148 06-Jun-2009 ray

Sync some rcsdiff changes to cvsdiff. As a side effect,
cvs diff -t now works. There should be no functional change
otherwise.

OK millert


# 1.147 26-Mar-2009 joris

fix the way Attic is handled in our recursion code, so we
do not skip files or run over them twice.

also fixes -l and -r for checkout/update when a file in
Attic exists with that tag that in HEAD is a directory
in the normal repository like gnu/usr.bin/gcc/INSTALL.

as a bonus, we do not run fstat() twice per file or dir
anymore...

spotted by deraadt@


# 1.146 25-Mar-2009 joris

switch our file and directory lists to RB trees (see tree(3)),
so we can benefit from faster lookup times while recursing.


Revision tags: OPENBSD_4_5_BASE
# 1.145 29-Aug-2008 tobias

Pre-commit checks (CVSROOT/commitinfo) are run before log message is
requested. Do this for GNU cvs compatibility, too.

ok joris


Revision tags: OPENBSD_4_4_BASE
# 1.144 08-Jul-2008 joris

make these compile cleanly


# 1.143 15-Jun-2008 tobias

Support the addition of new files in branches.

ok joris


# 1.142 14-Jun-2008 tobias

Conforming to RCS specification, it is possible but unlikely to encounter
an RCS file which has no head revision set. Some commands actually can
work with them (log, status) so support these files. Fixes A LOT of
possible segmentation faults.

ok joris


# 1.141 14-Jun-2008 joris

don't always re-open the same CVS/Entries file, instead keep the
last opened CVS/Entries around to operate on and close it whenever
we switch directory. gives us a small performance boost, obviously.

while doing this, switch the way we write revisions to disk by
using fwrite(3) so stuff can get written to disk in chunks
instead of writing everything line by line, another win.

with help from otto@
ok tobias@


# 1.140 10-Jun-2008 joris

set tag_new if its available so it can get passed to loginfo


# 1.139 10-Jun-2008 joris

switch back to a single log message in local mode so we are compliant
with a remote setup.

fixes a very annoying bug with loginfo as well.

ok tobias@


# 1.138 10-Jun-2008 joris

style


# 1.137 10-Jun-2008 joris

New trigger framework that allows us to run the required scripts
defined in CVSROOT/commitinfo and CVSROOT/loginfo and so on.

This enables the use of log_accum2 and all that other nice stuff we like.

This was mostly written by Jonathan Armani with help from tobias@ and myself.

ok tobias@


# 1.136 09-Jun-2008 tobias

Properly handle merged files and conflicts which may arrise while merge.
Instead of ignoring all files which contain possible conflict markers,
only watch out for files which have actually been merged.

With input by and ok joris.


# 1.135 08-Jun-2008 tobias

Handle commits on a per-directory basis instead handling all of them at
once in local setup. Also added '!' to reuse typed log message for all
following directories.

ok joris


# 1.134 08-Jun-2008 tobias

Properly build up path to description files (descr entry in RCS files if
you add a file with -m message).

ok joris


# 1.133 17-May-2008 tobias

Full support of branches added. We lacked proper support of multiple
branch entry points in one revision as well as branches which started from
other branches.

ok joris


# 1.132 09-Mar-2008 joris

proper repository locking:
- all read operations now look for a lock, and wait if present but never
try to lock the tree themselfs anymore.
- all write operations lock the tree where needed.
- commit locks all relevant directories before even attempting to start.


Revision tags: OPENBSD_4_3_BASE
# 1.131 27-Feb-2008 joris

prevent file races

ok tobias@


# 1.130 20-Feb-2008 tobias

With latest buf cleanup, rcs_rev_getbuf won't return NULL anymore.

OK joris@


# 1.129 11-Feb-2008 tobias

Cleanup buf implementation:

* Don't check for NULL on buffer creation, because it calls fatal() when
something's wrong.
* All buffers are supposed to expand if there is no space left in them,
so zap flags as well.
* Remove code that is now dead.

OK joris@

> Inspired by a diff from Igor Zinovik about unchecked return value.


# 1.128 10-Feb-2008 joris

do not allow commits to files that have a sticky date set


# 1.127 04-Feb-2008 joris

CVSROOT/modules:

correct -i and -o usage

-i runs the program specified on commit
-o runs the program specified on checkout


# 1.126 04-Feb-2008 tobias

Added -k flag support for all commands which support it.

OK joris@


# 1.125 31-Jan-2008 joris

free RCSNUM's when we are done with them;

ok tobias@


# 1.124 31-Jan-2008 tobias

Replaced the unused cvs_command variable cmd_req with cmd_flags, which states
if the current command is supposed to use a working directory or if it is a
repository-only command (as of now checkout -p, rtag, rlog).

Makes the code simpler, easier to read and automagically fixes some issues
we encountered with these commands (for example if a working directory
exists, or "." operations are performed).

OK joris@, niallo@


# 1.123 29-Jan-2008 tobias

Properly free dynamically allocated memory. Also skip needless checks.

> Diff from Igor Zinovik


# 1.122 28-Jan-2008 tobias

Zapped some variables which made the source harder to read (and to verify).

> Diff from Igor Zinovik


# 1.121 28-Jan-2008 tobias

checkout's options -m and -F are mutually exclusive. Also watch out to
properly free arguments if options are supplied multiple times.

OK ray@

> Diff from Igor Zinovik


# 1.120 28-Jan-2008 tobias

Properly handle -R -- although it is default, it may be overwritten mit -l
in front of it.

OK joris@, xsa@

> Diff from Igor Zinovik


# 1.119 13-Jan-2008 tobias

Revision buffers are supposed to be of size CVS_REV_BUFSZ (32) instead
of 24.

OK xsa@

> Diff from Igor Zinovik.


# 1.118 13-Jan-2008 tobias

Typos fixed.

OK xsa@

> Diff from Igor Zinovik.


# 1.117 10-Jan-2008 tobias

Our keyword expansion had a big flaw, due to this construction:
if (!(mode & RCS_KWEXP_NONE))

RCS_KWEXP_NONE is defined to 0, so expansion happened always.

Left shifted all RCS_KWEXP defines and looked carefully at hard-coded values
throughout the code.


# 1.116 10-Jan-2008 tobias

RCS files without head keyword mustn't segfault our implementation. Only
command that supports such files is "cvs status", therefore properly handle
them in all other commands, too.


# 1.115 08-Oct-2007 joris

do not try to reset the default branch if the RCS file
does not exist, fixes a segfault when commiting a new file.

found by tobias@ who is going to make a nice little regression test for this.


# 1.114 03-Oct-2007 joris

reset the default branch early on so rcs_head_get() does not screw us up
and returns a possibly wrong revision as 'current revision'.

noticed by tobias@ his regress testing


# 1.113 24-Sep-2007 joris

unused vars


# 1.112 24-Sep-2007 joris

add support to commit modified files to branches.


# 1.111 23-Sep-2007 joris

make sure when running update -r on existing files to overwrite
the sticky directory tag with it. since -r gets priority.


# 1.110 22-Sep-2007 joris

better branching/sticky tag support, no branch commits yet though.


# 1.109 30-Aug-2007 joris

properly send our log message to the server using Argumentx, so we
no longer break when the log message has multiple lines.

from Tobias Stoeckmann, thanks for doing my work!


Revision tags: OPENBSD_4_2_BASE
# 1.108 28-Jun-2007 joris

When commiting to a server in a remote setup classify
the files based upon their entry in CVS/Entries instead of
using the local classifying code and trying to locate the RCSfile
on our local disks, which ofc does not work correctly.

OK niallo@


# 1.107 18-Jun-2007 joris

first stab at history stuff for opencvs, currently only writes
to CVSROOT/history but cannot parse it yet with the 'history' command.

"Commit it." ray@


# 1.106 01-Jun-2007 niallo

add support for local and remote branch checkout. for example,
cvs co -rOPENBSD_3_0 works now.
along the way, simplify and rationalise code and fix a few nits.

ok joris@ xsa@ ray@


Revision tags: OPENBSD_4_1_BASE
# 1.105 22-Feb-2007 otto

general includes cleanup sweep. ok joris@ niallo@


# 1.104 09-Feb-2007 joris

remove the cvs_file_classify() `loud' argument, it was used
in the old school days and serves no purpose what so ever now.

otto@ mentioned this to me a while ago


# 1.103 01-Feb-2007 otto

change mode of a newly created rcs file in the repository to 0444
ok jorix@ xsa@


# 1.102 31-Jan-2007 xsa

snprintf() -> xsnprintf()


# 1.101 26-Jan-2007 xsa

- support [-k mode] for the add command
- do not let the file keyword expension options (-k) disappear
from the Entries file when doing a commit/update/checkout
- be sure the expension mode gets written to the RCS file when a file
is added/committed in the first place
problems raised by otto@; tests/ok otto@ and joris@.


# 1.100 25-Jan-2007 otto

use more stack allocations for fixed size buffers. ok xsa@ joris@


# 1.99 18-Jan-2007 xsa

send -l Argument to server when appropriate.


# 1.98 14-Jan-2007 joris

move things around in rcs_rev_getbuf() and rcs_rev_write_fd()
so that we do keyword expansion on-the-fly if required instead
of obtaining the revision in memory first, running over the revision
lines while expanding keywords and only then writing them to the fd
or memory buffer.

this drasticly decreases cpu usage by opencvs on very large trees (like src).

OK niallo@


# 1.97 13-Jan-2007 joris

switch commit code to the new RCS api.
kay niallo@


# 1.96 13-Jan-2007 joris

plug 3 memleaks


# 1.95 13-Jan-2007 joris

remove BUF * argument from cvs_checkout_file() it will
no longer be used, ever.


# 1.94 12-Jan-2007 niallo

major re-work of the RCS api. this results in 100x performance improvements in some places and much
reduced memory usage. note that only checkout has been fully converted to use the new high-performance
functions. other codepaths (e.g. update) still use the old method which is provided for backwards
compatibility. we can convert the remaining slow bits over to the new api piece-by-piece.

"commit this, now" joris@
brad@ tested, too.


# 1.93 12-Jan-2007 joris

do not leak memory from rcs_head_get()

ok niallo@


# 1.92 12-Jan-2007 joris

if we have no files to be commited, stop commiting.


# 1.91 12-Jan-2007 joris

complete binary support for opencvs,
adding/importing binary files now works too

partially taken from openrcs


# 1.90 11-Jan-2007 jasper

silence some warnings.

ok joris@


# 1.89 11-Jan-2007 joris

in a remote setup:
do not connect to the remote server until we are sure all the options
passed to the commands are valid.

noticed by xsa@


# 1.88 07-Jan-2007 joris

use cvs_logmsg_read() for -F for simplicity.


# 1.87 07-Jan-2007 joris

free the filelists we pass to cvs_logmsg_create()
after we obtain our logmessage.


# 1.86 07-Jan-2007 joris

rewrite of the logmessage code, which allows you to
enter a logmessage into your favorite editor when commiting.


# 1.85 03-Jan-2007 joris

add support for 'remove' in a remote setup.
testing appriciated, as always.


# 1.84 03-Jan-2007 joris

if we are commiting a file, do not let the server resend it
with an 'Updated' response, seeing as the client will already have the
latest version. Instead, send the correct 'Checked-in' response.


# 1.83 02-Jan-2007 joris

- fix cvs_client_remove_entry to correctly handle the passed data
- when commiting in a remote setup, allow the opencvs server to send
the correct response to the client when a file has been removed


# 1.82 31-Dec-2006 xsa

minor nits;


Revision tags: OPENBSD_4_0_BASE
# 1.81 08-Jul-2006 ray

Remove file mode argument from {cvs|rcs}_buf_write_stmp(). We
always set the temporary file to mode 600, which is already done
by mkstemp().

OK joris@ and xsa@ over a month ago.


# 1.80 07-Jul-2006 joris

first part of opencvs remote, fairly useable on existing trees
although i advise against using it on real development trees for now.

only a few commands work right so far:
- commit
- diff
- status
- log
- update (partially working)

if you feel like testing remote and run into bugs feel free to
contact me, and please include a full trace (-t).


# 1.79 02-Jul-2006 joris

- abort the commit when files are not correctly up to date.
- do not try to attempt to check for conflict markers when the file is not on disk.

found by and okay reyk@


# 1.78 29-Jun-2006 joris

it is a really good idea to store the result cvs_buf_load_fd returns
in bp, considering we depend on that.

found by reyk who is now my favorite german person, 10x.


# 1.77 28-Jun-2006 reyk

print less verbose messages for cvs commit and add if the -q/-Q flag
has been specified.

ok joris@


# 1.76 28-Jun-2006 joris

do not fail when we are trying to commit a newly added file when the CVS/*,t
file is not present for the file.

spotted and tested by reyk@
okay xsa@


# 1.75 19-Jun-2006 joris

kill local and remote callback and just have one called fileproc.
we let the commands pass the correct function.

all in preparation for remote.


# 1.74 16-Jun-2006 joris

in preparation for the new remote code, proto.h becomes obsolete.


# 1.73 14-Jun-2006 joris

add cvs_buf_load_fd() which does the same as cvs_buf_load()
except it takes a decriptor as argument instead of a path.

modified cvs_buf_load() to open the descriptor then pass
it to cvs_buf_load_fd().

change all the calls to cvs_buf_load() that have a descriptor
open for the path to cvs_buf_load_fd() to prevent races.


# 1.72 13-Jun-2006 joris

files that are not checked out are not up-to-date, consider
this a conflict and block the commit when we encounter any of these.

and make an error message a bit more fluffy and accurate.


# 1.71 07-Jun-2006 xsa

add support for <name>,t file:
- add: creates <name>,t file with initial description if -m option was used.
- commit: uses <name>,t content (if it exists) to set the file description
OK joris@.


# 1.70 06-Jun-2006 joris

hello commit -F support


# 1.69 04-Jun-2006 joris

sprinkle -n voodoo over the add, commit and import commands.


# 1.68 01-Jun-2006 joris

major rewrite of some rcs parsing stuff:

- rework rcs_getrev() to correctly support branches
- rework rcs_translate_tag() to correctly translate given symbols or
branches into their matching revisions
- rework rcs_rev_add() to correctly update its 'next' pointers
and insert the new revision in the correct place on the list.
- rework rcs_head_get() to return the latest revision on the default
branch if it has been set or the normal HEAD revision otherwise.
- no longer access the rf_head member of the RCSFILE struct manually,
use the rcs_head_get() function which correctly returns the HEAD
revision, there might be a default branch that has to be used.
- for now, when commiting a new revision reset the default branch.


# 1.67 31-May-2006 joris

when adding a new file that already exists set the previous
deltatext (the dead revision) to the correct rcs diff if the file
was modified in any way.


# 1.66 31-May-2006 joris

allow commit to ressurect added files that exist in Attic/


# 1.65 30-May-2006 joris

fill in the correct revision number we will want in file_rcsrev
for each cvs_file struct, this will help us with sticky tags,
commiting to branches and importing into existing repositories.


# 1.64 30-May-2006 joris

the moment we are done commiting a removed file, move the RCS file
into the Attic and out of our way.


# 1.63 28-May-2006 joris

enable basic add command, only works on files right now.


# 1.62 28-May-2006 joris

allow commands to shut up the output from cvs_file_classify
if the commands want to output certain stuff themselfs


# 1.61 28-May-2006 joris

teach opencvs ci how to commit files that have been added,
opencvs can now commit modified files, removed files and added files.

hip hip hurray!


# 1.60 28-May-2006 joris

enable merging on update. if your file in your working copy
has been modified by yourself and there is a newer revision
we try and merge them together.

if the merge fails and has conflicts it will mark them inside
the file, you will need to resolve these by hand first before
you will be able to commit your modified file.

works transparent with gnu cvs, as it is suppose to.


# 1.59 27-May-2006 joris

show which directory we are examining in our pre-commit checks.


# 1.58 27-May-2006 joris

allow commands to respect the -l flag, if the -l flag is
specified certain commands will not recurse into directories.

at the same time introduce a method of specifying wether or not
a command should look in the repository for files.


# 1.57 27-May-2006 joris

dont allow commit to continue if the file that is being
commited needs to be updated or merged first.


# 1.56 27-May-2006 joris

commiting removed files now works


# 1.55 27-May-2006 joris

commit the new opencvs code, i have been hacking on
this for the past 2 weeks now and it should go in at
the start of the hackathon so others can help out.

this code is a lot safer, smarter, faster and best of
all it is actually doing what it is suppose to do!

basic checkout, update, status, diff and commit are
working in local mode only.
there is no support for any remote setups now.


# 1.54 14-Apr-2006 deraadt

remove a metric buttload of excessive ()
no binary change; ok ray


# 1.53 01-Apr-2006 joris

fix some bugs that lint discovered for us.
ok niallo@


# 1.52 16-Mar-2006 xsa

zap more unused variables.


Revision tags: OPENBSD_3_9_BASE
# 1.51 02-Jan-2006 xsa

#include's cleanup; ok joris@ niallo@.


# 1.50 30-Dec-2005 joris

major cleanup of the functions handling the remote cvs protocol.
makes the code a lot more readable and understandable.

ok xsa@ and niallo@


# 1.49 22-Dec-2005 xsa

cvs_rcs_getpath() cannot fail anymore;


# 1.48 21-Dec-2005 xsa

cvs_logmsg_open() and cvs_logmsg_get() cannot fail anymore;


# 1.47 10-Dec-2005 joris

switch to xmalloc stuff, me and xsa@ agreed on this a long
time ago, but we were being held back by jfb. too bad for him.

next step is to use fatal() through out the code for unrecoverable
errors instead of trying to be all nice and fluffy and reach main() again.

ok niallo@ and xsa@


Revision tags: OPENBSD_3_8_BASE
# 1.46 27-Jul-2005 xsa

use LP_NOTICE instead of LP_INFO where appropriate;


# 1.45 25-Jul-2005 xsa

KNF;


# 1.44 23-Jul-2005 joris

rewrite of the file code. the previous one was just
a mess and not clean.
this code is much cleaner, faster, and uses less memory overall.

tested by xsa@, brad@, Michael Knudsen, and myself.
okay xsa@


# 1.43 23-Jul-2005 joris

correctly seperate added, modified and removed files for use in the
construction of the log message in the editor.

ok jfb@


# 1.42 22-Jul-2005 joris

use the cf_name field of the CVSFILE struct instead of using the old
CVS_FILE_NAME macro. This macro used to be nifty because of all
the referencing for the names, but since we don't do that anymore and
use cf_name directly... byebye CVS_FILE_NAME()

okay xsa@


# 1.41 19-Jul-2005 joris

unbreak the commit command.


# 1.40 14-Jul-2005 xsa

use cvs_rcs_getpath();


# 1.39 12-Jul-2005 xsa

split this into cvs_commit_{remote,local}() functions;
ok jfb@ (Yes, Yes he IS back!!)


# 1.38 07-Jul-2005 joris

remove trailing whitespaces

from deraadt@


# 1.37 31-May-2005 xsa

headers ordering (alphabetically) and cleanup, from mbalmer@ and myself;


# 1.36 30-May-2005 joris

don't forget to send the log message, this fixes the commit command.

ok xsa@


# 1.35 30-May-2005 xsa

handle -r option; ok joris@


# 1.34 24-May-2005 jfb

Merge the cvs_cmd and cvs_cmd_info structures and add the necessary
fields to hook local versions of the commands. This needs to go in
before it gets any bigger

ok joris


# 1.33 20-May-2005 joris

correct wrong error code usage.

ok jfb@, xsa@


# 1.32 20-May-2005 joris

execute the command callback at the same time we are building
the in-memory filelist. cuts down on execution time for larger trees.

"put it in!" jfb@


# 1.31 24-Apr-2005 joris

don't send a Modified request and the file its contents when
it has been removed.


# 1.30 24-Apr-2005 joris

add missing CVS_CMD_ALLOWSPEC flag


# 1.29 19-Apr-2005 jfb

handle removed files as well when checking files to commit

ok joris


# 1.28 19-Apr-2005 joris

remove debug code


# 1.27 19-Apr-2005 joris

make sure we pick up newly added files.


# 1.26 18-Apr-2005 jfb

Modify the CVSFILE structure using a union to keep information about
both files and directories. We can now keep the revision number for
regular files, and don't need to fetch the appropriate entry in the
command callbacks. This saves a huge amount of parsing on Entries
files.

ok joris@


# 1.25 16-Apr-2005 xsa

missing cvs_ent_free(); joris ok


# 1.24 15-Apr-2005 xsa

snprintf() return values checks; joris ok


# 1.23 12-Apr-2005 joris

introduce our own set of error codes used by the commands to report
what exactly went wrong in case of an error.

ok jfb@


# 1.22 11-Apr-2005 joris

don't include sysexits.h now we don't use those error codes
anymore.


# 1.21 11-Apr-2005 joris

remove EX_USAGE error codes

ok jfb@


# 1.20 03-Apr-2005 xsa

first round of EX_* exit codes removal; ok joris@.


# 1.19 31-Mar-2005 joris

fix prototype for cvs_commit_prepare()


# 1.18 30-Mar-2005 joris

move all the client commands to the new command framework.
eliminates a lot of duplicate code.

ok jfb@


# 1.17 29-Mar-2005 joris

fix memleak

ok jfb@


Revision tags: OPENBSD_3_7_BASE
# 1.16 02-Mar-2005 joris

- make sure we are using a remote method before calling
cvs_sendreq() and cvs_sendfile().
- don't leak entp on errors.

ok jfb@


# 1.15 22-Feb-2005 jfb

more error checking on protocol calls when running in client mode


# 1.14 13-Jan-2005 jfb

more widespread use of cvs_msg, and free it when we are done

diff by Joris Vink and me


# 1.13 21-Dec-2004 jfb

modify the directory handling portion to behave like the one in add.c,
which does not attempt to send data when running on a local
repository. This will be needed to support local repository access


# 1.12 14-Dec-2004 jfb

First attempt at syncing the command code and doing a lot more error
checking on all the protocol calls


# 1.11 13-Dec-2004 jfb

return early if no files are ready to be commited


# 1.10 08-Dec-2004 jfb

embrace and extend (!) cvs_logmsg_get() so we can now display
information based on its availability and have separate sections for
the Added, Modified and Removed file lists. this will allow us to
use the same call for add, commit, import and possibly others

Original patch by Joris Vink, some rework from me for the other
sections


# 1.9 07-Dec-2004 tedu

less whitespace, more pretty. ok jfb


# 1.8 06-Dec-2004 deraadt

tighten vertical spacing for else; jfb ok


# 1.7 02-Dec-2004 jfb

This commit is brought to you by the brand new improved and better tasting
OpenCVS commit code.


# 1.6 26-Nov-2004 jfb

Rewrite the internals of the file management code so that we do not keep
a full path to each file we load, and cache file names so we can have
multiple references to a single name. This saves a lot of memory on large
trees such as /usr/src, especially on 'Makefile', 'README' and such.


# 1.5 09-Nov-2004 krapht

Better handling of log message input and removal of crufty code


# 1.4 09-Nov-2004 krapht

at least compile


# 1.3 09-Nov-2004 krapht

Editor invocation code, still needs some work


# 1.2 30-Jul-2004 jfb

Move to the new API for the client-server protocol. All functions now
take a cvs root structure as parameter. This will allow for much easier
management of CVS trees that make use of multiple roots.


# 1.1 13-Jul-2004 jfb

branches: 1.1.1;
Initial revision