info-cvs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: CVS diff and unknown files.


From: Sergei Organov
Subject: Re: CVS diff and unknown files.
Date: 28 Jan 2005 19:50:36 +0300
User-agent: Gnus/5.0808 (Gnus v5.8.8) XEmacs/21.4 (Common Lisp)

Paul Sander <address@hidden> writes:
> On Jan 27, 2005, at 1:07 AM, address@hidden wrote:
[...]
> > Just to understand your point better, do you propose 'cvs add -c
> > new_file' and 'cvs ci new_file' run exactly the same set of triggers?
> > Different sets?
> 
> I think the consensus in the last iteration of the topic was that, if
> add-time triggers were implemented, they would run as a client-side
> option at add-time and and be obligatory at commit time, preceding
> commit-time triggers. Doubling the overhead was the only way we came
> up with at the time that guaranteed that the add-time triggers fired
> at least once prior to the first commit of a new file.

Well, so the answer to my question is "the two trigger sets are
different". But it in turn means that it could be the case that I won't
be able to 'cvs ci new_file' even though 'cvs add -c new_file' just said
the file is OK to be added. IMHO that's a mess. And I believe this mess
is direct consequence of poor design choices you are advocating, sorry.

> >> Another point that I would like to make, however, is that CVS can
> >> become more feature-rich, support multiple policies, and have a
> >> simpler user interface (in most use cases, at least) all at the same
> >> time. The problem is that most of us here are too close to the
> >> implementation to take a fresh view of the problem.
> >>
> >>> In the core CVS program the "cvs add" and "cvs remove" operations
> >>> must be fixed to be equivalent to "vi file.c" -- i.e. operations
> >>> which _ONLY_ affect the local working directory and which _NEVER_
> >>> contact the server.
> >>
> >> See above. If there are no add-time triggers, then I can live with
> >> what you say. On the other hand, some shops REQUIRE add-time triggers,
> >> and if add-time triggers are used then contacting the server is
> >> REQUIRED to make them run.
> >
> > Sorry, add-time with respect to what? Add-time w.r.t. to working copy is
> > entirely different from the add-time w.r.t. repository. Do you realize
> > currently there is no command but 'cvs ci' meaning "add this file to the
> > repository"? Add time w.r.t. repository currently happens when you 'cvs
> > commit' the new file. Do you propose to change this?
> 
> What I mean by "add-time" is the moment in which the user invokes the "cvs
> add" command.  The canonical example of such a trigger is one that enforces
> naming conventions, but there are other reasons to control what the user can
> add.  (Some shops don't want users creating directories, for example, and
> require the CM team to do it for them.)

So, provided that "cvs add" adds the file to the working copy, your
definition means "add-time to working copy". Requiring server triggers
to be run at add-time to working copy seems rather strange design choice
in my opinion.

> When "cvs add" runs, I don't care whether or not the CVS server
> modifies the repository. Some people seem to think that running "cvs
> add" while disconnected is a useful thing to do. (I take the attitude
> that client/server applications shouldn't be expected to run without a
> working network, so I'd never run any CVS command when I was unable to
> connect to the server.)

Very strange attitude. And a very unusual definition of expectations
associated with client/server applications. Having this definition, mail
client isn't supposed to let you do anything with the mail on your
computer without a working network?!

> However, since triggers enforce policy and must not be defeatable,
> e.g. by changing one's path or bypassing a wrapper or hacking the
> client machine, they're best implemented as a server feature. It's for
> that reason, assuming add-time triggers are implemented, they require
> a connection to the server.

The "add-time triggers" you are advocating would then create an
unfortunate precedent of preventing user from modifying his working copy
at a will of CVS repository administrator! PLEASE, DON'T DO IT TO CVS!
Sorry for shouting. Fortunately, as triggers are run on the server,
there is in fact no way to actually impose any policy on the client
side.

> > In fact the semantics of proposed 'cvs add -c' is: "add this file to the
> > working copy and check if the repository will allow me to commit this
> > new file if I decide to". In this semantic only the latter part has
> > anything to do with the repository, and it is "commit", not "add",
> > that's why I suggested 'cvs commit' would be more logical place to check
> > for such things.
> 
> Certain conditions that "will allow me to commit this new file if I
> decide to" can be checked at the time the user invokes the "cvs add"
> command. The rationale is that if a failure condition can be detected
> at add-time then any conditions deriving from those creating the
> failure condition can be halted, thus avoiding costly recovery action
> at the time when the first commit actually fails.

The problem is that you still try at add-to-the-working-copy time to
impose policies that in fact make sense at the add-to-repository time.

> For example, suppose a mixed Windows/Unix shop requires all files to
> have upper-case 8.3 file names. A new programmer splits a header file
> and creates a new foo.h. He adds the file, then proceeds to modify all
> of the source files to include the new foo.h. Then he updates all of
> the dependencies in his makefiles. He builds and tests on Unix. He
> types "cvs commit", types a very detailed log of his actions, and
> finally punches the screen. This person might have saved a day's work,
> his equipment, and his knuckles if only "cvs add" had said "Sorry,
> this new file violates our naming policy, try renaming it to FOO.H
> instead."

