Search code examples
svnastyle

Automatically indent the code without messing the tracking of changes in svn


I need to run astyle in a project with several source files. There's not a common IDE used by all developers, they develop in vi, gedit, Netbeans, Eclipse, etc. So I can't use a configuration file for indentation. In order to keep a standard in the code indentation I want to run an script (probably in a server) that everyday executes astyle for each source file and commits the changes. But I'm afraid I will loose track of who has made the last changes in the code.

Can I configure svn to keep information of who made the changes before the execution of astyle?

Thx.


Solution

    • SVN already automatically always keep this information (see svn log -l 1 FILE)
    • You have to remember old committer of every (modified && commited after astyle) file and restore (in added by astyle-script revisions) previous commiter - it can be special post-commit hook, in which you can do almost anything

    Hints:

    1. Build changelists (before commits), in which you'll collect files per committer
    2. Commit astyle-related changes under special separated user, using changelists from p.1 or, if you know user's name|password, commit as this user (--username + --password options of svn ci)
    3. Permanent post-commit hook (maybe even pre-commit) can be executed only for special committer and will change author of commit|transaction with propset

    Anyway, administrative reactions and sanctions ("Play by the rules or went out") is more right and short way