[3] | 1 | $Id: readme.txt 353 2007-05-20 10:48:09Z peter $ |
---|
| 2 | |
---|
[341] | 3 | = About svndigest = |
---|
[84] | 4 | |
---|
[341] | 5 | Svndigest traverses a directory structure (controlled by subversion) |
---|
[149] | 6 | and calculates developer statistics for all subversion controlled |
---|
[187] | 7 | entries. The result is written to a sub-directory of a user |
---|
[188] | 8 | specifiable target directory (default is the current working |
---|
[185] | 9 | directory). |
---|
[3] | 10 | |
---|
[341] | 11 | == Statistics == |
---|
| 12 | |
---|
[149] | 13 | To understand what statistics is calculated by svndigest this |
---|
| 14 | definition is needed: The developer who made the latest change to a |
---|
[185] | 15 | line still in use in the latest revision, is considered as the |
---|
| 16 | contributor of that line regardless of who actually originally created |
---|
| 17 | that line. |
---|
[3] | 18 | |
---|
[188] | 19 | For each developer svndigest calculates the number of contributed |
---|
[189] | 20 | lines in the latest (checked out) revision. Svndigest calculates for |
---|
| 21 | each revision, by checking when each line was last changed, how many |
---|
| 22 | lines each developer had contributed at that specific revision and |
---|
[341] | 23 | still are in use. |
---|
[3] | 24 | |
---|
[341] | 25 | == Different linetypes == |
---|
[188] | 26 | |
---|
[341] | 27 | Svndigest parses each file to detect whether lines are `code`, |
---|
| 28 | `comment`, or `other`. Depending on the file name, different |
---|
| 29 | parsing modes are used, which means different sets of rules what is |
---|
| 30 | `code` or `comment` are employed. Common for all modes is that |
---|
| 31 | comment blocks are identified by a start code (e.g. '/*' in a C file) |
---|
| 32 | and a stop code (e.g. '*/' in a C file). If a line contains |
---|
| 33 | alphanumeric characters being outside comment blocks, the line is |
---|
| 34 | considered to be ''code''. Otherwise, if the line contains |
---|
| 35 | alphanumeric characters inside a comment block, the line is considered |
---|
| 36 | to be a line of ''comment''. Otherwise the line is considered to be |
---|
| 37 | `other`. At the time being the following comment identifiers are |
---|
| 38 | used: |
---|
[188] | 39 | |
---|
[341] | 40 | * cc-mode |
---|
| 41 | * files: *.c, *.cc, *.cpp, *.cxx, *.h, *.hh, *.hpp, and *.java |
---|
| 42 | * identifier: /* <comment> */ |
---|
| 43 | * identifier: // <comment> end-of-line |
---|
| 44 | * m4-mode |
---|
| 45 | * files: *.ac *.am *.m4 |
---|
| 46 | * identifier: dnl <comment> end-of-line |
---|
| 47 | * identifier: # <comment> end-of-line |
---|
| 48 | * shell-mode |
---|
| 49 | * files: *.sh *.pl *.pm *config bootstrap Makefile |
---|
| 50 | * identifier: # <comment> end-of-line |
---|
| 51 | * tex-mode |
---|
| 52 | * files: *.tex *.m |
---|
| 53 | * identifier: % <comment> end-of-line |
---|
| 54 | * jsp-mode |
---|
| 55 | * files: *.jsp |
---|
| 56 | * identifier: <!-- <comment> --> |
---|
| 57 | * identifier: <%-- <comment> --%> |
---|
| 58 | * sgml-mode |
---|
| 59 | * files: *.sgml, *.html, *.shtml, *.xml, *.xsl, *.xsd, *.css, and *.rss |
---|
| 60 | * identifier: <!-- <comment> --> |
---|
| 61 | * text-mode |
---|
| 62 | * files: all files not matching any other mode |
---|
| 63 | * identifier: not applicable. All text is considered comments, |
---|
| 64 | i.e., lines are either ''comments'' or ''other'' |
---|
[188] | 65 | |
---|
[342] | 66 | There is one exception to these rules. If the files name ends with |
---|
| 67 | `.in`, the trailing `.in` is ignored and the file name rules above are |
---|
| 68 | applied on the remaining part of the file name. An example is |
---|
| 69 | `test/test_repo.sh.in` that is parsed using the shell-mode rules. |
---|
| 70 | |
---|
[341] | 71 | == Different file types == |
---|
[188] | 72 | |
---|
[46] | 73 | There are many different types of files and for many file types it |
---|
[3] | 74 | does not make sense to define lines. Source code, documentation, and |
---|
[185] | 75 | other human readable files can be treated in single line basis whereas |
---|
| 76 | symbolic links and binary files cannot. svndigest treats binary files |
---|
| 77 | as zero-line files, whereas symbolic links are treated as one-line |
---|
[188] | 78 | files. There is a possibility to exclude files from the statistics, the |
---|
[185] | 79 | use of the property svndigest:ignore. |
---|
[3] | 80 | |
---|
[189] | 81 | Sometimes large test files and XML files are added to the repository |
---|
[185] | 82 | that should not really be counted in the statistics. This is solved |
---|
| 83 | with the svndigest:ignore property. Files with this property are |
---|
[187] | 84 | excluded from statistics. Setting the svndigest:ignore property to a |
---|
[185] | 85 | directory will exclude all siblings to that directory from svndigest |
---|
| 86 | treatment. |
---|
[3] | 87 | |
---|
[351] | 88 | == Configuration == |
---|
| 89 | |
---|
| 90 | The configuration file may be used to define Various behaviors for |
---|
| 91 | svndigest. By default svndigest looks for a config file named `config` |
---|
| 92 | in directory `<root-dir>/.svndigest` (<root-dir> is directory set by |
---|
| 93 | option `--root`). If no such file is found, svndigest behaves as |
---|
| 94 | default. Which file to be used as config file may also be set with |
---|
| 95 | option `--config-file`. To update an old config file you can use the |
---|
| 96 | option `--generate-config`. With this option set the used |
---|
| 97 | configuration will be written to standard output. If new variables has |
---|
| 98 | been added to configuration of svndigest, these variables will be |
---|
| 99 | written with default values. Note: if you have added a comment (e.g. a |
---|
[353] | 100 | subversion keyword) to your old config file, this will not be |
---|
[351] | 101 | inherited to the new config file. To preserve such a comment you must |
---|
| 102 | merge the new config file with the old config file manually. |
---|
| 103 | |
---|
[348] | 104 | == Copyright update == |
---|
| 105 | |
---|
| 106 | Using the option `--copyright` svndigest will try to update the |
---|
| 107 | copyright statement in each of the parsed files. The copyright |
---|
| 108 | statement is detected as the first line containing `Copyright |
---|
| 109 | (C)`. The copyright statement block is defined to start at this line |
---|
| 110 | and ends with the first following line containing no alphanumerical |
---|
| 111 | characters (i.e. line is treated as `other` in statistics). This |
---|
[349] | 112 | copyright statement block is replaced with a new copyright statement |
---|
| 113 | generated from analyzing `svn log`. An author is considered to have |
---|
[348] | 114 | copyright of the file if (s)he has modified the file and thereby |
---|
| 115 | occurs in the log. For an example of the format of the generated |
---|
[351] | 116 | copyright statement, please have a look at the bottom of this file. By |
---|
| 117 | default the `svn user name` of the author is printed in the copyright |
---|
| 118 | statement. This may be overridden by setting a `copyright-alias` in |
---|
| 119 | the config file. In svndigest, e.g., user name `jari` is set to |
---|
| 120 | copyright-alias ''Jari Häkkinen'' and user name `peter` is set to |
---|
| 121 | copyright-alias ''Peter Johansson''. If two (or several) authors are |
---|
| 122 | given the same copyright-alias they are considered as one person in |
---|
| 123 | the copyright statement (i.e. their alias is not repeated). This may |
---|
| 124 | be useful if you want to give copyright to an organization rather than |
---|
| 125 | to individual developers. |
---|
[348] | 126 | |
---|
[352] | 127 | == TracLinks == |
---|
| 128 | |
---|
| 129 | From svndigest 0.6 there is support for TracLinks. The root trac |
---|
| 130 | location may be set in the configuration, in which case various links |
---|
| 131 | to the trac site will be included in the resulting report. This |
---|
| 132 | includes links from revision number to the corresponding revision at |
---|
| 133 | the trac site, and various kinds of links are detected in the messages |
---|
| 134 | in `Recent Log`. |
---|
| 135 | |
---|
[341] | 136 | == Prerequisites == |
---|
[3] | 137 | |
---|
[341] | 138 | Svndigest runs against a working copy (WC), i.e., svndigest will not |
---|
| 139 | run directly against a repository. Svndigest requires that the WC is |
---|
| 140 | pristine before running the analysis, i.e., no files are allowed to be |
---|
| 141 | modified. We also recommend that the WC is in synch with the |
---|
| 142 | repository. Issue `svn update` before running svndigest. |
---|
[185] | 143 | |
---|
[341] | 144 | == Flow of the program == |
---|
[3] | 145 | The current flow of the program is. |
---|
| 146 | |
---|
[341] | 147 | * Check that we are working with a WC in subversion control. |
---|
[3] | 148 | |
---|
[341] | 149 | * Build the requested directory structure ignoring not subversion |
---|
| 150 | controlled items. During the directory structure creation a check |
---|
| 151 | is made that the WC is up to date with the repository. |
---|
[3] | 152 | |
---|
[341] | 153 | * Walk through the directory structure and calculate statistics for |
---|
| 154 | each entry. |
---|
[3] | 155 | |
---|
[341] | 156 | * Create the plots and HTML presentation. |
---|
| 157 | |
---|
| 158 | ---------------------------------------------------------------------- |
---|
| 159 | {{{ |
---|
| 160 | Copyright (C) 2005 Jari Häkkinen |
---|
| 161 | Copyright (C) 2006 Jari Häkkinen, Peter Johansson |
---|
| 162 | Copyright (C) 2007 Peter Johansson |
---|
| 163 | |
---|
| 164 | This file is part of svndigest, http://lev.thep.lu.se/trac/svndigest |
---|
| 165 | |
---|
| 166 | svndigest is free software; you can redistribute it and/or modify it |
---|
| 167 | under the terms of the GNU General Public License as published by the |
---|
| 168 | Free Software Foundation; either version 2 of the License, or (at your |
---|
| 169 | option) any later version. |
---|
| 170 | |
---|
| 171 | svndigest is distributed in the hope that it will be useful, but |
---|
| 172 | WITHOUT ANY WARRANTY; without even the implied warranty of |
---|
| 173 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
---|
| 174 | General Public License for more details. |
---|
| 175 | |
---|
| 176 | You should have received a copy of the GNU General Public License |
---|
| 177 | along with this program; if not, write to the Free Software |
---|
| 178 | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, |
---|
| 179 | USA. |
---|
| 180 | }}} |
---|
| 181 | |
---|
| 182 | |
---|