[svn.haxx.se] · SVN Dev · SVN Users · SVN Org · TSVN Dev · TSVN Users · Subclipse Dev · Subclipse Users · this month's index

Re: Automatic pretty-print

From: Suresh Govindachar <sgovindachar_at_yahoo.com>
Date: 2004-08-19 04:06:08 CEST

Zeus G=F3mez Marmolejo wrote:
>
> I would like to ask one question. I want all the source .c
> files in my repository to be well pretty-printed, all
> conforming a common C programming style. But the problem
> is that the programmers don't do the job well, they forget
> to follow the rules and so...
>
> The ideal think could be at the pre-commit hook execute
> the pretty printer for all the .c source files so that in
> the repository the files all are well stored.

The functionality you are looking for belongs in the text
editor and not in the versioning system. A primary tool of
a programmer/developer is his text editor (I won't argue
here if others say it is his entire IDE). Most modern
text-editors can be made to do either one or both of the
following:

  - automatically pretty-print while text is being entered

  - whenever the file is saved, automatically run some
    program on the file and save only if the program does
    not change the file; if the program does change the
    file, prompt the user for confirmation to continue with
    the save of the changed file.

> Also it would be desirable to check C syntax so all files
> that are in the repository complile all.

The preceding remark is very strange because:

  A requirement for checking into a repository that will be
  used by others (in contrast to a repository that is the
  private "working space" of the developer) is that the
  checked-in version not break anything. This requirement
  is much more stringent that merely having the right
  syntax: the developer must work to establish that his
  changes will not break anything before committing his
  file to the repository (and this work is much more than
  mere syntax checking).

So that remark is very strange indeed.

> But I've seen the comments on the pre-commit template hook
> and explicitly reports that the script must not change the
> transaction.

This "not change" requirement is because the repository must
reflect the working file as of the time when the commit
command was issued. The very concept of versioning would
lose meaning if the thing that got committed was different
from what was issued for commit (other than expansion of
"tags").

> So is there a way to transform (pretty-print) the source
> files before committing them
  [and after the commit command has been issued]?

There should not be any such way.

> If this is not possible, it will be very nice to add it as
> a new feature :D,

Again, the feature you are looking for belongs in the
text-editor. And it should be fairly easy to implement
therein.

--Suresh

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@subversion.tigris.org
For additional commands, e-mail: users-help@subversion.tigris.org
Received on Thu Aug 19 04:05:50 2004

This is an archived mail posted to the Subversion Users mailing list.

This site is subject to the Apache Privacy Policy and the Apache Public Forum Archive Policy.