... and what? Is the file added to the working copy or not? If not, then
if I've specified a few files, are they all not added, or only those
that didn't pass the test? Still I'm opposed to the idea that "cvs add"
would refrain from adding files to the working copy. It's not repository
administrator business to decide what I can and what I can't do to my
working copy. If "cvs add" will only warn about the problems, -- that's
OK with me as a user.

However, I still believe "cvs add" is a wrong place to implementing the
functionality from the design point of view. I can only repeat my
argument: as "cvs ci new_file" will do the checks anyway, that's what
"cvs -n ci new_file" should do, not "cvs add". The same opportunities
for the user, but cleaner and simple design.

> > To get your semantics, it seems you need a new operation with the
> > semantics "add the file to the working copy and to the repository, but
> > don't give it to anybody on 'cvs update' yet, until I latter commit the
> > addition". Do you propose exactly this? How could it be done without
> > write access to the repository?
> 
> The semantics I want are to validate the addition of a new artifact.  I
> frankly don't care if "cvs add" is implemented as you describe in that last
> paragraph or if it's implemented Greg's way.

Maybe you don't care, but implementing a messy design will eventually
result in a mess for end-user. Then you will probably care.

> No matter which method records the new file, the client must still
> contact the server to run the add-time trigger.

Sure, the only difference is that you require add-to-repository trigger
to be run at add-time-to-working-copy time as well, and that's IMHO a
wrong design decision.

> >> I had hoped that this was clear in the last go-round, but apparently
> >> not.
> >
> > For me it is not, sorry. Let me give yet another example. Suppose I've
> > created a new_file today and have checked it's ok using proposed 'cvs
> > add -c new_file' command. Two days later what I've checked could already
> 
> > be wrong (policy change, another user added the same file, etc.). So
> > there are two questions:
> >
> > 1. How do I repeat my check later? By just repeating 'cvs add -c
> >    new_file'? This would produce warnings "new_file has already been
> >    added" that is not a good thing for an operation intended to make
> >    checks, I'm afraid.
> >
> > 2. Should 'cvs -n ci new_file' run the same triggers 'cvs add -c
> >    new_file' runs? If exactly the same, then why the duplication?
> 
> My vision is that the user would run "cvs ci new_file" without the -n
> option.

If this is supposed to be an answer to my first question, then it is not
in fact an acceptable answer. I asked "how do I repeat the check?" and
you've answered "by committing your changes to the repository". Should I
take it as "no, you will have no easy way to repeat the check later"?

> It would run the add-time triggers (for the first commit) and then the
> commit-time triggers.

Will "cvs -n ci new_file" run the triggers in the design you have in
mind?

> The reason for the duplication is partly to catch possible changes in
> policy between add-time and commit-time, and partly to avoid abuses by
> those who unplug their computers as part of their procedure to add new
> files (which includes those who insist that running "cvs add" while
> disconnected is a reasonable thing to do).

Running "cvs add" is indeed reasonable thing to do no matter if
connected or not. When I'm sitting on another end of our planet from the
server running the repository I don't wish to depend on the existence of
the link between my computer and the server when I decide the file
should be added to the project. The more I can do offline, -- the
better, -- ability to do things independently is one of the properties
of distributed systems that make them superior in many cases.

Whatever the reasons for duplication are, the fact is that the server
must run add-time triggers when new file is being added to the
repository. Adding files to repository is what "cvs commit" does. Then
it's logical for "cvs -n commit" to run the triggers as well. Then,
provided you already have a way to run these add-time triggers through
"cvs -n commit", why do you need yet another way to perform the same
operation (through "cvs add")? Thus, the duplication is not in fact
required, -- it's the wrong design choice you are advocating that leads
to the duplication.

> >>> Policy goes above -- it is not hard-coded in the core functionality.
> >>
> >> Agreed. But the tool must be sufficiently flexible to allow robust
> >> implementations of policies. Sometimes triggers are the right way (and
> >> wrapper scripts are not), and we've identified one area here where CVS
> >> is not sufficiently flexible.
> >
> > That's why I insist CVS should have sane set of elementary operations
> > that could be then combined in different ways. I have no objection
> > against "compound" CVS commands that do multiple things (preferably
> > making them atomic), but existing of corresponding elementary commands
> > is a must, I believe. Designing tools in a different manner results in a
> > lack of flexibility, or at least my experience suggests it does.
> 
> Indeed.  To me, the ideal implementation would be a collection of very
> primitive operations glued together by a scripting language, and have the
> command line interface invoke scripts.

... and then you suggest "cvs add" semantics that instead of doing one
thing, adding files to the working copy, will in fact do two things, --
adding files to the working copy and checking if the commitment of these
files later would be OK. It seems you finally contradict to your own
goals, sorry.

Don't you read your own signatures by the way?: "To do two things at
once is to do neither".

> I don't believe that the existing CVS command line offers enough
> flexibility, in a number of ways. And an implementation like the one I
> describe here cannot be built without trashing most of the existing
> code. But that's a different discussion...

If what you have in mind will trash most of the existing code, then
it's obviously better to take a fresh start and design the tools from
scratch. But that won't be the CVS anymore, I'm afraid.

> --
> Paul Sander       | "To do two things at once is to do neither"
> address@hidden | Publilius Syrus, Roman philosopher, 100 B.C.

-- 
Sergei.





reply via email to

[Prev in Thread] Current Thread [Next in Thread]