Show More
@@ -195,6 +195,8 b' class SummaryController(BaseRepoControll' | |||||
195 | try: |
|
195 | try: | |
196 | # get's the landing revision! or tip if fails |
|
196 | # get's the landing revision! or tip if fails | |
197 | cs = db_repo.get_landing_changeset() |
|
197 | cs = db_repo.get_landing_changeset() | |
|
198 | if isinstance(cs, EmptyChangeset): | |||
|
199 | raise EmptyRepositoryError() | |||
198 | renderer = MarkupRenderer() |
|
200 | renderer = MarkupRenderer() | |
199 | for f in README_FILES: |
|
201 | for f in README_FILES: | |
200 | try: |
|
202 | try: |
@@ -407,6 +407,15 b' except ImportError:' | |||||
407 |
|
407 | |||
408 |
|
408 | |||
409 | #============================================================================== |
|
409 | #============================================================================== | |
|
410 | # bytes | |||
|
411 | #============================================================================== | |||
|
412 | if __py_version__ >= (2, 6): | |||
|
413 | _bytes = bytes | |||
|
414 | else: | |||
|
415 | # in py2.6 bytes is a synonim for str | |||
|
416 | _bytes = str | |||
|
417 | ||||
|
418 | #============================================================================== | |||
410 | # deque |
|
419 | # deque | |
411 | #============================================================================== |
|
420 | #============================================================================== | |
412 |
|
421 | |||
@@ -416,11 +425,11 b' else:' | |||||
416 | #need to implement our own deque with maxlen |
|
425 | #need to implement our own deque with maxlen | |
417 | class deque(object): |
|
426 | class deque(object): | |
418 |
|
427 | |||
419 | def __init__(self, iterable=(), maxlen=-1): |
|
428 | def __init__(self, iterable=(), maxlen= -1): | |
420 | if not hasattr(self, 'data'): |
|
429 | if not hasattr(self, 'data'): | |
421 | self.left = self.right = 0 |
|
430 | self.left = self.right = 0 | |
422 | self.data = {} |
|
431 | self.data = {} | |
423 | self.maxlen = maxlen |
|
432 | self.maxlen = maxlen or -1 | |
424 | self.extend(iterable) |
|
433 | self.extend(iterable) | |
425 |
|
434 | |||
426 | def append(self, x): |
|
435 | def append(self, x): | |
@@ -537,9 +546,9 b' else:' | |||||
537 | #============================================================================== |
|
546 | #============================================================================== | |
538 |
|
547 | |||
539 | if __py_version__ >= (2, 6): |
|
548 | if __py_version__ >= (2, 6): | |
540 | from threading import Event |
|
549 | from threading import Event, Thread | |
541 | else: |
|
550 | else: | |
542 | from threading import _Verbose, Condition, Lock |
|
551 | from threading import _Verbose, Condition, Lock, Thread | |
543 |
|
552 | |||
544 | def Event(*args, **kwargs): |
|
553 | def Event(*args, **kwargs): | |
545 | return _Event(*args, **kwargs) |
|
554 | return _Event(*args, **kwargs) |
@@ -24,11 +24,10 b' If not, see <http://www.gnu.org/licenses' | |||||
24 | ''' |
|
24 | ''' | |
25 | import os |
|
25 | import os | |
26 | import subprocess |
|
26 | import subprocess | |
27 | import threading |
|
27 | from rhodecode.lib.compat import deque, Event, Thread, _bytes | |
28 | from rhodecode.lib.compat import deque, Event |
|
|||
29 |
|
28 | |||
30 |
|
29 | |||
31 |
class StreamFeeder( |
|
30 | class StreamFeeder(Thread): | |
32 | """ |
|
31 | """ | |
33 | Normal writing into pipe-like is blocking once the buffer is filled. |
|
32 | Normal writing into pipe-like is blocking once the buffer is filled. | |
34 | This thread allows a thread to seep data from a file-like into a pipe |
|
33 | This thread allows a thread to seep data from a file-like into a pipe | |
@@ -39,9 +38,9 b' class StreamFeeder(threading.Thread):' | |||||
39 | super(StreamFeeder, self).__init__() |
|
38 | super(StreamFeeder, self).__init__() | |
40 | self.daemon = True |
|
39 | self.daemon = True | |
41 | filelike = False |
|
40 | filelike = False | |
42 | self.bytes = bytes() |
|
41 | self.bytes = _bytes() | |
43 | if type(source) in (type(''), bytes, bytearray): # string-like |
|
42 | if type(source) in (type(''), _bytes, bytearray): # string-like | |
44 | self.bytes = bytes(source) |
|
43 | self.bytes = _bytes(source) | |
45 | else: # can be either file pointer or file-like |
|
44 | else: # can be either file pointer or file-like | |
46 | if type(source) in (int, long): # file pointer it is |
|
45 | if type(source) in (int, long): # file pointer it is | |
47 | ## converting file descriptor (int) stdin into file-like |
|
46 | ## converting file descriptor (int) stdin into file-like | |
@@ -77,7 +76,7 b' class StreamFeeder(threading.Thread):' | |||||
77 | return self.readiface |
|
76 | return self.readiface | |
78 |
|
77 | |||
79 |
|
78 | |||
80 |
class InputStreamChunker( |
|
79 | class InputStreamChunker(Thread): | |
81 | def __init__(self, source, target, buffer_size, chunk_size): |
|
80 | def __init__(self, source, target, buffer_size, chunk_size): | |
82 |
|
81 | |||
83 | super(InputStreamChunker, self).__init__() |
|
82 | super(InputStreamChunker, self).__init__() | |
@@ -121,6 +120,7 b' class InputStreamChunker(threading.Threa' | |||||
121 | da = self.data_added |
|
120 | da = self.data_added | |
122 | go = self.go |
|
121 | go = self.go | |
123 | b = s.read(cs) |
|
122 | b = s.read(cs) | |
|
123 | ||||
124 | while b and go.is_set(): |
|
124 | while b and go.is_set(): | |
125 | if len(t) > ccm: |
|
125 | if len(t) > ccm: | |
126 | kr.clear() |
|
126 | kr.clear() | |
@@ -180,7 +180,7 b' class BufferedGenerator():' | |||||
180 | self.worker.data_added.wait(0.2) |
|
180 | self.worker.data_added.wait(0.2) | |
181 | if len(self.data): |
|
181 | if len(self.data): | |
182 | self.worker.keep_reading.set() |
|
182 | self.worker.keep_reading.set() | |
183 | return bytes(self.data.popleft()) |
|
183 | return _bytes(self.data.popleft()) | |
184 | elif self.worker.EOF.is_set(): |
|
184 | elif self.worker.EOF.is_set(): | |
185 | raise StopIteration |
|
185 | raise StopIteration | |
186 |
|
186 |
@@ -91,7 +91,7 b' def repo_name_slug(value):' | |||||
91 | slug = remove_formatting(value) |
|
91 | slug = remove_formatting(value) | |
92 | slug = strip_tags(slug) |
|
92 | slug = strip_tags(slug) | |
93 |
|
93 | |||
94 | for c in """=[]\;'"<>,/~!@#$%^&*()+{}|: """: |
|
94 | for c in """`?=[]\;'"<>,/~!@#$%^&*()+{}|: """: | |
95 | slug = slug.replace(c, '-') |
|
95 | slug = slug.replace(c, '-') | |
96 | slug = recursive_replace(slug, '-') |
|
96 | slug = recursive_replace(slug, '-') | |
97 | slug = collapse(slug, '-') |
|
97 | slug = collapse(slug, '-') |
@@ -1534,7 +1534,7 b' class ChangesetComment(Base, BaseModel):' | |||||
1534 | hl_lines = Column('hl_lines', Unicode(512), nullable=True) |
|
1534 | hl_lines = Column('hl_lines', Unicode(512), nullable=True) | |
1535 | f_path = Column('f_path', Unicode(1000), nullable=True) |
|
1535 | f_path = Column('f_path', Unicode(1000), nullable=True) | |
1536 | user_id = Column('user_id', Integer(), ForeignKey('users.user_id'), nullable=False) |
|
1536 | user_id = Column('user_id', Integer(), ForeignKey('users.user_id'), nullable=False) | |
1537 | text = Column('text', Unicode(25000), nullable=False) |
|
1537 | text = Column('text', UnicodeText(25000), nullable=False) | |
1538 | created_on = Column('created_on', DateTime(timezone=False), nullable=False, default=datetime.datetime.now) |
|
1538 | created_on = Column('created_on', DateTime(timezone=False), nullable=False, default=datetime.datetime.now) | |
1539 | modified_at = Column('modified_at', DateTime(timezone=False), nullable=False, default=datetime.datetime.now) |
|
1539 | modified_at = Column('modified_at', DateTime(timezone=False), nullable=False, default=datetime.datetime.now) | |
1540 |
|
1540 |
@@ -372,18 +372,18 b' var q_filter = function(target,nodes,dis' | |||||
372 | } |
|
372 | } | |
373 | }; |
|
373 | }; | |
374 |
|
374 | |||
375 | var tableTr = function(cls,body){ |
|
375 | var tableTr = function(cls, body){ | |
376 |
var |
|
376 | var _el = document.createElement('div'); | |
377 | YUD.addClass(tr, cls); |
|
|||
378 |
|
||||
379 |
|
||||
380 | var cont = new YAHOO.util.Element(body); |
|
377 | var cont = new YAHOO.util.Element(body); | |
381 | var comment_id = fromHTML(body).children[0].id.split('comment-')[1]; |
|
378 | var comment_id = fromHTML(body).children[0].id.split('comment-')[1]; | |
382 |
|
|
379 | var id = 'comment-tr-{0}'.format(comment_id); | |
383 | tr.innerHTML = '<td class="lineno-inline new-inline"></td>'+ |
|
380 | var _html = ('<table><tbody><tr id="{0}" class="{1}">'+ | |
384 |
|
|
381 | '<td class="lineno-inline new-inline"></td>'+ | |
385 | '<td>{0}</td>'.format(body); |
|
382 | '<td class="lineno-inline old-inline"></td>'+ | |
386 | return tr; |
|
383 | '<td>{2}</td>'+ | |
|
384 | '</tr></tbody></table>').format(id, cls, body); | |||
|
385 | _el.innerHTML = _html; | |||
|
386 | return _el.children[0].children[0].children[0]; | |||
387 | }; |
|
387 | }; | |
388 |
|
388 | |||
389 | /** comments **/ |
|
389 | /** comments **/ | |
@@ -395,7 +395,7 b' var createInlineForm = function(parent_t' | |||||
395 | var tmpl = YUD.get('comment-inline-form-template').innerHTML; |
|
395 | var tmpl = YUD.get('comment-inline-form-template').innerHTML; | |
396 | tmpl = tmpl.format(f_path, line); |
|
396 | tmpl = tmpl.format(f_path, line); | |
397 | var form = tableTr('comment-form-inline',tmpl) |
|
397 | var form = tableTr('comment-form-inline',tmpl) | |
398 |
|
398 | |||
399 | // create event for hide button |
|
399 | // create event for hide button | |
400 | form = new YAHOO.util.Element(form); |
|
400 | form = new YAHOO.util.Element(form); | |
401 | var form_hide_button = new YAHOO.util.Element(YUD.getElementsByClassName('hide-inline-form',null,form)[0]); |
|
401 | var form_hide_button = new YAHOO.util.Element(YUD.getElementsByClassName('hide-inline-form',null,form)[0]); | |
@@ -444,13 +444,11 b' var injectInlineForm = function(tr){' | |||||
444 | } |
|
444 | } | |
445 | } |
|
445 | } | |
446 | YUD.insertAfter(form,parent); |
|
446 | YUD.insertAfter(form,parent); | |
447 |
|
||||
448 | var f = YUD.get(form); |
|
447 | var f = YUD.get(form); | |
449 |
|
||||
450 | var overlay = YUD.getElementsByClassName('overlay',null,f)[0]; |
|
448 | var overlay = YUD.getElementsByClassName('overlay',null,f)[0]; | |
451 | var _form = YUD.getElementsByClassName('inline-form',null,f)[0]; |
|
449 | var _form = YUD.getElementsByClassName('inline-form',null,f)[0]; | |
452 |
|
450 | |||
453 |
|
|
451 | YUE.on(YUD.get(_form), 'submit',function(e){ | |
454 | YUE.preventDefault(e); |
|
452 | YUE.preventDefault(e); | |
455 |
|
453 | |||
456 | //ajax submit |
|
454 | //ajax submit |
@@ -42,7 +42,7 b'' | |||||
42 | </div> |
|
42 | </div> | |
43 | </td> |
|
43 | </td> | |
44 | %if c.visual.stylify_metatags: |
|
44 | %if c.visual.stylify_metatags: | |
45 | <td>${h.desc_stylize(gr.group_description)}</td> |
|
45 | <td>${h.urlify_text(h.desc_stylize(gr.group_description))}</td> | |
46 | %else: |
|
46 | %else: | |
47 | <td>${gr.group_description}</td> |
|
47 | <td>${gr.group_description}</td> | |
48 | %endif |
|
48 | %endif |
@@ -22,7 +22,7 b'' | |||||
22 | # |
|
22 | # | |
23 | # You should have received a copy of the GNU General Public License |
|
23 | # You should have received a copy of the GNU General Public License | |
24 | # along with this program. If not, see <http://www.gnu.org/licenses/>. |
|
24 | # along with this program. If not, see <http://www.gnu.org/licenses/>. | |
25 |
|
25 | from __future__ import with_statement | ||
26 | import unittest |
|
26 | import unittest | |
27 | import datetime |
|
27 | import datetime | |
28 | import hashlib |
|
28 | import hashlib |
General Comments 0
You need to be logged in to leave comments.
Login now