Codebase list gource / e172110
Imported Upstream version 0.20 Andrew Caudwell 14 years ago
25 changed file(s) with 701 addition(s) and 296 deletion(s). Raw diff Collapse all Expand all
0 0.20:
1 * Added bloom effect (turn off with --disable-bloom).
2 * Added support for Mercurial (thanks to Justin Love for gource.style).
3 * --start-position option now works in combination with --disable-progress.
4
5 0.19:
6 * Use time_t instead of long for timestamps.
7
8 0.18:
9 * Fixed camera movement while the simulation is paused.
10
11 0.17:
12 * Show correct month for CVS logs.
13 * Added time scaling (Bitshifter).
14
15 0.16:
16 * Added --hide-dirnames option.
17 * Added --user-scale option.
18 * Added --date-format option (Pat Notz).
19 * Fix bug when encountering long log lines.
20 * Fixed incorrect parsing of trivial merges.
21 * Fixed building issues on OSX.
22
23 0.15:
24 * Added PPM output support for creating videos (Johannes Schindelin).
25 * Added experimental Apache combined access log support (--log-format apache).
26 * Added --stop-position and --stop-on-idle options (useful for making videos).
27 * Added --max-file-lag option to limit how long after a commit file changes can take to appear.
28 * Added --no-renames to the git log command as they don't display correctly.
29 * Added --max-user-speed and --user-friction as options.
30 * Now builds on OSX Leopard (with the required libaries installed).
31 * Caught raw exception from replace_invalid().
32 * Added CXXFLAGS. You may want to override the default (eg CXXFLAGS=-O3 ./configure).
33
34 0.14:
35 * Updated SVN instructions.
36
37 0.13:
38 * Removed single quotes from log command (fixes running gource --git-log-command in back ticks)
39 * Added SVN instructions.
40 * Fixed manpage hyphens.
41
42 0.12:
43 * Added --enable-ttf-font-dir=DIR option to configure (to specify the ttf-freefont directory).
44 * UTF-8 support using UTF8-CPP (http://utfcpp.sourceforge.net/).
45 * Changed the git log command (see --git-log-command) to require less work to parse.
46 Log files generated with the previous git-log command used by gource should continue to work.
47 * Allow --seconds-per-day value less than 1.0.
48 * Added --git-branch command.
49 * Added --loop command.
50 * Added --crop command.
51
52 0.11:
53 * Made N key skip to next entry.
54 * Documented --user-image-dir flag.
55 * temp file name now uses uid instead of time
56
57 0.1:
58 * First release.
1414 mkdir -p -m 755 $(DESTDIR)/$(bindir)
1515 mkdir -p -m 755 ${DESTDIR}/$(gourcedatadir)
1616 mkdir -p -m 755 ${DESTDIR}/$(mandir)/man1
17 cp data/*.tga ${DESTDIR}/$(gourcedatadir)/
1718 cp data/*.png ${DESTDIR}/$(gourcedatadir)/
19 cp data/gource.style ${DESTDIR}/$(gourcedatadir)/
1820 cp gource ${DESTDIR}/$(bindir)/
1921 sed 's|GOURCE_DATADIR|$(gourcedatadir)|g' data/gource.1 > ${DESTDIR}/$(mandir)/man1/gource.1
2022 gzip -f9 ${DESTDIR}/$(mandir)/man1/gource.1
1414 3. Installation
1515 4. Using Gource
1616 5. Building Gource
17 6. Changes
18 7. Copyright
17 6. Copyright
1918
2019 1. Description
2120 ===============
8887 Get the git log of a branch other than the current one.
8988
9089 --git-log-command
91 Print the git-log command used by gource.
90 Print the git log command used by gource.
91
92 --hg-log-command
93 Print the hg log (Mercurial) command used by gource.
9294
9395 --cvs-exp-command
9496 Print the cvs-exp.pl log command used by gource.
120122 --multi-sampling
121123 Enable multi-sampling.
122124
125 --bloom-multiplier FLOAT
126 Adjust the amount of bloom.
127
128 --bloom-intensity FLOAT
129 Adjust the intensity of the bloom.
130
123131 --disable-progress
124132 Disable progress bar.
125133
134 --disable-bloom
135 Disable bloom effect.
136
126137 --max-files
127138 Set the maximum number of files. Excess files will be discarded.
128139
141152 --hide-users
142153 Hide users.
143154
155 --hide-tree
156 Hide tree.
157
158 --hide-files
159 Hide files.
160
144161 --hide-usernames
145162 Hide usernames.
146163
162179 path Either a git directory, a pre-generated log file (see --git-log-command, --cvs-exp-command or the custom
163180 log format) or '-' to read STDIN. If path is ommited gource will attempt to read a git log from the current directory.
164181
165 Git Examples:
166
167 View the log of the Git respository in the current path:
182 Git and Mercurial Examples:
183
184 View the log of the respository in the current path:
168185
169186 gource
170187
171 View the log of a Git project in the specified directory:
188 View the log of a project in the specified directory:
172189
173190 gource my-project-dir
174191
175 Save a copy of the log using in a special git-log format and play it back. Use --git-log-command to get the git-log
176 options you should use:
192 Save a copy of the log using in a special log format and play it back (example is for Git, Mercurial users see --hg-log-command):
177193
178194 cd my-git-project
179195 `gource --git-log-command` > my-git-project.log
192208
193209 Custom Log Format:
194210
195 If you want to use Gource with something other than the supported systems, there is a pipe delimited custom log format:
211 If you want to use Gource with something other than the supported systems, there is a pipe ('|') delimited custom log format:
196212
197213 timestamp - A unix timestamp of when the update occured.
198214 username - The name of the user who made the update.
205221 You can create a video of Gource using the --output-ppm-stream option. This creates an uncompressed sequence of
206222 screenshots in PPM format which can then be processed by another program (such as ffmpeg) to produce a video file.
207223
208 The below command line will create a video at 60fps in h264 format (assumes you have ffmpeg with h264 support):
209
210 gource --output-ppm-stream - | ffmpeg -y -b 3000K -r 60 -f image2pipe -vcodec ppm -i - gource.h264
224 The below command line will create a video at 60fps in x264 format (assumes you have ffmpeg with x264 support):
225
226 gource --output-ppm-stream - | ffmpeg -y -b 3000K -r 60 -f image2pipe -vcodec ppm -i - -vcodec libx264 gource.mp4
211227
212228 Interface:
213229
258274 On Windows I recommend compiling the project gource.win32.cbp
259275 with the Code Blocks IDE (www.codeblocks.org).
260276
261 6. Changes
262 ==========
263
264 0.17:
265 * Show correct month for CVS logs.
266 * Added time scaling (Bitshifter).
267
268 0.16:
269 * Added --hide-dirnames option.
270 * Added --user-scale option.
271 * Added --date-format option (Pat Notz).
272 * Fix bug when encountering long log lines.
273 * Fixed incorrect parsing of trivial merges.
274 * Fixed building issues on OSX.
275
276 0.15:
277 * Added PPM output support for creating videos (Johannes Schindelin).
278 * Added experimental Apache combined access log support (--log-format apache).
279 * Added --stop-position and --stop-on-idle options (useful for making videos).
280 * Added --max-file-lag option to limit how long after a commit file changes can take to appear.
281 * Added --no-renames to the git log command as they don't display correctly.
282 * Added --max-user-speed and --user-friction as options.
283 * Now builds on OSX Leopard (with the required libaries installed).
284 * Caught raw exception from replace_invalid().
285 * Added CXXFLAGS. You may want to override the default (eg CXXFLAGS=-O3 ./configure).
286
287 0.14:
288 * Updated SVN instructions.
289
290 0.13:
291 * Removed single quotes from log command (fixes running gource --git-log-command in back ticks)
292 * Added SVN instructions.
293 * Fixed manpage hyphens.
294
295 0.12:
296 * Added --enable-ttf-font-dir=DIR option to configure (to specify the ttf-freefont directory).
297 * UTF-8 support using UTF8-CPP (http://utfcpp.sourceforge.net/).
298 * Changed the git log command (see --git-log-command) to require less work to parse.
299 Log files generated with the previous git-log command used by gource should continue to work.
300 * Allow --seconds-per-day value less than 1.0.
301 * Added --git-branch command.
302 * Added --loop command.
303 * Added --crop command.
304
305 0.11:
306 * Made N key skip to next entry.
307 * Documented --user-image-dir flag.
308 * temp file name now uses uid instead of time
309
310 0.1:
311 * First release.
312
313 7. Copyright
277 6. Copyright
314278 ============
315279
316280 Gource - software version control visualization
00 #! /bin/sh
11 # Guess values for system-dependent variables and create Makefiles.
2 # Generated by GNU Autoconf 2.61 for Gource 0.1.
2 # Generated by GNU Autoconf 2.61 for Gource 0.20.
33 #
44 # Report bugs to <acaudwell@gmail.com>.
55 #
573573 # Identity of this package.
574574 PACKAGE_NAME='Gource'
575575 PACKAGE_TARNAME='gource'
576 PACKAGE_VERSION='0.1'
577 PACKAGE_STRING='Gource 0.1'
576 PACKAGE_VERSION='0.20'
577 PACKAGE_STRING='Gource 0.20'
578578 PACKAGE_BUGREPORT='acaudwell@gmail.com'
579579
580580 ac_unique_file="src/main.h"
12151215 # Omit some internal or obsolete options to make the list less imposing.
12161216 # This message is too long to be a string in the A/UX 3.1 sh.
12171217 cat <<_ACEOF
1218 \`configure' configures Gource 0.1 to adapt to many kinds of systems.
1218 \`configure' configures Gource 0.20 to adapt to many kinds of systems.
12191219
12201220 Usage: $0 [OPTION]... [VAR=VALUE]...
12211221
12841284
12851285 if test -n "$ac_init_help"; then
12861286 case $ac_init_help in
1287 short | recursive ) echo "Configuration of Gource 0.1:";;
1287 short | recursive ) echo "Configuration of Gource 0.20:";;
12881288 esac
12891289 cat <<\_ACEOF
12901290
13871387 test -n "$ac_init_help" && exit $ac_status
13881388 if $ac_init_version; then
13891389 cat <<\_ACEOF
1390 Gource configure 0.1
1390 Gource configure 0.20
13911391 generated by GNU Autoconf 2.61
13921392
13931393 Copyright (C) 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001,
14011401 This file contains any messages produced by compilers while
14021402 running configure, to aid debugging if configure makes a mistake.
14031403
1404 It was created by Gource $as_me 0.1, which was
1404 It was created by Gource $as_me 0.20, which was
14051405 generated by GNU Autoconf 2.61. Invocation command line was
14061406
14071407 $ $0 $@
97979797 # report actual input values of CONFIG_FILES etc. instead of their
97989798 # values after options handling.
97999799 ac_log="
9800 This file was extended by Gource $as_me 0.1, which was
9800 This file was extended by Gource $as_me 0.20, which was
98019801 generated by GNU Autoconf 2.61. Invocation command line was
98029802
98039803 CONFIG_FILES = $CONFIG_FILES
98409840 _ACEOF
98419841 cat >>$CONFIG_STATUS <<_ACEOF
98429842 ac_cs_version="\\
9843 Gource config.status 0.1
9843 Gource config.status 0.20
98449844 configured by $0, generated by GNU Autoconf 2.61,
98459845 with options \\"`echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`\\"
98469846
22
33 AC_PREREQ(2.61)
44
5 AC_INIT(Gource, 0.1, [acaudwell@gmail.com])
5 AC_INIT(Gource, 0.20, [acaudwell@gmail.com])
66 AC_CONFIG_SRCDIR([src/main.h])
77
88 AC_CANONICAL_HOST
Binary diff not shown
5858 Get the git log of a branch other than the current one.
5959 .TP
6060 \fB\-\-git\-log\-command\fR
61 Print the git-log command used by \fIgource\fR.
61 Print the git log command used by \fIgource\fR.
62 .TP
63 \fB\-\-hg\-log\-command\fR
64 Print the hg log command (Mercurial) used by \fIgource\fR.
6265 .TP
6366 \fB\-\-cvs\-exp\-command\fR
6467 Print the cvs-exp.pl log command used by \fIgource\fR.
9093 \fB\-\-multi\-sampling\fR
9194 Enable multi-sampling.
9295 .TP
96 \fB\-\-bloom\-multiplier FLOAT\fR
97 Adjust the amount of bloom.
98 .TP
99 \fB\-\-bloom\-intensity FLOAT\fR
100 Adjust the intensity of the bloom.
101 .TP
93102 \fB\-\-disable\-progress\fR
94103 Disable progress bar.
95104 .TP
105 \fB\-\-disable\-bloom\fR
106 Disable bloom effect.
107 .TP
96108 \fB\-\-max\-files\fR
97109 Set the maximum number of files. Excess files will be discarded.
98110 .TP
111123 \fB\-\-hide\-users\fR
112124 Hide users.
113125 .TP
126 \fB\-\-hide\-tree\fR
127 Hide tree.
128 .TP
129 \fB\-\-hide\-files\fR
130 Hide files.
131 .TP
114132 \fB\-\-hide\-usernames\fR
115133 Hide usernames.
116134 .TP
131149 .TP
132150 \fBpath\fR
133151 Either a Git directory, a pre-generated log file (see -\-git\-log\-command, -\-cvs\-exp\-command or the custom log format) or '\-' to read STDIN. If path is ommited \fIgource\fR will attempt to read a git log from the current directory.
134 .SH GIT EXAMPLES
135
136 View the log of the Git respository in the current path:
152 .SH GIT AND MERCURIAL EXAMPLES
153
154 View the log of the respository in the current path:
137155
138156 .ti 10
139157 \fIgource\fR
140158
141 View the log of a Git project in the specified directory:
159 View the log of a project in the specified directory:
142160
143161 .ti 10
144162 \fIgource\fR my\-project\-dir
145163
146 Save a copy of the log using in a special git-log format and play it back. Use \-\-git-log-command to get the git-log options you should use:
164 Save a copy of the log using in a special log format and play it back (example is for Git, Mercurial users see \-\-hg\-log-command):
147165
148166 .ti 10
149167 cd my\-git\-project
162180 CVS - http://code.google.com/p/gource/wiki/CVS
163181 .ti 10
164182 SVN - http://code.google.com/p/gource/wiki/SVN
165 .ti 10
166 Mercurial - http://code.google.com/p/gource/wiki/Mercurial
167183
168184 .SH CUSTOM LOG FORMAT
169185
170 If you want to use Gource with something other than the supported systems, there is a pipe delimited custom log format:
186 If you want to use Gource with something other than the supported systems, there is a pipe ('|') delimited custom log format:
171187
172188 .ti 10
173189 timestamp - A unix timestamp of when the update occured.
184200 You can create a video of Gource using the \-\-output\-ppm\-stream option. This creates an uncompressed sequence of
185201 screenshots in PPM format which can then be processed by another program (such as ffmpeg) to produce a video file.
186202
187 The below command line will create a video at 60fps in h264 format (assumes you have ffmpeg with h264 support):
188
189 .ti 10
190 gource \-\-output-ppm-stream \- | ffmpeg \-y \-b 3000K \-r 60 \-f image2pipe \-vcodec ppm \-i \- gource.h264
203 The below command line will create a video at 60fps in x264 format (assumes you have ffmpeg with x264 support):
204
205 .ti 10
206 gource \-\-output-ppm-stream \- | ffmpeg \-y \-b 3000K \-r 60 \-f image2pipe \-vcodec ppm \-i \- \-vcodec libx264 gource.mp4
191207
192208 .SH INTERFACE
193209 The time shown in the top left of the screen is set initially from the first log entry read and is incremented according to the simulation speed (\-\-seconds\-per\-day).
0 changeset = '{file_adds}{file_copies}{file_mods}{file_dels}'
1 file_mod = "{date|hgdate}|{author|person}|M|{file_mod}\n"
2 file_add = "{date|hgdate}|{author|person}|A|{file_add}\n"
3 file_del = "{date|hgdate}|{author|person}|D|{file_del}\n"
4 file_copy = "{date|hgdate}|{author|person}|A|{name}\n"
55 SUBDIRS = core
66 CXX = g++
77 CC = gcc
8 objects = zoomcamera.o slider.o spline.o dirnode.o action.o pawn.o file.o user.o gource.o commitlog.o git.o gitraw.o custom.o cvs-exp.o apache.o ppm.o main.o
8 objects = zoomcamera.o slider.o spline.o dirnode.o action.o pawn.o file.o user.o gource.o commitlog.o git.o hg.o gitraw.o custom.o cvs-exp.o apache.o ppm.o main.o
99
1010 all:
1111 for dir in ${SUBDIRS} ; do ( cd $$dir ; ${MAKE} all ); done
4545 void RAction::draw(float dt) {
4646 if(isFinished()) return;
4747
48 glDisable(GL_TEXTURE_2D);
49 glBlendFunc (GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
50 glEnable(GL_BLEND);
51
5248 vec2f src = source->getPos();
5349 vec2f dest = target->getAbsolutePos();
5450
6763
6864 glBegin(GL_QUADS);
6965 glColor4fv(col2);
70
66 glTexCoord2f(0.0,0.0);
7167 glVertex2f(src.x - offset_src.x, src.y - offset_src.y);
68 glTexCoord2f(0.0,1.0);
7269 glVertex2f(src.x + offset_src.x, src.y + offset_src.y);
7370
7471 glColor4fv(col1);
72 glTexCoord2f(1.0,1.0);
73 glVertex2f(dest.x + offset.x, dest.y + offset.y);
74 glTexCoord2f(1.0,0.0);
75 glVertex2f(dest.x - offset.x, dest.y - offset.y);
76 glEnd();
7577
78 /*
79 glBegin(GL_QUADS);
80 glColor4fv(col2);
81 glTexCoord2f(0.0,0.0);
82 glVertex2f(src.x - offset_src.x, src.y - offset_src.y);
83 glTexCoord2f(1.0,0.0);
84 glVertex2f(src.x + offset_src.x, src.y + offset_src.y);
85
86 glColor4fv(col1);
87 glTexCoord2f(0.0,0.0);
7688 glVertex2f(dest.x + offset.x, dest.y + offset.y);
77 glVertex2f(dest.x - offset.x, dest.y - offset.y);
89 glTexCoord2f(1.0,0.0);
90 glVertex2f(dest.x - offset.x, dest.y - offset.y);
7891 glEnd();
92 */
7993 }
8094
8195 CreateAction::CreateAction(RUser* source, RFile* target, float addedtime) : RAction(source, target, addedtime) {
191191 return false;
192192 }
193193
194 std::string RCommitLog::createTempLog() {
195 //create temp file
196 char logfile_buff[1024];
197
198 #ifdef _WIN32
199 DWORD tmplen = GetTempPath(0, "");
200
201 if(tmplen == 0) return 0;
202
203 std::vector<TCHAR> temp(tmplen+1);
204
205 tmplen = GetTempPath(static_cast<DWORD>(temp.size()), &temp[0]);
206
207 if(tmplen == 0 || tmplen >= temp.size()) return 0;
208
209 std::string temp_file_path(temp.begin(),
210 temp.begin() + static_cast<std::size_t>(tmplen));
211
212 temp_file_path += "gource.tmp";
213
214 sprintf(logfile_buff, "%s", temp_file_path.c_str());
215 #else
216 uid_t myuid = getuid();
217 sprintf(logfile_buff, "/tmp/gource-%d.tmp", myuid);
218 #endif
219 temp_file = std::string(logfile_buff);
220
221 return temp_file;
222 }
223
194224 // RCommitFile
195225
196226 RCommitFile::RCommitFile(std::string filename, std::string action, vec3f colour) {
235265 return true;
236266 }
237267
238
239268 void RCommit::debug() {
240269 debugLog("files:\n");
241270
4141 class RCommit {
4242 vec3f fileColour(std::string filename);
4343 public:
44 long timestamp;
44 time_t timestamp;
4545 std::string username;
4646
4747 std::list<RCommitFile> files;
7373
7474 bool checkFirstChar(int firstChar, std::istream& stream);
7575
76 std::string createTempLog();
77
7678 virtual bool parseCommit(RCommit& commit) { return false; };
7779 public:
7880 RCommitLog(std::string logfile, int firstChar = -1);
4141 SDLAppDisplay::~SDLAppDisplay() {
4242 }
4343
44 void SDLAppDisplay::displayArgs(int argc, char *argv[], int* xres, int* yres, bool* fullscreen, std::vector<std::string>* otherargs) {
45
46 for (int i=1; i<argc; i++) {
47 debugLog("argv[%d] = %s\n", i, argv[i]);
48
49 if (!strcmp(argv[i],"-f")) {
50 *fullscreen = 1;
51 continue;
52 }
53 else if (!strcmp(argv[i],"-w")) {
54 *fullscreen = 0;
55 continue;
56 }
57
58 //get video mode
59 if(strchr(argv[i], '-') != 0 && strlen(argv[i])>1) {
60 std::string argstr(argv[i], 1, strlen(argv[i])-1);
61 debugLog("%s\n", argstr.c_str());
62 size_t x = argstr.rfind("x");
63
64 if(x != std::string::npos) {
65 std::string widthstr = argstr.substr(0, x);
66 std::string heightstr = argstr.substr(x+1);
67
68 int width = atoi(widthstr.c_str());
69 int height = atoi(heightstr.c_str());
70
71 if(width!=0 && height!=0) {
72 debugLog("w=%d, h=%d\n",width,height);
73
74 *xres = width;
75 *yres = height;
76 continue;
77 }
78 }
79 }
80
81 // non display argument
82 if(otherargs != 0) {
83 otherargs->push_back(std::string(argv[i]));
84 }
85 }
86 }
87
8844 void SDLAppDisplay::setClearColour(vec3f colour) {
8945 clearColour = colour;
9046 }
9551 return flags;
9652 }
9753
98 std::string SDLAppDisplay::getPath() {
99 return path;
100 }
101
102 bool SDLAppDisplay::dirExists(std::string path) {
103 struct stat st;
104 return !stat(path.c_str(), &st) && S_ISDIR(st.st_mode);
105 }
106
107 void SDLAppDisplay::detectPath() {
108
109 std::string resource_dir = "data/";
110 std::string fonts_dir = "data/fonts/";
111 #ifdef _WIN32
112 char szAppPath[MAX_PATH];
113 GetModuleFileName(0, szAppPath, MAX_PATH);
114
115 // Extract directory
116 std::string exepath = std::string(szAppPath);
117
118 int pos = exepath.rfind("\\");
119
120 path = exepath.substr(0, pos+1);
121 resource_dir = path + std::string("\\data\\");
122 fonts_dir = path + std::string("\\data\\fonts\\");
123 #endif
124
125 #ifdef SDLAPP_RESOURCE_DIR
126 if (dirExists(SDLAPP_RESOURCE_DIR)) {
127 resource_dir = SDLAPP_RESOURCE_DIR;
128 fonts_dir = SDLAPP_RESOURCE_DIR + std::string("/fonts/");
129 }
130 #endif
131
132 #ifdef SDLAPP_FONT_DIR
133 if (dirExists(SDLAPP_FONT_DIR)) {
134 fonts_dir = SDLAPP_FONT_DIR;
135 }
136 #endif
137
138 texturemanager.setDir(resource_dir);
139 fontmanager.setDir(fonts_dir);
140 }
141
14254 void SDLAppDisplay::enableVsync(bool vsync) {
14355 this->vsync = vsync;
14456 }
15870 }
15971
16072 void SDLAppDisplay::init(std::string window_title, int width, int height, bool fullscreen) {
161 detectPath();
16273
16374 this->width = width;
16475 this->height = height;
4646 class SDLAppDisplay {
4747 SDL_Surface *surface;
4848
49 std::string path;
50
5149 bool enable_shaders;
5250 bool enable_alpha;
5351 bool vsync;
6260
6361 SDLAppDisplay();
6462 ~SDLAppDisplay();
65
66 void displayArgs(int argc, char *argv[], int* xres, int* yres, bool* fullscreen, std::vector<std::string>* otherargs = 0);
6763
6864 void init(std::string window_title, int xres, int yres, bool fullscreen);
6965
8480 void mode3D(float fov, float znear, float zfar);
8581 void mode2D();
8682
87 std::string getPath();
88
89 bool dirExists(std::string path);
90 void detectPath();
91
9283 vec4f currentColour();
9384
9485 void renderToTexture(GLuint target, int width, int height, GLenum internalFormat);
2626
2727 #include "sdlapp.h"
2828
29 std::string gSDLAppResourceDir;
30
31 #ifdef _WIN32
32 std::string gSDLAppPathSeparator = "\\";
33 #else
34 std::string gSDLAppPathSeparator = "/";
35 #endif
36
37 bool SDLAppDirExists(std::string dir) {
38 struct stat st;
39 return !stat(dir.c_str(), &st) && S_ISDIR(st.st_mode);
40 }
41
42 void SDLAppInit() {
43 if(gSDLAppResourceDir.size()>0) return;
44
45 std::string resource_dir = "data/";
46 std::string fonts_dir = "data/fonts/";
47 #ifdef _WIN32
48 char szAppPath[MAX_PATH];
49 GetModuleFileName(0, szAppPath, MAX_PATH);
50
51 // Extract directory
52 std::string exepath = std::string(szAppPath);
53
54 int pos = exepath.rfind("\\");
55
56 path = exepath.substr(0, pos+1);
57 resource_dir = path + std::string("\\data\\");
58 fonts_dir = path + std::string("\\data\\fonts\\");
59 #else
60 //get working directory
61 char cwd_buff[1024];
62
63 if(getcwd(cwd_buff, 1024) == cwd_buff) {
64 resource_dir = std::string(cwd_buff) + std::string("/") + resource_dir;
65 fonts_dir = std::string(cwd_buff) + std::string("/") + fonts_dir;
66 }
67
68 #endif
69
70 #ifdef SDLAPP_RESOURCE_DIR
71 if (SDLAppDirExists(SDLAPP_RESOURCE_DIR)) {
72 resource_dir = SDLAPP_RESOURCE_DIR;
73 fonts_dir = SDLAPP_RESOURCE_DIR + std::string("/fonts/");
74 }
75 #endif
76
77 #ifdef SDLAPP_FONT_DIR
78 if (SDLAppDirExists(SDLAPP_FONT_DIR)) {
79 fonts_dir = SDLAPP_FONT_DIR;
80 }
81 #endif
82
83 texturemanager.setDir(resource_dir);
84 fontmanager.setDir(fonts_dir);
85
86 gSDLAppResourceDir = resource_dir;
87 }
88
89 void SDLAppParseArgs(int argc, char *argv[], int* xres, int* yres, bool* fullscreen, std::vector<std::string>* otherargs) {
90 SDLAppInit();
91
92 for (int i=1; i<argc; i++) {
93 debugLog("argv[%d] = %s\n", i, argv[i]);
94
95 if (!strcmp(argv[i],"-f")) {
96 *fullscreen = 1;
97 continue;
98 }
99 else if (!strcmp(argv[i],"-w")) {
100 *fullscreen = 0;
101 continue;
102 }
103
104 //get video mode
105 if(strchr(argv[i], '-') != 0 && strlen(argv[i])>1) {
106 std::string argstr(argv[i], 1, strlen(argv[i])-1);
107 debugLog("%s\n", argstr.c_str());
108 size_t x = argstr.rfind("x");
109
110 if(x != std::string::npos) {
111 std::string widthstr = argstr.substr(0, x);
112 std::string heightstr = argstr.substr(x+1);
113
114 int width = atoi(widthstr.c_str());
115 int height = atoi(heightstr.c_str());
116
117 if(width!=0 && height!=0) {
118 debugLog("w=%d, h=%d\n",width,height);
119
120 *xres = width;
121 *yres = height;
122 continue;
123 }
124 }
125 }
126
127 // non display argument
128 if(otherargs != 0) {
129 otherargs->push_back(std::string(argv[i]));
130 }
131 }
132 }
133
29134 SDLApp::SDLApp() {
30135 fps=0;
31136 return_code=0;
3232
3333 #include <vector>
3434
35 extern std::string gSDLAppResourceDir;
36 extern std::string gSDLAppPathSeparator;
37
38 void SDLAppInit();
39 bool SDLAppDirExists(std::string dir);
40 void SDLAppParseArgs(int argc, char *argv[], int* xres, int* yres, bool* fullscreen, std::vector<std::string>* otherargs = 0);
41
3542 class SDLApp {
3643 int frame_count;
3744 int fps_updater;
1616
1717 #include "custom.h"
1818
19 Regex custom_regex("^([0-9]+)\\|([^|]+)\\|([ADM]?)\\|([^|]+)(?:\\|#?([A-F0-9]{6}))?");
19 Regex custom_regex("^([0-9]+)\\|([^|]*)\\|([ADM]?)\\|([^|]+)(?:\\|#?([A-F0-9]{6}))?");
2020
2121 CustomLog::CustomLog(std::string logfile) : RCommitLog(logfile) {
2222 }
5353
5454 commit.username = entries[1];
5555
56 if(commit.username.size()==0) {
57 commit.username = "Unknown";
58 }
59
5660 std::string action = "A";
5761
5862 if(entries[2].size()>0) {
6771 colour = parseColour(entries[4]);
6872 }
6973
70 debugLog("file = %s, timestamp=%d, username=%s, action=%s\n", entries[3].c_str(),
71 commit.timestamp, commit.username.c_str(), action.c_str());
74 // debugLog("file = %s, timestamp=%d, username=%s, action=%s\n", entries[3].c_str(),
75 // commit.timestamp, commit.username.c_str(), action.c_str());
7276
7377 if(has_colour) {
7478 commit.addFile(entries[3], action, colour);
7680 commit.addFile(entries[3], action);
7781 }
7882
79 commit.debug();
83 //commit.debug();
8084
8185 return true;
8286 }
2424
2525 float gGourceElasticity = 0.0;
2626
27 float gGourceBloomMultiplier = 1.0;
28 float gGourceBloomIntensity = 0.75;
29
2730 bool gGourceNodeDebug = false;
2831 bool gGourceGravity = true;
2932 bool gGourceDrawDirName = true;
3336 int gGourceFileInnerLoops = 0;
3437
3538 std::map<std::string, RDirNode*> gGourceDirMap;
36
37 TextureResource* beamtex = 0;
3839
3940 RDirNode::RDirNode(RDirNode* parent, std::string abspath) {
4041
5354 pos = parentPos;
5455 } else {
5556 pos = vec2f(0.0f, 0.0f);
56 }
57
58 if(beamtex==0) {
59 beamtex = texturemanager.grab("beam.png");
6057 }
6158
6259 float padded_file_radius = gGourceFileDiameter * 0.5;
10031000
10041001 void RDirNode::drawEdgeShadows(float dt) {
10051002
1006 if(parent==0) glBindTexture(GL_TEXTURE_2D, beamtex->textureid);
1007
10081003 for(std::list<RDirNode*>::iterator it = children.begin(); it != children.end(); it++) {
10091004 RDirNode* child = (*it);
10101005
10191014
10201015 void RDirNode::drawEdges(float dt) {
10211016
1022 if(parent==0) glBindTexture(GL_TEXTURE_2D, beamtex->textureid);
1023
10241017 for(std::list<RDirNode*>::iterator it = children.begin(); it != children.end(); it++) {
10251018 RDirNode* child = (*it);
10261019
10301023
10311024 child->drawEdges(dt);
10321025 }
1026 }
1027 }
1028
1029 void RDirNode::drawBloom(Frustum& frustum, float dt) {
1030
1031 if(isVisible() && frustum.boundsInFrustum(quadItemBounds)) {
1032
1033 float bloom_radius = dir_radius * 2.0 * gGourceBloomMultiplier;
1034
1035 vec4f bloom_col = col * gGourceBloomIntensity;
1036
1037 glColor4f(bloom_col.x, bloom_col.y, bloom_col.z, 1.0);
1038
1039 glPushMatrix();
1040 glTranslatef(pos.x, pos.y, 0.0);
1041
1042 glBegin(GL_QUADS);
1043 glTexCoord2f(1.0, 1.0);
1044 glVertex2f(bloom_radius,bloom_radius);
1045 glTexCoord2f(1.0, 0.0);
1046 glVertex2f(bloom_radius,-bloom_radius);
1047 glTexCoord2f(0.0, 0.0);
1048 glVertex2f(-bloom_radius,-bloom_radius);
1049 glTexCoord2f(0.0, 1.0);
1050 glVertex2f(-bloom_radius,bloom_radius);
1051 glEnd();
1052 glPopMatrix();
1053
1054 }
1055
1056 for(std::list<RDirNode*>::iterator it = children.begin(); it != children.end(); it++) {
1057 RDirNode* node = (*it);
1058 node->drawBloom(frustum,dt);
10331059 }
10341060 }
10351061
174174 void drawEdges(float dt);
175175 void drawEdgeShadows(float dt);
176176
177 void drawBloom(Frustum& frustum, float dt);
178
177179 void drawShadows(Frustum& frustum, float dt);
178180 void drawFiles(Frustum& frustum, float dt);
179181 void drawSimple(Frustum& frustum, float dt);
191193 extern float gGourceForceGravity;
192194 extern bool gGourceDrawDirName;
193195
196 extern float gGourceBloomMultiplier;
197 extern float gGourceBloomIntensity;
194198 extern float gGourceElasticity;
195199
196200 extern std::map<std::string, RDirNode*> gGourceDirMap;
6262 std::string command = getLogCommand();
6363
6464 //create temp file
65 char cmd_buff[2048];
66 char logfile_buff[1024];
67
68 #ifdef _WIN32
69 DWORD tmplen = GetTempPath(0, "");
70
71 if(tmplen == 0) return 0;
72
73 std::vector<TCHAR> temp(tmplen+1);
74
75 tmplen = GetTempPath(static_cast<DWORD>(temp.size()), &temp[0]);
76
77 if(tmplen == 0 || tmplen >= temp.size()) return 0;
78
79 std::string temp_file_path(temp.begin(),
80 temp.begin() + static_cast<std::size_t>(tmplen));
81
82 temp_file_path += "gource.tmp";
83
84 sprintf(logfile_buff, "%s", temp_file_path.c_str());
85 #else
86 uid_t myuid = getuid();
87 sprintf(logfile_buff, "/tmp/gource-%d.tmp", myuid);
88 #endif
89
90 sprintf(cmd_buff, "%s > %s", command.c_str(), logfile_buff);
91 temp_file = std::string(logfile_buff);
65 createTempLog();
9266
9367 if(chdir(dir.c_str()) != 0) {
9468 return 0;
9569 }
9670
71 char cmd_buff[2048];
72 sprintf(cmd_buff, "%s > %s", command.c_str(), temp_file.c_str());
73
9774 int command_rc = system(cmd_buff);
9875
9976 if(command_rc != 0) {
77 chdir(cwd_buff);
10078 return 0;
10179 }
10280
10381 // check for new-enough Git version
10482 // if %aN does not appear to be supported try %an
105 std::ifstream in(logfile_buff);
83 std::ifstream in(temp_file.c_str());
10684 char firstBytes[9];
10785 in.read(firstBytes, 8);
10886 in.close();
1818
1919 float gGourceAutoSkipSeconds = 3.0;
2020 bool gGourceFileLoop = false;
21 bool gGourceHideTree = false;
22 bool gGourceHideFiles = false;
2123 bool gGourceHideUsernames = false;
2224 bool gGourceHideDate = false;
25 bool gGourceDisableBloom = false;
2326 bool gGourceDisableProgress = false;
2427 bool gGourceQuadTreeDebug = false;
2528
116119 RECT windowRect;
117120 if(GetWindowRect(consoleWindow, &windowRect)) {
118121 float width = windowRect.right - windowRect.left;
119 MoveWindow(consoleWindow,windowRect.left,windowRect.top,width,850,true);
122 MoveWindow(consoleWindow,windowRect.left,windowRect.top,width,1000,true);
120123 }
121124 }
122125 #endif
153156
154157 printf(" --log-format FORMAT Specify format of log (git,cvs,custom)\n");
155158 printf(" --git-branch Get the git log of a particular branch\n");
156 printf(" --git-log-command Show git-log command used by gource\n");
157 printf(" --cvs-exp-command Show cvs-exp.pl log command used by gource\n\n");
159 printf(" --git-log-command Show git log command used by gource\n");
160 printf(" --cvs-exp-command Show cvs-exp.pl log command used by gource\n");
161 printf(" --hg-log-command Show hg log (Mercurial) command used by gource\n\n");
158162
159163 printf(" --multi-sampling Enable multi-sampling\n");
160164 printf(" --crop AXIS Crop view on an axis (vertical,horizontal)\n\n");
161165
166 printf(" --bloom-multiplier Adjust the amount of bloom (default: 1.0)\n");
167 printf(" --bloom-intensity Adjust the intensity of the bloom (default: 0.75)\n\n");
168
162169 printf(" --disable-auto-skip Disable auto skipping\n");
163 printf(" --disable-progress Disable the progress bar\n\n");
170 printf(" --disable-progress Disable the progress bar\n");
171 printf(" --disable-bloom Disable bloom effect\n\n");
164172
165173 printf(" --hide-users Hide users\n");
174 printf(" --hide-tree Hide the tree\n");
175 printf(" --hide-files Hide files\n");
166176 printf(" --hide-usernames Hide usernames\n");
167177 printf(" --hide-filenames Hide filenames\n");
168178 printf(" --hide-dirnames Hide directory names\n");
218228 delete clog;
219229 }
220230
231 if(gGourceLogFormat == "hg") {
232 clog = new MercurialLog(logfile);
233 if(clog->checkFormat()) return clog;
234 delete clog;
235 }
236
221237 if(gGourceLogFormat == "cvs") {
222238 clog = new CVSEXPCommitLog(logfile);
223239 if(clog->checkFormat()) return clog;
246262
247263 delete clog;
248264
265 //mercurial
266 debugLog("trying mercurial...\n");
267 clog = new MercurialLog(logfile);
268 if(clog->checkFormat()) return clog;
269
270 delete clog;
271
249272 //git raw
250273 debugLog("trying git raw...\n");
251274 clog = new GitRawCommitLog(logfile);
295318 font.dropShadow(true);
296319 font.roundCoordinates(true);
297320
321 bloomtex = texturemanager.grab("bloom.tga");
322 beamtex = texturemanager.grab("beam.png");
323
298324 start_position = 0.0;
299325 stop_position = 0.0;
300326
327353
328354 root = 0;
329355
330 background_colour = vec3f(0.25, 0.25, 0.25);
356 background_colour = vec3f(0.0, 0.0, 0.0);
331357
332358 //min phsyics rate 60fps (ie maximum allowed delta 1.0/60)
333359 max_tick_rate = 1.0 / 60.0;
890916 void Gource::seekTo(float percent) {
891917 debugLog("seekTo(%.2f)\n", percent);
892918
893 if(!canSeek()) return;
919 if(commitlog == 0 || !commitlog->isSeekable()) return;
894920
895921 // end pause
896922 if(paused) paused = false;
12681294 if(logfile.size() == 0 || logfile == ".") {
12691295 SDL_Quit();
12701296 gource_help("");
1271 } else if(display.dirExists(logfile)) {
1297 } else if(SDLAppDirExists(logfile)) {
12721298 gource_quit("Directory not supported.");
12731299 } else {
12741300 gource_quit("Unsupported log format. You may need to regenerate your log file.");
12821308
12831309 slider.logic(dt);
12841310
1285 if(paused) return;
1311 //still want to update camera while paused
1312 if(paused) {
1313 updateCamera(dt);
1314 return;
1315 }
12861316
12871317 // get more entries
12881318 if(commitqueue.size() == 0) {
13121342 subseconds -= (int) subseconds;
13131343 }
13141344
1315 currtime += seconds;
1345 currtime += seconds;
13161346
13171347 // delete files
13181348 for(std::vector<RFile*>::iterator it = gGourceRemovedFiles.begin(); it != gGourceRemovedFiles.end(); it++) {
14891519 font.print(display.width/2 - width/2, display.height/2 - 10, "%s", loading_message.c_str());
14901520 }
14911521
1492 void Gource::draw(float t, float dt) {
1493
1522 void Gource::drawBackground(float dt) {
14941523 display.setClearColour(background_colour);
14951524 display.clear();
1496
1497 if(draw_loading) {
1498 loadingScreen();
1499 draw_loading = false;
1500 return;
1501 }
1502
1503 Frustum frustum(camera);
1504
1505 trace_time = SDL_GetTicks();
1506
1507 mousetrace(frustum,dt);
1508
1509 trace_time = SDL_GetTicks() - trace_time;
1510
1511 glMatrixMode(GL_PROJECTION);
1512 glLoadIdentity();
1513
1514 camera.focus();
1515
1516 glMatrixMode(GL_MODELVIEW);
1517 glLoadIdentity();
1518
1525 }
1526
1527 void Gource::drawTree(Frustum& frustum, float dt) {
15191528 draw_tree_time = SDL_GetTicks();
15201529
15211530 root->calcEdges();
15301539 glPushMatrix();
15311540 glLoadIdentity();
15321541
1533 glBlendFunc (GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
15341542 glEnable(GL_BLEND);
15351543 glEnable(GL_TEXTURE_2D);
15361544
1537 //draw edges
1538 root->drawEdgeShadows(dt);
1539 root->drawEdges(dt);
1545 glBlendFunc (GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
1546
1547 if(!gGourceHideTree) {
1548 glBindTexture(GL_TEXTURE_2D, beamtex->textureid);
1549
1550 root->drawEdgeShadows(dt);
1551 root->drawEdges(dt);
1552 }
15401553
15411554 //switch back
15421555 glMatrixMode(GL_PROJECTION);
15481561 glEnable(GL_TEXTURE_2D);
15491562 glEnable(GL_BLEND);
15501563
1564 glBlendFunc (GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
1565
15511566 //draw shadows
15521567
15531568 if(!gGourceHideUsers) {
15561571 }
15571572 }
15581573
1559 root->drawShadows(frustum, dt);
1574 if(!gGourceHideFiles) {
1575 root->drawShadows(frustum, dt);
1576 }
1577
1578 drawActions(dt);
1579
1580 glBlendFunc (GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
1581
1582 if(!trace_debug) {
1583 if(!gGourceHideFiles) {
1584 root->drawFiles(frustum,dt);
1585 }
1586 } else {
1587 root->drawSimple(frustum,dt);
1588 }
1589
1590 draw_tree_time = SDL_GetTicks() - draw_tree_time;
1591 }
1592
1593 void Gource::drawActions(float dt) {
1594 if(gGourceHideUsers) return;
1595
1596 glBindTexture(GL_TEXTURE_2D, beamtex->textureid);
1597 glEnable(GL_TEXTURE_2D);
1598 glEnable(GL_BLEND);
1599
1600 glBlendFunc (GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
15601601
15611602 //draw actions
15621603 for(std::map<std::string,RUser*>::iterator it = users.begin(); it!=users.end(); it++) {
15631604 it->second->drawActions(dt);
15641605 }
1606 }
1607
1608 void Gource::drawBloom(Frustum &frustum, float dt) {
1609 if(gGourceDisableBloom) return;
1610
1611 glEnable(GL_TEXTURE_2D);
1612 glEnable(GL_BLEND);
1613
1614 //draw 'gourceian blur' around dirnodes
1615 glBindTexture(GL_TEXTURE_2D, bloomtex->textureid);
1616 glBlendFunc (GL_ONE, GL_ONE);
1617 root->drawBloom(frustum, dt);
15651618
15661619 glBlendFunc (GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
1567
1568 glColor4f(0.0, 1.0, 0.0, 1.0);
1569 trace_debug ? root->drawSimple(frustum,dt) : root->drawFiles(frustum,dt);
1570
1571 draw_tree_time = SDL_GetTicks() - draw_tree_time;
1620 }
1621
1622 void Gource::draw(float t, float dt) {
1623
1624 display.mode2D();
1625
1626 drawBackground(dt);
1627
1628 if(draw_loading) {
1629 loadingScreen();
1630 draw_loading = false;
1631 return;
1632 }
1633
1634 Frustum frustum(camera);
1635
1636 trace_time = SDL_GetTicks();
1637
1638 mousetrace(frustum,dt);
1639
1640 trace_time = SDL_GetTicks() - trace_time;
1641
1642 glMatrixMode(GL_PROJECTION);
1643 glLoadIdentity();
1644
1645 camera.focus();
1646
1647 glMatrixMode(GL_MODELVIEW);
1648 glLoadIdentity();
1649
1650 //draw tree
1651 drawTree(frustum, dt);
15721652
15731653 glColor4f(1.0, 1.0, 0.0, 1.0);
15741654 for(std::map<std::string,RUser*>::iterator it = users.begin(); it!=users.end(); it++) {
15751655 trace_debug ? it->second->drawSimple(dt) : it->second->draw(dt);
15761656 }
15771657
1578
15791658 glEnable(GL_TEXTURE_2D);
15801659 glEnable(GL_BLEND);
15811660
1582 root->drawNames(font,frustum);
1583
1584 if(!gGourceHideUsernames) {
1661 //draw bloom
1662 drawBloom(frustum, dt);
1663
1664 if(!(gGourceHideFiles || gGourceHideFilenames)) {
1665 root->drawNames(font,frustum);
1666 }
1667
1668 if(!(gGourceHideUsernames || gGourceHideUsers)) {
15851669 for(std::map<std::string,RUser*>::iterator it = users.begin(); it!=users.end(); it++) {
15861670 it->second->drawName();
15871671 }
1717 #ifndef GOURCE_H
1818 #define GOURCE_H
1919
20 #define GOURCE_VERSION "0.17"
20 #define GOURCE_VERSION "0.20"
2121
2222 #ifdef _WIN32
2323 #include "windows.h"
3535 #include "core/regex.h"
3636
3737 #include "git.h"
38 #include "hg.h"
3839 #include "gitraw.h"
3940 #include "cvs-exp.h"
4041 #include "custom.h"
9899 std::string displaydate;
99100 int date_x_offset;
100101
102 TextureResource* bloomtex;
103 TextureResource* beamtex;
104
101105 FXFont font, fontlarge, fontmedium;
102106
103107 bool first_read;
108112 int frameskip;
109113 int framecount;
110114
115 time_t currtime;
111116 float runtime;
112 long currtime;
113117 float subseconds;
114118
115119 float splash;
172176 void zoom(bool zoomin);
173177
174178 void loadingScreen();
179 void drawBackground(float dt);
180 void drawActions(float dt);
181 void drawTree(Frustum &frustum, float dt);
182 void drawBloom(Frustum &frustum, float dt);
175183 public:
176184 Gource(std::string logfile);
177185 ~Gource();
200208
201209 extern float gGourceAutoSkipSeconds;
202210 extern bool gGourceHideUsernames;
211 extern bool gGourceDisableBloom;
203212 extern bool gGourceHideDate;
213 extern bool gGourceHideFiles;
214 extern bool gGourceHideTree;
204215 extern bool gGourceDisableProgress;
205216 extern bool gGourceFileLoop;
206217 extern int gGourceMaxFiles;
0 /*
1 Copyright (C) 2009 Andrew Caudwell (acaudwell@gmail.com)
2
3 This program is free software; you can redistribute it and/or
4 modify it under the terms of the GNU General Public License
5 as published by the Free Software Foundation; either version
6 3 of the License, or (at your option) any later version.
7
8 This program is distributed in the hope that it will be useful,
9 but WITHOUT ANY WARRANTY; without even the implied warranty of
10 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 GNU General Public License for more details.
12
13 You should have received a copy of the GNU General Public License
14 along with this program. If not, see <http://www.gnu.org/licenses/>.
15 */
16
17 #include "hg.h"
18
19 Regex hg_regex("^([0-9]+) -?[0-9]+\\|([^|]+)\\|([ADM]?)\\|(.+)$");
20
21 // parse Mercurial log entries (using the gource.style template)
22
23 std::string gGourceMercurialCommand() {
24
25 std::string gource_style_path = gSDLAppResourceDir + std::string("gource.style");
26
27 return std::string("hg log --style ") + gource_style_path;
28 }
29
30 MercurialLog::MercurialLog(std::string logfile) : RCommitLog(logfile) {
31
32 log_command = gGourceMercurialCommand();
33
34 //can generate log from directory
35 if(!logf && is_dir) {
36 logf = generateLog(logfile);
37
38 if(logf) {
39 success = true;
40 seekable = true;
41 }
42 }
43 }
44
45 BaseLog* MercurialLog::generateLog(std::string dir) {
46
47 //does directory have a .git ?
48 std::string hgdir = dir + std::string("/.hg");
49 struct stat dirinfo;
50 int stat_rc = stat(hgdir.c_str(), &dirinfo);
51 if(stat_rc!=0 || !(dirinfo.st_mode & S_IFDIR)) {
52 return 0;
53 }
54
55 std::string command = getLogCommand();
56
57 createTempLog();
58
59 char cmd_buff[2048];
60 sprintf(cmd_buff, "%s %s > %s", command.c_str(), dir.c_str(), temp_file.c_str());
61
62 int command_rc = system(cmd_buff);
63
64 if(command_rc != 0) {
65 return 0;
66 }
67
68 BaseLog* seeklog = new SeekLog(temp_file);
69
70 return seeklog;
71 }
72
73
74 bool MercurialLog::parseCommit(RCommit& commit) {
75
76 std::string line;
77 std::vector<std::string> entries;
78
79 if(!logf->getNextLine(line)) return false;
80
81 //custom line
82 if(!hg_regex.match(line, &entries)) return false;
83
84 commit.timestamp = atol(entries[0].c_str());
85
86 commit.username = entries[1];
87
88 std::string action = "A";
89
90 if(entries[2].size()>0) {
91 action = entries[2];
92 }
93
94 bool has_colour = false;
95 vec3f colour;
96
97 // debugLog("file = %s, timestamp=%d, username=%s, action=%s\n", entries[3].c_str(),
98 // commit.timestamp, commit.username.c_str(), action.c_str());
99
100 if(has_colour) {
101 commit.addFile(entries[3], action, colour);
102 } else {
103 commit.addFile(entries[3], action);
104 }
105
106 //commit.debug();
107
108 return true;
109 }
0 /*
1 Copyright (C) 2009 Andrew Caudwell (acaudwell@gmail.com)
2
3 This program is free software; you can redistribute it and/or
4 modify it under the terms of the GNU General Public License
5 as published by the Free Software Foundation; either version
6 3 of the License, or (at your option) any later version.
7
8 This program is distributed in the hope that it will be useful,
9 but WITHOUT ANY WARRANTY; without even the implied warranty of
10 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 GNU General Public License for more details.
12
13 You should have received a copy of the GNU General Public License
14 along with this program. If not, see <http://www.gnu.org/licenses/>.
15 */
16
17 #ifndef MERCURIALLOG_H
18 #define MERCURIALLOG_H
19
20 #include "commitlog.h"
21
22 std::string gGourceMercurialCommand();
23
24 class MercurialLog : public RCommitLog {
25 protected:
26 bool parseCommit(RCommit& commit);
27 BaseLog* generateLog(std::string dir);
28 public:
29 MercurialLog(std::string logfile);
30 };
31
32 #endif
2222 int height = 768;
2323 bool fullscreen=false;
2424 bool multisample=false;
25 vec3f background = vec3f(0.25, 0.25, 0.25);
25 vec3f background = vec3f(0.1, 0.1, 0.1);
2626
2727 int video_framerate = 60;
2828 std::string ppm_file_name;
3939
4040 std::vector<std::string> arguments;
4141
42 display.displayArgs(argc, argv, &width, &height, &fullscreen, &arguments);
42 SDLAppParseArgs(argc, argv, &width, &height, &fullscreen, &arguments);
4343
4444 for(int i=0;i<arguments.size();i++) {
4545 std::string args = arguments[i];
6565 continue;
6666 }
6767
68 if(args == "--git-log-command" || args == "--cvs-exp-command") {
69
70 if(args == "--git-log-command") {
68 if(args == "--git-log-command") {
7169 gource_info(gGourceGitLogCommand);
72 } else {
70 }
71
72 if(args == "--cvs-exp-command") {
7373 gource_info(gGourceCvsExpLogCommand);
74 }
75 }
74 }
75
76 if(args == "--hg-log-command") {
77 std::string command = gGourceMercurialCommand();
78
79 gource_info(command);
80 }
81
7682
7783 if(args == "--date-format") {
7884
100106 continue;
101107 }
102108
109 if(args == "--disable-bloom") {
110 gGourceDisableBloom = true;
111 continue;
112 }
113
103114 if(args == "--hide-users") {
104115 gGourceHideUsers = true;
116 continue;
117 }
118
119 if(args == "--hide-tree") {
120 gGourceHideTree = true;
121 continue;
122 }
123
124 if(args == "--hide-files") {
125 gGourceHideFiles = true;
105126 continue;
106127 }
107128
193214 continue;
194215 }
195216
217 if(args == "--bloom-intensity") {
218 if((i+1)>=arguments.size()) {
219 gource_help("specify bloom-intensity (float)");
220 }
221
222 gGourceBloomIntensity = atof(arguments[++i].c_str());
223
224 if(gGourceBloomIntensity<=0.0) {
225 gource_help("invalid bloom-intensity value");
226 }
227
228 continue;
229 }
230
231 if(args == "--bloom-multiplier") {
232
233 if((i+1)>=arguments.size()) {
234 gource_help("specify bloom-multiplier (float)");
235 }
236
237 gGourceBloomMultiplier = atof(arguments[++i].c_str());
238
239 if(gGourceBloomMultiplier<=0.0) {
240 gource_help("invalid bloom-multiplier value");
241 }
242
243 continue;
244 }
245
196246 if(args == "-e" || args == "--elasticity") {
197247
198248 if((i+1)>=arguments.size()) {