##// END OF EJS Templates
updated CONTRIBUTORS...
marcink -
r2058:fb51a6fc beta
parent child Browse files
Show More
@@ -1,18 +1,19 b''
1 1 List of contributors to RhodeCode project:
2 2 Marcin Kuźmiński <marcin@python-works.com>
3 3 Lukasz Balcerzak <lukaszbalcerzak@gmail.com>
4 4 Jason Harris <jason@jasonfharris.com>
5 5 Thayne Harbaugh <thayne@fusionio.com>
6 6 cejones
7 7 Thomas Waldmann <tw-public@gmx.de>
8 8 Lorenzo M. Catucci <lorenzo@sancho.ccd.uniroma2.it>
9 9 Dmitri Kuznetsov
10 10 Jared Bunting <jared.bunting@peachjean.com>
11 11 Steve Romanow <slestak989@gmail.com>
12 12 Augosto Hermann <augusto.herrmann@planejamento.gov.br>
13 13 Ankit Solanki <ankit.solanki@gmail.com>
14 14 Liad Shani <liadff@gmail.com>
15 15 Les Peabody <lpeabody@gmail.com>
16 16 Jonas Oberschweiber <jonas.oberschweiber@d-velop.de>
17 17 Matt Zuba <matt.zuba@goodwillaz.org>
18 Aras Pranckevicius <aras@unity3d.com> No newline at end of file
18 Aras Pranckevicius <aras@unity3d.com>
19 Tony Bussieres <t.bussieres@gmail.com>
@@ -1,533 +1,534 b''
1 1 .. _changelog:
2 2
3 3 Changelog
4 4 =========
5 5
6 6
7 7 1.3.2 (**2012-XX-XX**)
8 8 ----------------------
9 9
10 10 :status: in-progress
11 11 :branch: beta
12 12
13 13 news
14 14 ++++
15 15
16 16
17 17 fixes
18 18 +++++
19 19
20 20 - fixed git protocol issues with repos-groups
21 21 - fixed git remote repos validator that prevented from cloning remote git repos
22 22 - fixes #370 ending slashes fixes for repo and groups
23 - fixes #368 improved git-protocol detection to handle other clients
23 24
24 25 1.3.1 (**2012-02-27**)
25 26 ----------------------
26 27
27 28 news
28 29 ++++
29 30
30 31
31 32 fixes
32 33 +++++
33 34
34 35 - redirection loop occurs when remember-me wasn't checked during login
35 36 - fixes issues with git blob history generation
36 37 - don't fetch branch for git in file history dropdown. Causes unneeded slowness
37 38
38 39 1.3.0 (**2012-02-26**)
39 40 ----------------------
40 41
41 42 news
42 43 ++++
43 44
44 45 - code review, inspired by github code-comments
45 46 - #215 rst and markdown README files support
46 47 - #252 Container-based and proxy pass-through authentication support
47 48 - #44 branch browser. Filtering of changelog by branches
48 49 - mercurial bookmarks support
49 50 - new hover top menu, optimized to add maximum size for important views
50 51 - configurable clone url template with possibility to specify protocol like
51 52 ssh:// or http:// and also manually alter other parts of clone_url.
52 53 - enabled largefiles extension by default
53 54 - optimized summary file pages and saved a lot of unused space in them
54 55 - #239 option to manually mark repository as fork
55 56 - #320 mapping of commit authors to RhodeCode users
56 57 - #304 hashes are displayed using monospace font
57 58 - diff configuration, toggle white lines and context lines
58 59 - #307 configurable diffs, whitespace toggle, increasing context lines
59 60 - sorting on branches, tags and bookmarks using YUI datatable
60 61 - improved file filter on files page
61 62 - implements #330 api method for listing nodes ar particular revision
62 63 - #73 added linking issues in commit messages to chosen issue tracker url
63 64 based on user defined regular expression
64 65 - added linking of changesets in commit messages
65 66 - new compact changelog with expandable commit messages
66 67 - firstname and lastname are optional in user creation
67 68 - #348 added post-create repository hook
68 69 - #212 global encoding settings is now configurable from .ini files
69 70 - #227 added repository groups permissions
70 71 - markdown gets codehilite extensions
71 72 - new API methods, delete_repositories, grante/revoke permissions for groups
72 73 and repos
73 74
74 75
75 76 fixes
76 77 +++++
77 78
78 79 - rewrote dbsession management for atomic operations, and better error handling
79 80 - fixed sorting of repo tables
80 81 - #326 escape of special html entities in diffs
81 82 - normalized user_name => username in api attributes
82 83 - fixes #298 ldap created users with mixed case emails created conflicts
83 84 on saving a form
84 85 - fixes issue when owner of a repo couldn't revoke permissions for users
85 86 and groups
86 87 - fixes #271 rare JSON serialization problem with statistics
87 88 - fixes #337 missing validation check for conflicting names of a group with a
88 89 repositories group
89 90 - #340 fixed session problem for mysql and celery tasks
90 91 - fixed #331 RhodeCode mangles repository names if the a repository group
91 92 contains the "full path" to the repositories
92 93 - #355 RhodeCode doesn't store encrypted LDAP passwords
93 94
94 95 1.2.5 (**2012-01-28**)
95 96 ----------------------
96 97
97 98 news
98 99 ++++
99 100
100 101 fixes
101 102 +++++
102 103
103 104 - #340 Celery complains about MySQL server gone away, added session cleanup
104 105 for celery tasks
105 106 - #341 "scanning for repositories in None" log message during Rescan was missing
106 107 a parameter
107 108 - fixed creating archives with subrepos. Some hooks were triggered during that
108 109 operation leading to crash.
109 110 - fixed missing email in account page.
110 111 - Reverted Mercurial to 2.0.1 for windows due to bug in Mercurial that makes
111 112 forking on windows impossible
112 113
113 114 1.2.4 (**2012-01-19**)
114 115 ----------------------
115 116
116 117 news
117 118 ++++
118 119
119 120 - RhodeCode is bundled with mercurial series 2.0.X by default, with
120 121 full support to largefiles extension. Enabled by default in new installations
121 122 - #329 Ability to Add/Remove Groups to/from a Repository via AP
122 123 - added requires.txt file with requirements
123 124
124 125 fixes
125 126 +++++
126 127
127 128 - fixes db session issues with celery when emailing admins
128 129 - #331 RhodeCode mangles repository names if the a repository group
129 130 contains the "full path" to the repositories
130 131 - #298 Conflicting e-mail addresses for LDAP and RhodeCode users
131 132 - DB session cleanup after hg protocol operations, fixes issues with
132 133 `mysql has gone away` errors
133 134 - #333 doc fixes for get_repo api function
134 135 - #271 rare JSON serialization problem with statistics enabled
135 136 - #337 Fixes issues with validation of repository name conflicting with
136 137 a group name. A proper message is now displayed.
137 138 - #292 made ldap_dn in user edit readonly, to get rid of confusion that field
138 139 doesn't work
139 140 - #316 fixes issues with web description in hgrc files
140 141
141 142 1.2.3 (**2011-11-02**)
142 143 ----------------------
143 144
144 145 news
145 146 ++++
146 147
147 148 - added option to manage repos group for non admin users
148 149 - added following API methods for get_users, create_user, get_users_groups,
149 150 get_users_group, create_users_group, add_user_to_users_groups, get_repos,
150 151 get_repo, create_repo, add_user_to_repo
151 152 - implements #237 added password confirmation for my account
152 153 and admin edit user.
153 154 - implements #291 email notification for global events are now sent to all
154 155 administrator users, and global config email.
155 156
156 157 fixes
157 158 +++++
158 159
159 160 - added option for passing auth method for smtp mailer
160 161 - #276 issue with adding a single user with id>10 to usergroups
161 162 - #277 fixes windows LDAP settings in which missing values breaks the ldap auth
162 163 - #288 fixes managing of repos in a group for non admin user
163 164
164 165 1.2.2 (**2011-10-17**)
165 166 ----------------------
166 167
167 168 news
168 169 ++++
169 170
170 171 - #226 repo groups are available by path instead of numerical id
171 172
172 173 fixes
173 174 +++++
174 175
175 176 - #259 Groups with the same name but with different parent group
176 177 - #260 Put repo in group, then move group to another group -> repo becomes unavailable
177 178 - #258 RhodeCode 1.2 assumes egg folder is writable (lockfiles problems)
178 179 - #265 ldap save fails sometimes on converting attributes to booleans,
179 180 added getter and setter into model that will prevent from this on db model level
180 181 - fixed problems with timestamps issues #251 and #213
181 182 - fixes #266 RhodeCode allows to create repo with the same name and in
182 183 the same parent as group
183 184 - fixes #245 Rescan of the repositories on Windows
184 185 - fixes #248 cannot edit repos inside a group on windows
185 186 - fixes #219 forking problems on windows
186 187
187 188 1.2.1 (**2011-10-08**)
188 189 ----------------------
189 190
190 191 news
191 192 ++++
192 193
193 194
194 195 fixes
195 196 +++++
196 197
197 198 - fixed problems with basic auth and push problems
198 199 - gui fixes
199 200 - fixed logger
200 201
201 202 1.2.0 (**2011-10-07**)
202 203 ----------------------
203 204
204 205 news
205 206 ++++
206 207
207 208 - implemented #47 repository groups
208 209 - implemented #89 Can setup google analytics code from settings menu
209 210 - implemented #91 added nicer looking archive urls with more download options
210 211 like tags, branches
211 212 - implemented #44 into file browsing, and added follow branch option
212 213 - implemented #84 downloads can be enabled/disabled for each repository
213 214 - anonymous repository can be cloned without having to pass default:default
214 215 into clone url
215 216 - fixed #90 whoosh indexer can index chooses repositories passed in command
216 217 line
217 218 - extended journal with day aggregates and paging
218 219 - implemented #107 source code lines highlight ranges
219 220 - implemented #93 customizable changelog on combined revision ranges -
220 221 equivalent of githubs compare view
221 222 - implemented #108 extended and more powerful LDAP configuration
222 223 - implemented #56 users groups
223 224 - major code rewrites optimized codes for speed and memory usage
224 225 - raw and diff downloads are now in git format
225 226 - setup command checks for write access to given path
226 227 - fixed many issues with international characters and unicode. It uses utf8
227 228 decode with replace to provide less errors even with non utf8 encoded strings
228 229 - #125 added API KEY access to feeds
229 230 - #109 Repository can be created from external Mercurial link (aka. remote
230 231 repository, and manually updated (via pull) from admin panel
231 232 - beta git support - push/pull server + basic view for git repos
232 233 - added followers page and forks page
233 234 - server side file creation (with binary file upload interface)
234 235 and edition with commits powered by codemirror
235 236 - #111 file browser file finder, quick lookup files on whole file tree
236 237 - added quick login sliding menu into main page
237 238 - changelog uses lazy loading of affected files details, in some scenarios
238 239 this can improve speed of changelog page dramatically especially for
239 240 larger repositories.
240 241 - implements #214 added support for downloading subrepos in download menu.
241 242 - Added basic API for direct operations on rhodecode via JSON
242 243 - Implemented advanced hook management
243 244
244 245 fixes
245 246 +++++
246 247
247 248 - fixed file browser bug, when switching into given form revision the url was
248 249 not changing
249 250 - fixed propagation to error controller on simplehg and simplegit middlewares
250 251 - fixed error when trying to make a download on empty repository
251 252 - fixed problem with '[' chars in commit messages in journal
252 253 - fixed #99 Unicode errors, on file node paths with non utf-8 characters
253 254 - journal fork fixes
254 255 - removed issue with space inside renamed repository after deletion
255 256 - fixed strange issue on formencode imports
256 257 - fixed #126 Deleting repository on Windows, rename used incompatible chars.
257 258 - #150 fixes for errors on repositories mapped in db but corrupted in
258 259 filesystem
259 260 - fixed problem with ascendant characters in realm #181
260 261 - fixed problem with sqlite file based database connection pool
261 262 - whoosh indexer and code stats share the same dynamic extensions map
262 263 - fixes #188 - relationship delete of repo_to_perm entry on user removal
263 264 - fixes issue #189 Trending source files shows "show more" when no more exist
264 265 - fixes issue #197 Relative paths for pidlocks
265 266 - fixes issue #198 password will require only 3 chars now for login form
266 267 - fixes issue #199 wrong redirection for non admin users after creating a repository
267 268 - fixes issues #202, bad db constraint made impossible to attach same group
268 269 more than one time. Affects only mysql/postgres
269 270 - fixes #218 os.kill patch for windows was missing sig param
270 271 - improved rendering of dag (they are not trimmed anymore when number of
271 272 heads exceeds 5)
272 273
273 274 1.1.8 (**2011-04-12**)
274 275 ----------------------
275 276
276 277 news
277 278 ++++
278 279
279 280 - improved windows support
280 281
281 282 fixes
282 283 +++++
283 284
284 285 - fixed #140 freeze of python dateutil library, since new version is python2.x
285 286 incompatible
286 287 - setup-app will check for write permission in given path
287 288 - cleaned up license info issue #149
288 289 - fixes for issues #137,#116 and problems with unicode and accented characters.
289 290 - fixes crashes on gravatar, when passed in email as unicode
290 291 - fixed tooltip flickering problems
291 292 - fixed came_from redirection on windows
292 293 - fixed logging modules, and sql formatters
293 294 - windows fixes for os.kill issue #133
294 295 - fixes path splitting for windows issues #148
295 296 - fixed issue #143 wrong import on migration to 1.1.X
296 297 - fixed problems with displaying binary files, thanks to Thomas Waldmann
297 298 - removed name from archive files since it's breaking ui for long repo names
298 299 - fixed issue with archive headers sent to browser, thanks to Thomas Waldmann
299 300 - fixed compatibility for 1024px displays, and larger dpi settings, thanks to
300 301 Thomas Waldmann
301 302 - fixed issue #166 summary pager was skipping 10 revisions on second page
302 303
303 304
304 305 1.1.7 (**2011-03-23**)
305 306 ----------------------
306 307
307 308 news
308 309 ++++
309 310
310 311 fixes
311 312 +++++
312 313
313 314 - fixed (again) #136 installation support for FreeBSD
314 315
315 316
316 317 1.1.6 (**2011-03-21**)
317 318 ----------------------
318 319
319 320 news
320 321 ++++
321 322
322 323 fixes
323 324 +++++
324 325
325 326 - fixed #136 installation support for FreeBSD
326 327 - RhodeCode will check for python version during installation
327 328
328 329 1.1.5 (**2011-03-17**)
329 330 ----------------------
330 331
331 332 news
332 333 ++++
333 334
334 335 - basic windows support, by exchanging pybcrypt into sha256 for windows only
335 336 highly inspired by idea of mantis406
336 337
337 338 fixes
338 339 +++++
339 340
340 341 - fixed sorting by author in main page
341 342 - fixed crashes with diffs on binary files
342 343 - fixed #131 problem with boolean values for LDAP
343 344 - fixed #122 mysql problems thanks to striker69
344 345 - fixed problem with errors on calling raw/raw_files/annotate functions
345 346 with unknown revisions
346 347 - fixed returned rawfiles attachment names with international character
347 348 - cleaned out docs, big thanks to Jason Harris
348 349
349 350 1.1.4 (**2011-02-19**)
350 351 ----------------------
351 352
352 353 news
353 354 ++++
354 355
355 356 fixes
356 357 +++++
357 358
358 359 - fixed formencode import problem on settings page, that caused server crash
359 360 when that page was accessed as first after server start
360 361 - journal fixes
361 362 - fixed option to access repository just by entering http://server/<repo_name>
362 363
363 364 1.1.3 (**2011-02-16**)
364 365 ----------------------
365 366
366 367 news
367 368 ++++
368 369
369 370 - implemented #102 allowing the '.' character in username
370 371 - added option to access repository just by entering http://server/<repo_name>
371 372 - celery task ignores result for better performance
372 373
373 374 fixes
374 375 +++++
375 376
376 377 - fixed ehlo command and non auth mail servers on smtp_lib. Thanks to
377 378 apollo13 and Johan Walles
378 379 - small fixes in journal
379 380 - fixed problems with getting setting for celery from .ini files
380 381 - registration, password reset and login boxes share the same title as main
381 382 application now
382 383 - fixed #113: to high permissions to fork repository
383 384 - fixed problem with '[' chars in commit messages in journal
384 385 - removed issue with space inside renamed repository after deletion
385 386 - db transaction fixes when filesystem repository creation failed
386 387 - fixed #106 relation issues on databases different than sqlite
387 388 - fixed static files paths links to use of url() method
388 389
389 390 1.1.2 (**2011-01-12**)
390 391 ----------------------
391 392
392 393 news
393 394 ++++
394 395
395 396
396 397 fixes
397 398 +++++
398 399
399 400 - fixes #98 protection against float division of percentage stats
400 401 - fixed graph bug
401 402 - forced webhelpers version since it was making troubles during installation
402 403
403 404 1.1.1 (**2011-01-06**)
404 405 ----------------------
405 406
406 407 news
407 408 ++++
408 409
409 410 - added force https option into ini files for easier https usage (no need to
410 411 set server headers with this options)
411 412 - small css updates
412 413
413 414 fixes
414 415 +++++
415 416
416 417 - fixed #96 redirect loop on files view on repositories without changesets
417 418 - fixed #97 unicode string passed into server header in special cases (mod_wsgi)
418 419 and server crashed with errors
419 420 - fixed large tooltips problems on main page
420 421 - fixed #92 whoosh indexer is more error proof
421 422
422 423 1.1.0 (**2010-12-18**)
423 424 ----------------------
424 425
425 426 news
426 427 ++++
427 428
428 429 - rewrite of internals for vcs >=0.1.10
429 430 - uses mercurial 1.7 with dotencode disabled for maintaining compatibility
430 431 with older clients
431 432 - anonymous access, authentication via ldap
432 433 - performance upgrade for cached repos list - each repository has its own
433 434 cache that's invalidated when needed.
434 435 - performance upgrades on repositories with large amount of commits (20K+)
435 436 - main page quick filter for filtering repositories
436 437 - user dashboards with ability to follow chosen repositories actions
437 438 - sends email to admin on new user registration
438 439 - added cache/statistics reset options into repository settings
439 440 - more detailed action logger (based on hooks) with pushed changesets lists
440 441 and options to disable those hooks from admin panel
441 442 - introduced new enhanced changelog for merges that shows more accurate results
442 443 - new improved and faster code stats (based on pygments lexers mapping tables,
443 444 showing up to 10 trending sources for each repository. Additionally stats
444 445 can be disabled in repository settings.
445 446 - gui optimizations, fixed application width to 1024px
446 447 - added cut off (for large files/changesets) limit into config files
447 448 - whoosh, celeryd, upgrade moved to paster command
448 449 - other than sqlite database backends can be used
449 450
450 451 fixes
451 452 +++++
452 453
453 454 - fixes #61 forked repo was showing only after cache expired
454 455 - fixes #76 no confirmation on user deletes
455 456 - fixes #66 Name field misspelled
456 457 - fixes #72 block user removal when he owns repositories
457 458 - fixes #69 added password confirmation fields
458 459 - fixes #87 RhodeCode crashes occasionally on updating repository owner
459 460 - fixes #82 broken annotations on files with more than 1 blank line at the end
460 461 - a lot of fixes and tweaks for file browser
461 462 - fixed detached session issues
462 463 - fixed when user had no repos he would see all repos listed in my account
463 464 - fixed ui() instance bug when global hgrc settings was loaded for server
464 465 instance and all hgrc options were merged with our db ui() object
465 466 - numerous small bugfixes
466 467
467 468 (special thanks for TkSoh for detailed feedback)
468 469
469 470
470 471 1.0.2 (**2010-11-12**)
471 472 ----------------------
472 473
473 474 news
474 475 ++++
475 476
476 477 - tested under python2.7
477 478 - bumped sqlalchemy and celery versions
478 479
479 480 fixes
480 481 +++++
481 482
482 483 - fixed #59 missing graph.js
483 484 - fixed repo_size crash when repository had broken symlinks
484 485 - fixed python2.5 crashes.
485 486
486 487
487 488 1.0.1 (**2010-11-10**)
488 489 ----------------------
489 490
490 491 news
491 492 ++++
492 493
493 494 - small css updated
494 495
495 496 fixes
496 497 +++++
497 498
498 499 - fixed #53 python2.5 incompatible enumerate calls
499 500 - fixed #52 disable mercurial extension for web
500 501 - fixed #51 deleting repositories don't delete it's dependent objects
501 502
502 503
503 504 1.0.0 (**2010-11-02**)
504 505 ----------------------
505 506
506 507 - security bugfix simplehg wasn't checking for permissions on commands
507 508 other than pull or push.
508 509 - fixed doubled messages after push or pull in admin journal
509 510 - templating and css corrections, fixed repo switcher on chrome, updated titles
510 511 - admin menu accessible from options menu on repository view
511 512 - permissions cached queries
512 513
513 514 1.0.0rc4 (**2010-10-12**)
514 515 --------------------------
515 516
516 517 - fixed python2.5 missing simplejson imports (thanks to Jens Bäckman)
517 518 - removed cache_manager settings from sqlalchemy meta
518 519 - added sqlalchemy cache settings to ini files
519 520 - validated password length and added second try of failure on paster setup-app
520 521 - fixed setup database destroy prompt even when there was no db
521 522
522 523
523 524 1.0.0rc3 (**2010-10-11**)
524 525 -------------------------
525 526
526 527 - fixed i18n during installation.
527 528
528 529 1.0.0rc2 (**2010-10-11**)
529 530 -------------------------
530 531
531 532 - Disabled dirsize in file browser, it's causing nasty bug when dir renames
532 533 occure. After vcs is fixed it'll be put back again.
533 534 - templating/css rewrites, optimized css. No newline at end of file
@@ -1,247 +1,251 b''
1 1 # -*- coding: utf-8 -*-
2 2 """
3 3 rhodecode.lib.middleware.simplegit
4 4 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
5 5
6 6 SimpleGit middleware for handling git protocol request (push/clone etc.)
7 7 It's implemented with basic auth function
8 8
9 9 :created_on: Apr 28, 2010
10 10 :author: marcink
11 11 :copyright: (C) 2010-2012 Marcin Kuzminski <marcin@python-works.com>
12 12 :license: GPLv3, see COPYING for more details.
13 13 """
14 14 # This program is free software: you can redistribute it and/or modify
15 15 # it under the terms of the GNU General Public License as published by
16 16 # the Free Software Foundation, either version 3 of the License, or
17 17 # (at your option) any later version.
18 18 #
19 19 # This program is distributed in the hope that it will be useful,
20 20 # but WITHOUT ANY WARRANTY; without even the implied warranty of
21 21 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
22 22 # GNU General Public License for more details.
23 23 #
24 24 # You should have received a copy of the GNU General Public License
25 25 # along with this program. If not, see <http://www.gnu.org/licenses/>.
26 26
27 27 import os
28 28 import re
29 29 import logging
30 30 import traceback
31 31
32 32 from dulwich import server as dulserver
33 33
34 34
35 35 class SimpleGitUploadPackHandler(dulserver.UploadPackHandler):
36 36
37 37 def handle(self):
38 38 write = lambda x: self.proto.write_sideband(1, x)
39 39
40 40 graph_walker = dulserver.ProtocolGraphWalker(self,
41 41 self.repo.object_store,
42 42 self.repo.get_peeled)
43 43 objects_iter = self.repo.fetch_objects(
44 44 graph_walker.determine_wants, graph_walker, self.progress,
45 45 get_tagged=self.get_tagged)
46 46
47 47 # Do they want any objects?
48 48 if objects_iter is None or len(objects_iter) == 0:
49 49 return
50 50
51 51 self.progress("counting objects: %d, done.\n" % len(objects_iter))
52 52 dulserver.write_pack_objects(dulserver.ProtocolFile(None, write),
53 53 objects_iter, len(objects_iter))
54 54 messages = []
55 55 messages.append('thank you for using rhodecode')
56 56
57 57 for msg in messages:
58 58 self.progress(msg + "\n")
59 59 # we are done
60 60 self.proto.write("0000")
61 61
62 62 dulserver.DEFAULT_HANDLERS = {
63 63 'git-upload-pack': SimpleGitUploadPackHandler,
64 64 'git-receive-pack': dulserver.ReceivePackHandler,
65 65 }
66 66
67 67 from dulwich.repo import Repo
68 68 from dulwich.web import HTTPGitApplication
69 69
70 70 from paste.httpheaders import REMOTE_USER, AUTH_TYPE
71 71
72 72 from rhodecode.lib import safe_str
73 73 from rhodecode.lib.base import BaseVCSController
74 74 from rhodecode.lib.auth import get_container_username
75 75 from rhodecode.lib.utils import is_valid_repo
76 76 from rhodecode.model.db import User
77 77
78 78 from webob.exc import HTTPNotFound, HTTPForbidden, HTTPInternalServerError
79 79
80 80 log = logging.getLogger(__name__)
81 81
82 82
83 83 GIT_PROTO_PAT = re.compile(r'git-upload-pack|git-receive-pack|info\/refs')
84 84
85
85 86 def is_git(action):
86 87 return action in ['pull','push']
87 88
89
88 90 class SimpleGit(BaseVCSController):
89 91
90 92 def _handle_request(self, environ, start_response):
91 93 #======================================================================
92 94 # GET ACTION PULL or PUSH
93 95 #======================================================================
94 96 action = self.__get_action(environ)
95 97
96 98 if not is_git(action):
97 99 return self.application(environ, start_response)
98 100
99 101 proxy_key = 'HTTP_X_REAL_IP'
100 102 def_key = 'REMOTE_ADDR'
101 103 ipaddr = environ.get(proxy_key, environ.get(def_key, '0.0.0.0'))
102 104 username = None
103 105 # skip passing error to error controller
104 106 environ['pylons.status_code_redirect'] = True
105 107
106 108 #======================================================================
107 109 # EXTRACT REPOSITORY NAME FROM ENV
108 110 #======================================================================
109 111 try:
110 112 repo_name = self.__get_repository(environ)
111 113 log.debug('Extracted repo name is %s' % repo_name)
112 114 except:
113 115 return HTTPInternalServerError()(environ, start_response)
114 116
115 117
116 118 #======================================================================
117 119 # CHECK ANONYMOUS PERMISSION
118 120 #======================================================================
119 121 if action in ['pull', 'push']:
120 122 anonymous_user = self.__get_user('default')
121 123 username = anonymous_user.username
122 124 anonymous_perm = self._check_permission(action, anonymous_user,
123 125 repo_name)
124 126
125 127 if anonymous_perm is not True or anonymous_user.active is False:
126 128 if anonymous_perm is not True:
127 129 log.debug('Not enough credentials to access this '
128 130 'repository as anonymous user')
129 131 if anonymous_user.active is False:
130 132 log.debug('Anonymous access is disabled, running '
131 133 'authentication')
132 134 #==============================================================
133 135 # DEFAULT PERM FAILED OR ANONYMOUS ACCESS IS DISABLED SO WE
134 136 # NEED TO AUTHENTICATE AND ASK FOR AUTH USER PERMISSIONS
135 137 #==============================================================
136 138
137 139 # Attempting to retrieve username from the container
138 140 username = get_container_username(environ, self.config)
139 141
140 142 # If not authenticated by the container, running basic auth
141 143 if not username:
142 144 self.authenticate.realm = \
143 145 safe_str(self.config['rhodecode_realm'])
144 146 result = self.authenticate(environ)
145 147 if isinstance(result, str):
146 148 AUTH_TYPE.update(environ, 'basic')
147 149 REMOTE_USER.update(environ, result)
148 150 username = result
149 151 else:
150 152 return result.wsgi_application(environ, start_response)
151 153
152 154 #==============================================================
153 155 # CHECK PERMISSIONS FOR THIS REQUEST USING GIVEN USERNAME
154 156 #==============================================================
155 157 if action in ['pull', 'push']:
156 158 try:
157 159 user = self.__get_user(username)
158 160 if user is None or not user.active:
159 161 return HTTPForbidden()(environ, start_response)
160 162 username = user.username
161 163 except:
162 164 log.error(traceback.format_exc())
163 165 return HTTPInternalServerError()(environ,
164 166 start_response)
165 167
166 168 #check permissions for this repository
167 169 perm = self._check_permission(action, user,
168 170 repo_name)
169 171 if perm is not True:
170 172 return HTTPForbidden()(environ, start_response)
171 173
172 174 #===================================================================
173 175 # GIT REQUEST HANDLING
174 176 #===================================================================
175 177
176 178 repo_path = safe_str(os.path.join(self.basepath, repo_name))
177 179 log.debug('Repository path is %s' % repo_path)
178 180
179 181 # quick check if that dir exists...
180 182 if is_valid_repo(repo_name, self.basepath) is False:
181 183 return HTTPNotFound()(environ, start_response)
182 184
183 185 try:
184 186 #invalidate cache on push
185 187 if action == 'push':
186 188 self._invalidate_cache(repo_name)
187 189 log.info('%s action on GIT repo "%s"' % (action, repo_name))
188 190 app = self.__make_app(repo_name, repo_path)
189 191 return app(environ, start_response)
190 192 except Exception:
191 193 log.error(traceback.format_exc())
192 194 return HTTPInternalServerError()(environ, start_response)
193 195
194 196 def __make_app(self, repo_name, repo_path):
195 197 """
196 198 Make an wsgi application using dulserver
197 199
198 200 :param repo_name: name of the repository
199 201 :param repo_path: full path to the repository
200 202 """
201 203
202 204 _d = {'/' + repo_name: Repo(repo_path)}
203 205 backend = dulserver.DictBackend(_d)
204 206 gitserve = HTTPGitApplication(backend)
205 207
206 208 return gitserve
207 209
208 210 def __get_repository(self, environ):
209 211 """
210 212 Get's repository name out of PATH_INFO header
211 213
212 214 :param environ: environ where PATH_INFO is stored
213 215 """
214 216 try:
215 217 environ['PATH_INFO'] = self._get_by_id(environ['PATH_INFO'])
216 218 repo_name = '/'.join(environ['PATH_INFO'].split('/')[1:])
217 219 repo_name = GIT_PROTO_PAT.split(repo_name)
218 220 if repo_name:
219 221 repo_name = repo_name[0]
220 222
221 223 if repo_name.endswith('/'):
222 224 repo_name = repo_name.rstrip('/')
223 225 except:
224 226 log.error(traceback.format_exc())
225 227 raise
226 228
227 229 return repo_name
228 230
229 231 def __get_user(self, username):
230 232 return User.get_by_username(username)
231 233
232 234 def __get_action(self, environ):
233 """Maps git request commands into a pull or push command.
235 """
236 Maps git request commands into a pull or push command.
234 237
235 238 :param environ:
236 239 """
237 240 service = environ['QUERY_STRING'].split('=')
238 241 if len(service) > 1:
239 242 service_cmd = service[1]
240 mapping = {'git-receive-pack': 'push',
243 mapping = {
244 'git-receive-pack': 'push',
241 245 'git-upload-pack': 'pull',
242 246 }
243 247
244 248 return mapping.get(service_cmd,
245 249 service_cmd if service_cmd else 'other')
246 250 else:
247 251 return 'other'
General Comments 0
You need to be logged in to leave comments. Login now