Changeset - d998cc84cf72
[Not reviewed]
Marcin Kuzminski - 13 years ago 2012-09-19 22:38:12
marcin@python-works.com
Merge branch beta into stable
40 files changed with 901 insertions and 783 deletions:
0 comments (0 inline, 0 general)
.travis.yml
Show inline comments
 
language: python
 
python:
 
  - "2.5"
 
  - "2.6"
 
  - "2.7"
 

	
 
env:  
 
  - TEST_DB=sqlite:////tmp/rhodecode_test.sqlite
 
  - TEST_DB=mysql://root@127.0.0.1/rhodecode_test
 
  - TEST_DB=postgresql://postgres@127.0.0.1/rhodecode_test
 

	
 
services:
 
  - mysql
 
  - postgresql
 

	
 
# command to install dependencies
 
before_script:
 
  - mysql -e 'create database rhodecode_test;'
 
  - psql -c 'create database rhodecode_test;' -U postgres
 
  - git --version
 

	
 
before_install:
 
  - sudo apt-get remove git
 
  - sudo add-apt-repository ppa:pdoes/ppa -y
 
  - sudo apt-get update -y
 
  - sudo apt-get install git -y
 

	
 
install:
 
  - pip install mysql-python psycopg2 mock unittest2
 
  - pip install . --use-mirrors
 

	
 
# command to run tests
 
script: nosetests
 

	
 
notifications:
 
    email:
 
        - marcinkuz@gmail.com
 
    irc: "irc.freenode.org#rhodecode"
 

	
 
branches:
 
  only:
 
    - dev
CONTRIBUTORS
Show inline comments
 
List of contributors to RhodeCode project:
 
    Marcin Kuźmiński <marcin@python-works.com>
 
    Lukasz Balcerzak <lukaszbalcerzak@gmail.com>
 
    Jason Harris <jason@jasonfharris.com>
 
    Thayne Harbaugh  <thayne@fusionio.com>
 
    cejones <>
 
    Thomas Waldmann <tw-public@gmx.de>
 
    Lorenzo M. Catucci <lorenzo@sancho.ccd.uniroma2.it>
 
    Dmitri Kuznetsov <>
 
    Jared Bunting <jared.bunting@peachjean.com>
 
    Steve Romanow <slestak989@gmail.com>
 
    Augosto Hermann <augusto.herrmann@planejamento.gov.br>    
 
    Ankit Solanki <ankit.solanki@gmail.com>    
 
    Liad Shani <liadff@gmail.com>
 
    Les Peabody <lpeabody@gmail.com>
 
    Jonas Oberschweiber <jonas.oberschweiber@d-velop.de>
 
    Matt Zuba <matt.zuba@goodwillaz.org>
 
    Aras Pranckevicius <aras@unity3d.com>
 
    Tony Bussieres <t.bussieres@gmail.com>
 
    Erwin Kroon <e.kroon@smartmetersolutions.nl>
 
    nansenat16 <nansenat16@null.tw>
 
    Vincent Duvert <vincent@duvert.net>
 
    Takumi IINO <trot.thunder@gmail.com>
 
    Indra Talip <indra.talip@gmail.com>
 
    James Rhodes <jrhodes@redpointsoftware.com.au>
 
    Dominik Ruf <dominikruf@gmail.com>
 
\ No newline at end of file
 
    Dominik Ruf <dominikruf@gmail.com>
 
    xpol <xpolife@gmail.com>
 
\ No newline at end of file
development.ini
Show inline comments
 
################################################################################
 
################################################################################
 
# RhodeCode - Pylons environment configuration                                 #
 
#                                                                              # 
 
# The %(here)s variable will be replaced with the parent directory of this file#
 
################################################################################
 

	
 
[DEFAULT]
 
debug = true
 
pdebug = false
 
################################################################################
 
## Uncomment and replace with the address which should receive                ## 
 
## any error reports after application crash                                  ##
 
## Additionally those settings will be used by RhodeCode mailing system       ##
 
################################################################################
 
#email_to = admin@localhost
 
#error_email_from = paste_error@localhost
 
#app_email_from = rhodecode-noreply@localhost
 
#error_message =
 
#email_prefix = [RhodeCode]
 

	
 
#smtp_server = mail.server.com
 
#smtp_username = 
 
#smtp_password = 
 
#smtp_port = 
 
#smtp_use_tls = false
 
#smtp_use_ssl = true
 
# Specify available auth parameters here (e.g. LOGIN PLAIN CRAM-MD5, etc.)
 
#smtp_auth = 
 

	
 
[server:main]
 
##nr of threads to spawn
 
#threadpool_workers = 5
 

	
 
##max request before thread respawn
 
#threadpool_max_requests = 10
 

	
 
##option to use threads of process
 
#use_threadpool = true
 

	
 
#use = egg:Paste#http
 
use = egg:waitress#main
 
host = 0.0.0.0
 
port = 5000
 

	
 
[filter:proxy-prefix]
 
# prefix middleware for rc
 
use = egg:PasteDeploy#prefix
 
prefix = /<your-prefix>
 

	
 
[app:main]
 
use = egg:rhodecode
 
#filter-with = proxy-prefix
 
full_stack = true
 
static_files = true
 
# Optional Languages
 
# en, fr, ja, pt_BR, zh_CN, zh_TW
 
lang = en
 
cache_dir = %(here)s/data
 
index_dir = %(here)s/data/index
 
app_instance_uuid = rc-develop
 
cut_off_limit = 256000
 
force_https = false
 
commit_parse_limit = 25
 
use_gravatar = true
 

	
 
## alternative_gravatar_url allows you to use your own avatar server application
 
## the following parts of the URL will be replaced
 
## {email}        user email
 
## {md5email}     md5 hash of the user email (like at gravatar.com)
 
## {size}         size of the image that is expected from the server application
 
## {scheme}       http/https from RhodeCode server
 
## {netloc}       network location from RhodeCode server
 
#alternative_gravatar_url = http://myavatarserver.com/getbyemail/{email}/{size}
 
#alternative_gravatar_url = http://myavatarserver.com/getbymd5/{md5email}?s={size}
 

	
 
container_auth_enabled = false
 
proxypass_auth_enabled = false
 
default_encoding = utf8
 

	
 
## overwrite schema of clone url
 
## available vars:
 
## scheme - http/https
 
## user - current user
 
## pass - password 
 
## netloc - network location
 
## path - usually repo_name
 

	
 
#clone_uri = {scheme}://{user}{pass}{netloc}{path}
 

	
 
## issue tracking mapping for commits messages
 
## comment out issue_pat, issue_server, issue_prefix to enable
 

	
 
## pattern to get the issues from commit messages
 
## default one used here is #<numbers> with a regex passive group for `#`
 
## {id} will be all groups matched from this pattern
 

	
 
issue_pat = (?:\s*#)(\d+)
 

	
 
## server url to the issue, each {id} will be replaced with match
 
## fetched from the regex and {repo} is replaced with full repository name
 
## including groups {repo_name} is replaced with just name of repo
 

	
 
issue_server_link = https://myissueserver.com/{repo}/issue/{id}
 

	
 
## prefix to add to link to indicate it's an url
 
## #314 will be replaced by <issue_prefix><id>
 

	
 
issue_prefix = #
 

	
 
## instance-id prefix
 
## a prefix key for this instance used for cache invalidation when running 
 
## multiple instances of rhodecode, make sure it's globally unique for 
 
## all running rhodecode instances. Leave empty if you don't use it
 
instance_id = 
 

	
 
## alternative return HTTP header for failed authentication. Default HTTP
 
## response is 401 HTTPUnauthorized. Currently HG clients have troubles with 
 
## handling that. Set this variable to 403 to return HTTPForbidden
 
auth_ret_code =
 

	
 
####################################
 
###        CELERY CONFIG        ####
 
####################################
 
use_celery = false
 
broker.host = localhost
 
broker.vhost = rabbitmqhost
 
broker.port = 5672
 
broker.user = rabbitmq
 
broker.password = qweqwe
 

	
 
celery.imports = rhodecode.lib.celerylib.tasks
 

	
 
celery.result.backend = amqp
 
celery.result.dburi = amqp://
 
celery.result.serialier = json
 

	
 
#celery.send.task.error.emails = true
 
#celery.amqp.task.result.expires = 18000
 

	
 
celeryd.concurrency = 2
 
#celeryd.log.file = celeryd.log
 
celeryd.log.level = debug
 
celeryd.max.tasks.per.child = 1
 

	
 
#tasks will never be sent to the queue, but executed locally instead.
 
celery.always.eager = false
 

	
 
####################################
 
###         BEAKER CACHE        ####
 
####################################
 
beaker.cache.data_dir=%(here)s/data/cache/data
 
beaker.cache.lock_dir=%(here)s/data/cache/lock
 

	
 
beaker.cache.regions=super_short_term,short_term,long_term,sql_cache_short,sql_cache_med,sql_cache_long
 

	
 
beaker.cache.super_short_term.type=memory
 
beaker.cache.super_short_term.expire=10
 
beaker.cache.super_short_term.key_length = 256
 

	
 
beaker.cache.short_term.type=memory
 
beaker.cache.short_term.expire=60
 
beaker.cache.short_term.key_length = 256
 

	
 
beaker.cache.long_term.type=memory
 
beaker.cache.long_term.expire=36000
 
beaker.cache.long_term.key_length = 256
 

	
 
beaker.cache.sql_cache_short.type=memory
docs/changelog.rst
Show inline comments
 
.. _changelog:
 

	
 
=========
 
Changelog
 
=========
 

	
 

	
 
1.4.1 (**2012-09-07**)
 
1.4.2 (**2012-09-12**)
 
----------------------
 

	
 
:status: in-progress
 
:branch: beta
 
news
 
++++
 

	
 
- added option to menu to quick lock/unlock repository for users that have
 
  write access to
 
- Implemented permissions for writing to repo
 
  groups. Now only write access to group allows to create a repostiory
 
  within that group
 
- #565 Add support for {netloc} and {scheme} to alternative_gravatar_url
 
- updated translation for zh_CN 
 

	
 
fixes
 
+++++
 

	
 
- fixed visual permissions check on repos groups inside groups
 
- fixed issues with non-ascii search terms in search, and indexers
 
- fixed parsing of page number in GET parameters
 
- fixed issues with generating pull-request overview for repos with
 
  bookmarks and tags, also preview doesn't loose chosen revision from
 
  select dropdown
 

	
 
1.4.1 (**2012-09-07**)
 
----------------------
 

	
 
news
 
++++
 

	
 
- always put a comment about code-review status change even if user send
 
  empty data 
 
- modified_on column saves repository update and it's going to be used
 
  later for light version of main page ref #500
 
- pull request notifications send much nicer emails with details about pull
 
  request
 
- #551 show breadcrumbs in summary view for repositories inside a group
 

	
 
fixes
 
+++++
 

	
 
- fixed migrations of permissions that can lead to inconsistency.
 
  Some users sent feedback that after upgrading from older versions issues 
 
  with updating default permissions occurred. RhodeCode detects that now and
 
  resets default user permission to initial state if there is a need for that.
 
  Also forces users to set the default value for new forking permission. 
 
- #535 improved apache wsgi example configuration in docs
 
- fixes #550 mercurial repositories comparision failed when origin repo had
 
  additional not-common changesets
 
- fixed status of code-review in preview windows of pull request
 
- git forks were not initialized at bare repos
 
- fixes #555 fixes issues with comparing non-related repositories
 
- fixes #557 follower counter always counts up
 
- fixed issue #560 require push ssl checkbox wasn't shown when option was
 
  enabled
 
- fixed #559
 
- fixed issue #559 fixed bug in routing that mapped repo names with <name>_<num> in name as
 
  if it was a request to url by repository ID
 

	
 
1.4.0 (**2012-09-03**)
 
----------------------
 

	
 
news
 
++++
 
 
 
- new codereview system
 
- email map, allowing users to have multiple email addresses mapped into
 
  their accounts
 
- improved git-hook system. Now all actions for git are logged into journal
 
  including pushed revisions, user and IP address
 
- changed setup-app into setup-rhodecode and added default options to it.
 
- new git repos are created as bare now by default
 
- #464 added links to groups in permission box
 
- #465 mentions autocomplete inside comments boxes
 
- #469 added --update-only option to whoosh to re-index only given list
 
  of repos in index 
 
- rhodecode-api CLI client
 
- new git http protocol replaced buggy dulwich implementation.
 
  Now based on pygrack & gitweb
 
- Improved RSS/ATOM feeds. Discoverable by browsers using proper headers, and 
 
  reformated based on user suggestions. Additional rss/atom feeds for user
 
  journal
 
- various i18n improvements
 
- #478 permissions overview for admin in user edit view
 
- File view now displays small gravatars off all authors of given file
 
- Implemented landing revisions. Each repository will get landing_rev attribute
 
  that defines 'default' revision/branch for generating readme files
 
- Implemented #509, RhodeCode enforces SSL for push/pulling if requested at 
 
  earliest possible call.
 
- Import remote svn repositories to mercurial using hgsubversion.
 
- Fixed #508 RhodeCode now has a option to explicitly set forking permissions
 
- RhodeCode can use alternative server for generating avatar icons
 
- implemented repositories locking. Pull locks, push unlocks. Also can be done
 
  via API calls
 
- #538 form for permissions can handle multiple users at once 
 

	
 
fixes
 
+++++
 

	
 
- improved translations
 
- fixes issue #455 Creating an archive generates an exception on Windows
 
- fixes #448 Download ZIP archive keeps file in /tmp open and results 
 
  in out of disk space
 
- fixes issue #454 Search results under Windows include proceeding
 
  backslash
 
- fixed issue #450. Rhodecode no longer will crash when bad revision is
 
  present in journal data.
 
- fix for issue #417, git execution was broken on windows for certain
 
  commands.
 
- fixed #413. Don't disable .git directory for bare repos on deleting
 
- fixed issue #459. Changed the way of obtaining logger in reindex task.
 
- fixed #453 added ID field in whoosh SCHEMA that solves the issue of
 
  reindexing modified files
 
- fixed #481 rhodecode emails are sent without Date header 
 
- fixed #458 wrong count when no repos are present
 
- fixed issue #492 missing `\ No newline at end of file` test at the end of 
 
  new chunk in html diff
 
- full text search now works also for commit messages
 

	
 
1.3.6 (**2012-05-17**)
 
----------------------
 

	
docs/installation_win.rst
Show inline comments
 
.. _installation_win:
 

	
 

	
 
Step by step Installation for Windows
 
=====================================
 

	
 

	
 
RhodeCode step-by-step install Guide for Windows  
 

	
 
Target OS: Windows XP SP3 English (Clean installation) 
 
Target OS: Windows XP SP3 32bit English (Clean installation) 
 
+ All Windows Updates until 24-may-2012 
 

	
 
.. note::
 
    
 
   This installation is for 32bit systems, for 64bit windows you might need
 
   to download proper 64bit version of "Windows Installer" and Win32py
 
   extensions
 

	
 
Step1 - Install Visual Studio 2008 Express
 
------------------------------------------
 

	
 
 
 
Optional: You can also install MingW, but VS2008 installation is easier 
 

	
 
Download "Visual C++ 2008 Express Edition with SP1" from: 
 
http://www.microsoft.com/visualstudio/en-us/products/2008-editions/express 
 
(if not found or relocated, google for "visual studio 2008 express" for 
 
updated link) 
 

	
 
You can also download full ISO file for offline installation, just 
 
choose "All - Offline Install ISO image file" in the previous page and 
 
choose "Visual C++ 2008 Express" when installing. 
 

	
 

	
 
.. note::
 

	
 
  Silverlight Runtime and SQL Server 2008 Express Edition are not 
 
  required, you can uncheck them 
 

	
 

	
 
Step2 - Install Python
 
----------------------
 

	
 
Install Python 2.x.y (x >= 5) x86 version (32bit). DO NOT USE A 3.x version.
 
Download Python 2.x.y from: 
 
http://www.python.org/download/ 
 

	
 
Choose "Windows Installer" (32bit version) not "Windows X86-64 
 
Installer". While writing this guide, the latest version was v2.7.3. 
 
Remember the specific major and minor version installed, because it will 
 
be needed in the next step. In this case, it is "2.7". 
 

	
 

	
 
Step3 - Install Win32py extensions
 
----------------------------------
 
 
 
Download pywin32 from: 
 
http://sourceforge.net/projects/pywin32/files/ 
 

	
 
- Click on "pywin32" folder 
 
- Click on the first folder (in this case, Build 217, maybe newer when you try) 
 
- Choose the file ending with ".win32-py2.x.exe" -> x being the minor 
 
  version of Python you installed (in this case, 7) 
 
  When writing this guide, the file was: 
 
  http://sourceforge.net/projects/pywin32/files/pywin32/Build%20217/pywin32-217.win32-py2.7.exe/download 
 

	
 

	
 
Step4 - Python BIN
 
------------------
 

	
 
Add Python BIN folder to the path 
 

	
 
You have to add the Python folder to the path, you can do it manually 
 
(editing "PATH" environment variable) or using Windows Support Tools 
 
that came preinstalled in Vista/7 and can be installed in Windows XP. 
 

	
 
- Using support tools on WINDOWS XP: 
 
  If you use Windows XP you can install them using Windows XP CD and 
 
  navigating to \SUPPORT\TOOLS. There, execute Setup.EXE (not MSI). 
 
  Afterwards, open a CMD and type::
 
 
 
    SETX PATH "%PATH%;[your-python-path]" -M 
 

	
 
  Close CMD (the path variable will be updated then) 
 

	
 
- Using support tools on WINDOWS Vista/7: 
 

	
 
  Open a CMD and type::
 

	
 
    SETX PATH "%PATH%;[your-python-path]" /M 
 

	
 
  Please substitute [your-python-path] with your Python installation path. 
 
  Typically: C:\\Python27 
 

	
 

	
 
Step5 - RhodeCode folder structure
 
----------------------------------
 

	
 
Create a RhodeCode folder structure 
 

	
 
This is only a example to install RhodeCode, you can of course change 
 
it. However, this guide will follow the proposed structure, so please 
 
later adapt the paths if you change them. My recommendation is to use 
 
folders with NO SPACES. But you can try if you are brave... 
 

	
 
Create the following folder structure::
 

	
 
  C:\RhodeCode 
 
  C:\RhodeCode\Bin 
 
  C:\RhodeCode\Env 
 
  C:\RhodeCode\Repos 
 

	
 

	
 
Step6 - Install virtualenv
production.ini
Show inline comments
 
################################################################################
 
################################################################################
 
# RhodeCode - Pylons environment configuration                                 #
 
#                                                                              # 
 
# The %(here)s variable will be replaced with the parent directory of this file#
 
################################################################################
 

	
 
[DEFAULT]
 
debug = true
 
pdebug = false
 
################################################################################
 
## Uncomment and replace with the address which should receive                ## 
 
## any error reports after application crash                                  ##
 
## Additionally those settings will be used by RhodeCode mailing system       ##
 
################################################################################
 
#email_to = admin@localhost
 
#error_email_from = paste_error@localhost
 
#app_email_from = rhodecode-noreply@localhost
 
#error_message =
 
#email_prefix = [RhodeCode]
 

	
 
#smtp_server = mail.server.com
 
#smtp_username = 
 
#smtp_password = 
 
#smtp_port = 
 
#smtp_use_tls = false
 
#smtp_use_ssl = true
 
# Specify available auth parameters here (e.g. LOGIN PLAIN CRAM-MD5, etc.)
 
#smtp_auth = 
 

	
 
[server:main]
 
##nr of threads to spawn
 
#threadpool_workers = 5
 

	
 
##max request before thread respawn
 
#threadpool_max_requests = 10
 

	
 
##option to use threads of process
 
#use_threadpool = true
 

	
 
#use = egg:Paste#http
 
use = egg:waitress#main
 
host = 127.0.0.1
 
port = 8001
 

	
 
[filter:proxy-prefix]
 
# prefix middleware for rc
 
use = egg:PasteDeploy#prefix
 
prefix = /<your-prefix>
 

	
 
[app:main]
 
use = egg:rhodecode
 
#filter-with = proxy-prefix
 
full_stack = true
 
static_files = true
 
# Optional Languages
 
# en, fr, ja, pt_BR, zh_CN, zh_TW
 
lang = en
 
cache_dir = %(here)s/data
 
index_dir = %(here)s/data/index
 
app_instance_uuid = rc-production
 
cut_off_limit = 256000
 
force_https = false
 
commit_parse_limit = 50
 
use_gravatar = true
 

	
 
## alternative_gravatar_url allows you to use your own avatar server application
 
## the following parts of the URL will be replaced
 
## {email}        user email
 
## {md5email}     md5 hash of the user email (like at gravatar.com)
 
## {size}         size of the image that is expected from the server application
 
## {scheme}       http/https from RhodeCode server
 
## {netloc}       network location from RhodeCode server
 
#alternative_gravatar_url = http://myavatarserver.com/getbyemail/{email}/{size}
 
#alternative_gravatar_url = http://myavatarserver.com/getbymd5/{md5email}?s={size}
 

	
 
container_auth_enabled = false
 
proxypass_auth_enabled = false
 
default_encoding = utf8
 

	
 
## overwrite schema of clone url
 
## available vars:
 
## scheme - http/https
 
## user - current user
 
## pass - password 
 
## netloc - network location
 
## path - usually repo_name
 

	
 
#clone_uri = {scheme}://{user}{pass}{netloc}{path}
 

	
 
## issue tracking mapping for commits messages
 
## comment out issue_pat, issue_server, issue_prefix to enable
 

	
 
## pattern to get the issues from commit messages
 
## default one used here is #<numbers> with a regex passive group for `#`
 
## {id} will be all groups matched from this pattern
 

	
 
issue_pat = (?:\s*#)(\d+)
 

	
 
## server url to the issue, each {id} will be replaced with match
 
## fetched from the regex and {repo} is replaced with full repository name
 
## including groups {repo_name} is replaced with just name of repo
 

	
 
issue_server_link = https://myissueserver.com/{repo}/issue/{id}
 

	
 
## prefix to add to link to indicate it's an url
 
## #314 will be replaced by <issue_prefix><id>
 

	
 
issue_prefix = #
 

	
 
## instance-id prefix
 
## a prefix key for this instance used for cache invalidation when running 
 
## multiple instances of rhodecode, make sure it's globally unique for 
 
## all running rhodecode instances. Leave empty if you don't use it
 
instance_id = 
 

	
 
## alternative return HTTP header for failed authentication. Default HTTP
 
## response is 401 HTTPUnauthorized. Currently HG clients have troubles with 
 
## handling that. Set this variable to 403 to return HTTPForbidden
 
auth_ret_code =
 

	
 
####################################
 
###        CELERY CONFIG        ####
 
####################################
 
use_celery = false
 
broker.host = localhost
 
broker.vhost = rabbitmqhost
 
broker.port = 5672
 
broker.user = rabbitmq
 
broker.password = qweqwe
 

	
 
celery.imports = rhodecode.lib.celerylib.tasks
 

	
 
celery.result.backend = amqp
 
celery.result.dburi = amqp://
 
celery.result.serialier = json
 

	
 
#celery.send.task.error.emails = true
 
#celery.amqp.task.result.expires = 18000
 

	
 
celeryd.concurrency = 2
 
#celeryd.log.file = celeryd.log
 
celeryd.log.level = debug
 
celeryd.max.tasks.per.child = 1
 

	
 
#tasks will never be sent to the queue, but executed locally instead.
 
celery.always.eager = false
 

	
 
####################################
 
###         BEAKER CACHE        ####
 
####################################
 
beaker.cache.data_dir=%(here)s/data/cache/data
 
beaker.cache.lock_dir=%(here)s/data/cache/lock
 

	
 
beaker.cache.regions=super_short_term,short_term,long_term,sql_cache_short,sql_cache_med,sql_cache_long
 

	
 
beaker.cache.super_short_term.type=memory
 
beaker.cache.super_short_term.expire=10
 
beaker.cache.super_short_term.key_length = 256
 

	
 
beaker.cache.short_term.type=memory
 
beaker.cache.short_term.expire=60
 
beaker.cache.short_term.key_length = 256
 

	
 
beaker.cache.long_term.type=memory
 
beaker.cache.long_term.expire=36000
 
beaker.cache.long_term.key_length = 256
 

	
 
beaker.cache.sql_cache_short.type=memory
rhodecode/__init__.py
Show inline comments
 
# -*- coding: utf-8 -*-
 
"""
 
    rhodecode.__init__
 
    ~~~~~~~~~~~~~~~~~~
 

	
 
    RhodeCode, a web based repository management based on pylons
 
    versioning implementation: http://www.python.org/dev/peps/pep-0386/
 

	
 
    :created_on: Apr 9, 2010
 
    :author: marcink
 
    :copyright: (C) 2010-2012 Marcin Kuzminski <marcin@python-works.com>
 
    :license: GPLv3, see COPYING for more details.
 
"""
 
# This program is free software: you can redistribute it and/or modify
 
# it under the terms of the GNU General Public License as published by
 
# the Free Software Foundation, either version 3 of the License, or
 
# (at your option) any later version.
 
#
 
# This program is distributed in the hope that it will be useful,
 
# but WITHOUT ANY WARRANTY; without even the implied warranty of
 
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 
# GNU General Public License for more details.
 
#
 
# You should have received a copy of the GNU General Public License
 
# along with this program.  If not, see <http://www.gnu.org/licenses/>.
 
import sys
 
import platform
 

	
 
VERSION = (1, 4, 1)
 
VERSION = (1, 4, 2)
 

	
 
try:
 
    from rhodecode.lib import get_current_revision
 
    _rev = get_current_revision(quiet=True)
 
    if _rev and len(VERSION) > 3:
 
        VERSION += ('dev%s' % _rev[0],)
 
except ImportError:
 
    pass
 

	
 
__version__ = ('.'.join((str(each) for each in VERSION[:3])) +
 
               '.'.join(VERSION[3:]))
 
__dbversion__ = 7  # defines current db version for migrations
 
__platform__ = platform.system()
 
__license__ = 'GPLv3'
 
__py_version__ = sys.version_info
 
__author__ = 'Marcin Kuzminski'
 
__url__ = 'http://rhodecode.org'
 

	
 
PLATFORM_WIN = ('Windows')
 
PLATFORM_OTHERS = ('Linux', 'Darwin', 'FreeBSD', 'OpenBSD', 'SunOS') #depracated
 

	
 
is_windows = __platform__ in PLATFORM_WIN
 
is_unix = not is_windows
 

	
 

	
 
BACKENDS = {
 
    'hg': 'Mercurial repository',
 
    'git': 'Git repository',
 
}
 

	
 
CELERY_ON = False
 
CELERY_EAGER = False
 

	
 
# link to config for pylons
 
CONFIG = {}
 

	
 
# Linked module for extensions
 
EXTENSIONS = {}
rhodecode/config/deployment.ini_tmpl
Show inline comments
 
################################################################################
 
################################################################################
 
# RhodeCode - Pylons environment configuration                                 #
 
#                                                                              # 
 
# The %(here)s variable will be replaced with the parent directory of this file#
 
################################################################################
 

	
 
[DEFAULT]
 
debug = true
 
pdebug = false
 
################################################################################
 
## Uncomment and replace with the address which should receive                ## 
 
## any error reports after application crash                                  ##
 
## Additionally those settings will be used by RhodeCode mailing system       ##
 
################################################################################
 
#email_to = admin@localhost
 
#error_email_from = paste_error@localhost
 
#app_email_from = rhodecode-noreply@localhost
 
#error_message =
 
#email_prefix = [RhodeCode]
 

	
 
#smtp_server = mail.server.com
 
#smtp_username = 
 
#smtp_password = 
 
#smtp_port = 
 
#smtp_use_tls = false
 
#smtp_use_ssl = true
 
# Specify available auth parameters here (e.g. LOGIN PLAIN CRAM-MD5, etc.)
 
#smtp_auth = 
 

	
 
[server:main]
 
##nr of threads to spawn
 
#threadpool_workers = 5
 

	
 
##max request before thread respawn
 
#threadpool_max_requests = 10
 

	
 
##option to use threads of process
 
#use_threadpool = true
 

	
 
#use = egg:Paste#http
 
use = egg:waitress#main
 
host = 127.0.0.1
 
port = 5000
 

	
 
[filter:proxy-prefix]
 
# prefix middleware for rc
 
use = egg:PasteDeploy#prefix
 
prefix = /<your-prefix>
 

	
 
[app:main]
 
use = egg:rhodecode
 
#filter-with = proxy-prefix
 
full_stack = true
 
static_files = true
 
# Optional Languages
 
# en, fr, ja, pt_BR, zh_CN, zh_TW
 
lang = en
 
cache_dir = %(here)s/data
 
index_dir = %(here)s/data/index
 
app_instance_uuid = ${app_instance_uuid}
 
cut_off_limit = 256000
 
force_https = false
 
commit_parse_limit = 50
 
use_gravatar = true
 

	
 
## alternative_gravatar_url allows you to use your own avatar server application
 
## the following parts of the URL will be replaced
 
## {email}        user email
 
## {md5email}     md5 hash of the user email (like at gravatar.com)
 
## {size}         size of the image that is expected from the server application
 
## {scheme}       http/https from RhodeCode server
 
## {netloc}       network location from RhodeCode server
 
#alternative_gravatar_url = http://myavatarserver.com/getbyemail/{email}/{size}
 
#alternative_gravatar_url = http://myavatarserver.com/getbymd5/{md5email}?s={size}
 

	
 
container_auth_enabled = false
 
proxypass_auth_enabled = false
 
default_encoding = utf8
 

	
 
## overwrite schema of clone url
 
## available vars:
 
## scheme - http/https
 
## user - current user
 
## pass - password 
 
## netloc - network location
 
## path - usually repo_name
 

	
 
#clone_uri = {scheme}://{user}{pass}{netloc}{path}
 

	
 
## issue tracking mapping for commits messages
 
## comment out issue_pat, issue_server, issue_prefix to enable
 

	
 
## pattern to get the issues from commit messages
 
## default one used here is #<numbers> with a regex passive group for `#`
 
## {id} will be all groups matched from this pattern
 

	
 
issue_pat = (?:\s*#)(\d+)
 

	
 
## server url to the issue, each {id} will be replaced with match
 
## fetched from the regex and {repo} is replaced with full repository name
 
## including groups {repo_name} is replaced with just name of repo
 

	
 
issue_server_link = https://myissueserver.com/{repo}/issue/{id}
 

	
 
## prefix to add to link to indicate it's an url
 
## #314 will be replaced by <issue_prefix><id>
 

	
 
issue_prefix = #
 

	
 
## instance-id prefix
 
## a prefix key for this instance used for cache invalidation when running 
 
## multiple instances of rhodecode, make sure it's globally unique for 
 
## all running rhodecode instances. Leave empty if you don't use it
 
instance_id = 
 

	
 
## alternative return HTTP header for failed authentication. Default HTTP
 
## response is 401 HTTPUnauthorized. Currently HG clients have troubles with 
 
## handling that. Set this variable to 403 to return HTTPForbidden
 
auth_ret_code =
 

	
 
####################################
 
###        CELERY CONFIG        ####
 
####################################
 
use_celery = false
 
broker.host = localhost
 
broker.vhost = rabbitmqhost
 
broker.port = 5672
 
broker.user = rabbitmq
 
broker.password = qweqwe
 

	
 
celery.imports = rhodecode.lib.celerylib.tasks
 

	
 
celery.result.backend = amqp
 
celery.result.dburi = amqp://
 
celery.result.serialier = json
 

	
 
#celery.send.task.error.emails = true
 
#celery.amqp.task.result.expires = 18000
 

	
 
celeryd.concurrency = 2
 
#celeryd.log.file = celeryd.log
 
celeryd.log.level = debug
 
celeryd.max.tasks.per.child = 1
 

	
 
#tasks will never be sent to the queue, but executed locally instead.
 
celery.always.eager = false
 

	
 
####################################
 
###         BEAKER CACHE        ####
 
####################################
 
beaker.cache.data_dir=%(here)s/data/cache/data
 
beaker.cache.lock_dir=%(here)s/data/cache/lock
 

	
 
beaker.cache.regions=super_short_term,short_term,long_term,sql_cache_short,sql_cache_med,sql_cache_long
 

	
 
beaker.cache.super_short_term.type=memory
 
beaker.cache.super_short_term.expire=10
 
beaker.cache.super_short_term.key_length = 256
 

	
 
beaker.cache.short_term.type=memory
 
beaker.cache.short_term.expire=60
 
beaker.cache.short_term.key_length = 256
 

	
 
beaker.cache.long_term.type=memory
 
beaker.cache.long_term.expire=36000
 
beaker.cache.long_term.key_length = 256
 

	
 
beaker.cache.sql_cache_short.type=memory
rhodecode/config/routing.py
Show inline comments
 
@@ -48,192 +48,193 @@ def make_map(config):
 

	
 
        :param environ:
 
        :param match_dict:
 
        """
 
        repos_group_name = match_dict.get('group_name')
 

	
 
        return is_valid_repos_group(repos_group_name, config['base_path'])
 

	
 
    def check_int(environ, match_dict):
 
        return match_dict.get('id').isdigit()
 

	
 
    # The ErrorController route (handles 404/500 error pages); it should
 
    # likely stay at the top, ensuring it can always be resolved
 
    rmap.connect('/error/{action}', controller='error')
 
    rmap.connect('/error/{action}/{id}', controller='error')
 

	
 
    #==========================================================================
 
    # CUSTOM ROUTES HERE
 
    #==========================================================================
 

	
 
    #MAIN PAGE
 
    rmap.connect('home', '/', controller='home', action='index')
 
    rmap.connect('repo_switcher', '/repos', controller='home',
 
                 action='repo_switcher')
 
    rmap.connect('branch_tag_switcher', '/branches-tags/{repo_name:.*?}',
 
                 controller='home', action='branch_tag_switcher')
 
    rmap.connect('bugtracker',
 
                 "http://bitbucket.org/marcinkuzminski/rhodecode/issues",
 
                 _static=True)
 
    rmap.connect('rst_help',
 
                 "http://docutils.sourceforge.net/docs/user/rst/quickref.html",
 
                 _static=True)
 
    rmap.connect('rhodecode_official', "http://rhodecode.org", _static=True)
 

	
 
    #ADMIN REPOSITORY REST ROUTES
 
    with rmap.submapper(path_prefix=ADMIN_PREFIX,
 
                        controller='admin/repos') as m:
 
        m.connect("repos", "/repos",
 
             action="create", conditions=dict(method=["POST"]))
 
        m.connect("repos", "/repos",
 
             action="index", conditions=dict(method=["GET"]))
 
        m.connect("formatted_repos", "/repos.{format}",
 
             action="index",
 
            conditions=dict(method=["GET"]))
 
        m.connect("new_repo", "/repos/new",
 
             action="new", conditions=dict(method=["GET"]))
 
        m.connect("formatted_new_repo", "/repos/new.{format}",
 
             action="new", conditions=dict(method=["GET"]))
 
        m.connect("/repos/{repo_name:.*?}",
 
             action="update", conditions=dict(method=["PUT"],
 
                                              function=check_repo))
 
        m.connect("/repos/{repo_name:.*?}",
 
             action="delete", conditions=dict(method=["DELETE"],
 
                                              function=check_repo))
 
        m.connect("edit_repo", "/repos/{repo_name:.*?}/edit",
 
             action="edit", conditions=dict(method=["GET"],
 
                                            function=check_repo))
 
        m.connect("formatted_edit_repo", "/repos/{repo_name:.*?}.{format}/edit",
 
             action="edit", conditions=dict(method=["GET"],
 
                                            function=check_repo))
 
        m.connect("repo", "/repos/{repo_name:.*?}",
 
             action="show", conditions=dict(method=["GET"],
 
                                            function=check_repo))
 
        m.connect("formatted_repo", "/repos/{repo_name:.*?}.{format}",
 
             action="show", conditions=dict(method=["GET"],
 
                                            function=check_repo))
 
        #ajax delete repo perm user
 
        m.connect('delete_repo_user', "/repos_delete_user/{repo_name:.*?}",
 
             action="delete_perm_user",
 
             conditions=dict(method=["DELETE"], function=check_repo))
 

	
 
        #ajax delete repo perm users_group
 
        m.connect('delete_repo_users_group',
 
                  "/repos_delete_users_group/{repo_name:.*?}",
 
                  action="delete_perm_users_group",
 
                  conditions=dict(method=["DELETE"], function=check_repo))
 

	
 
        #settings actions
 
        m.connect('repo_stats', "/repos_stats/{repo_name:.*?}",
 
                  action="repo_stats", conditions=dict(method=["DELETE"],
 
                                                       function=check_repo))
 
        m.connect('repo_cache', "/repos_cache/{repo_name:.*?}",
 
                  action="repo_cache", conditions=dict(method=["DELETE"],
 
                                                       function=check_repo))
 
        m.connect('repo_public_journal', "/repos_public_journal/{repo_name:.*?}",
 
                  action="repo_public_journal", conditions=dict(method=["PUT"],
 
                                                        function=check_repo))
 
        m.connect('repo_pull', "/repo_pull/{repo_name:.*?}",
 
                  action="repo_pull", conditions=dict(method=["PUT"],
 
                                                      function=check_repo))
 
        m.connect('repo_as_fork', "/repo_as_fork/{repo_name:.*?}",
 
                  action="repo_as_fork", conditions=dict(method=["PUT"],
 
                                                      function=check_repo))
 
        m.connect('repo_locking', "/repo_locking/{repo_name:.*?}",
 
                  action="repo_locking", conditions=dict(method=["PUT"],
 
                                                      function=check_repo))
 

	
 
    with rmap.submapper(path_prefix=ADMIN_PREFIX,
 
                        controller='admin/repos_groups') as m:
 
        m.connect("repos_groups", "/repos_groups",
 
                  action="create", conditions=dict(method=["POST"]))
 
        m.connect("repos_groups", "/repos_groups",
 
                  action="index", conditions=dict(method=["GET"]))
 
        m.connect("formatted_repos_groups", "/repos_groups.{format}",
 
                  action="index", conditions=dict(method=["GET"]))
 
        m.connect("new_repos_group", "/repos_groups/new",
 
                  action="new", conditions=dict(method=["GET"]))
 
        m.connect("formatted_new_repos_group", "/repos_groups/new.{format}",
 
                  action="new", conditions=dict(method=["GET"]))
 
        m.connect("update_repos_group", "/repos_groups/{id}",
 
                  action="update", conditions=dict(method=["PUT"],
 
                                                   function=check_int))
 
        m.connect("delete_repos_group", "/repos_groups/{id}",
 
                  action="delete", conditions=dict(method=["DELETE"],
 
                                                   function=check_int))
 
        m.connect("edit_repos_group", "/repos_groups/{id:.*?}/edit",
 
                  action="edit", conditions=dict(method=["GET"],))
 
        m.connect("formatted_edit_repos_group",
 
                  "/repos_groups/{id}.{format}/edit",
 
                  action="edit", conditions=dict(method=["GET"],
 
                                                 function=check_int))
 
        m.connect("repos_group", "/repos_groups/{id}",
 
                  action="show", conditions=dict(method=["GET"],
 
                                                 function=check_int))
 
        m.connect("formatted_repos_group", "/repos_groups/{id}.{format}",
 
                  action="show", conditions=dict(method=["GET"],
 
                                                 function=check_int))
 
        # ajax delete repos group perm user
 
        m.connect('delete_repos_group_user_perm',
 
                  "/delete_repos_group_user_perm/{group_name:.*}",
 
             action="delete_repos_group_user_perm",
 
             conditions=dict(method=["DELETE"], function=check_group))
 

	
 
        # ajax delete repos group perm users_group
 
        m.connect('delete_repos_group_users_group_perm',
 
                  "/delete_repos_group_users_group_perm/{group_name:.*}",
 
                  action="delete_repos_group_users_group_perm",
 
                  conditions=dict(method=["DELETE"], function=check_group))
 

	
 
    #ADMIN USER REST ROUTES
 
    with rmap.submapper(path_prefix=ADMIN_PREFIX,
 
                        controller='admin/users') as m:
 
        m.connect("users", "/users",
 
                  action="create", conditions=dict(method=["POST"]))
 
        m.connect("users", "/users",
 
                  action="index", conditions=dict(method=["GET"]))
 
        m.connect("formatted_users", "/users.{format}",
 
                  action="index", conditions=dict(method=["GET"]))
 
        m.connect("new_user", "/users/new",
 
                  action="new", conditions=dict(method=["GET"]))
 
        m.connect("formatted_new_user", "/users/new.{format}",
 
                  action="new", conditions=dict(method=["GET"]))
 
        m.connect("update_user", "/users/{id}",
 
                  action="update", conditions=dict(method=["PUT"]))
 
        m.connect("delete_user", "/users/{id}",
 
                  action="delete", conditions=dict(method=["DELETE"]))
 
        m.connect("edit_user", "/users/{id}/edit",
 
                  action="edit", conditions=dict(method=["GET"]))
 
        m.connect("formatted_edit_user",
 
                  "/users/{id}.{format}/edit",
 
                  action="edit", conditions=dict(method=["GET"]))
 
        m.connect("user", "/users/{id}",
 
                  action="show", conditions=dict(method=["GET"]))
 
        m.connect("formatted_user", "/users/{id}.{format}",
 
                  action="show", conditions=dict(method=["GET"]))
 

	
 
        #EXTRAS USER ROUTES
 
        m.connect("user_perm", "/users_perm/{id}",
 
                  action="update_perm", conditions=dict(method=["PUT"]))
 
        m.connect("user_emails", "/users_emails/{id}",
 
                  action="add_email", conditions=dict(method=["PUT"]))
 
        m.connect("user_emails_delete", "/users_emails/{id}",
 
                  action="delete_email", conditions=dict(method=["DELETE"]))
 

	
 
    #ADMIN USERS GROUPS REST ROUTES
 
    with rmap.submapper(path_prefix=ADMIN_PREFIX,
 
                        controller='admin/users_groups') as m:
 
        m.connect("users_groups", "/users_groups",
 
                  action="create", conditions=dict(method=["POST"]))
 
        m.connect("users_groups", "/users_groups",
 
                  action="index", conditions=dict(method=["GET"]))
 
        m.connect("formatted_users_groups", "/users_groups.{format}",
 
                  action="index", conditions=dict(method=["GET"]))
 
        m.connect("new_users_group", "/users_groups/new",
 
                  action="new", conditions=dict(method=["GET"]))
 
        m.connect("formatted_new_users_group", "/users_groups/new.{format}",
 
                  action="new", conditions=dict(method=["GET"]))
 
        m.connect("update_users_group", "/users_groups/{id}",
 
                  action="update", conditions=dict(method=["PUT"]))
 
        m.connect("delete_users_group", "/users_groups/{id}",
 
                  action="delete", conditions=dict(method=["DELETE"]))
 
        m.connect("edit_users_group", "/users_groups/{id}/edit",
 
                  action="edit", conditions=dict(method=["GET"]))
 
@@ -468,113 +469,117 @@ def make_map(config):
 
                 action='delete', conditions=dict(function=check_repo,
 
                                                method=["DELETE"]))
 

	
 
    rmap.connect('pullrequest_show_all',
 
                 '/{repo_name:.*?}/pull-request',
 
                 controller='pullrequests',
 
                 action='show_all', conditions=dict(function=check_repo,
 
                                                method=["GET"]))
 

	
 
    rmap.connect('pullrequest_comment',
 
                 '/{repo_name:.*?}/pull-request-comment/{pull_request_id}',
 
                 controller='pullrequests',
 
                 action='comment', conditions=dict(function=check_repo,
 
                                                method=["POST"]))
 

	
 
    rmap.connect('pullrequest_comment_delete',
 
                 '/{repo_name:.*?}/pull-request-comment/{comment_id}/delete',
 
                controller='pullrequests', action='delete_comment',
 
                conditions=dict(function=check_repo, method=["DELETE"]))
 

	
 
    rmap.connect('summary_home', '/{repo_name:.*?}/summary',
 
                controller='summary', conditions=dict(function=check_repo))
 

	
 
    rmap.connect('shortlog_home', '/{repo_name:.*?}/shortlog',
 
                controller='shortlog', conditions=dict(function=check_repo))
 

	
 
    rmap.connect('branches_home', '/{repo_name:.*?}/branches',
 
                controller='branches', conditions=dict(function=check_repo))
 

	
 
    rmap.connect('tags_home', '/{repo_name:.*?}/tags',
 
                controller='tags', conditions=dict(function=check_repo))
 

	
 
    rmap.connect('bookmarks_home', '/{repo_name:.*?}/bookmarks',
 
                controller='bookmarks', conditions=dict(function=check_repo))
 

	
 
    rmap.connect('changelog_home', '/{repo_name:.*?}/changelog',
 
                controller='changelog', conditions=dict(function=check_repo))
 

	
 
    rmap.connect('changelog_details', '/{repo_name:.*?}/changelog_details/{cs}',
 
                controller='changelog', action='changelog_details',
 
                conditions=dict(function=check_repo))
 

	
 
    rmap.connect('files_home', '/{repo_name:.*?}/files/{revision}/{f_path:.*}',
 
                controller='files', revision='tip', f_path='',
 
                conditions=dict(function=check_repo))
 

	
 
    rmap.connect('files_diff_home', '/{repo_name:.*?}/diff/{f_path:.*}',
 
                controller='files', action='diff', revision='tip', f_path='',
 
                conditions=dict(function=check_repo))
 

	
 
    rmap.connect('files_rawfile_home',
 
                 '/{repo_name:.*?}/rawfile/{revision}/{f_path:.*}',
 
                 controller='files', action='rawfile', revision='tip',
 
                 f_path='', conditions=dict(function=check_repo))
 

	
 
    rmap.connect('files_raw_home',
 
                 '/{repo_name:.*?}/raw/{revision}/{f_path:.*}',
 
                 controller='files', action='raw', revision='tip', f_path='',
 
                 conditions=dict(function=check_repo))
 

	
 
    rmap.connect('files_annotate_home',
 
                 '/{repo_name:.*?}/annotate/{revision}/{f_path:.*}',
 
                 controller='files', action='index', revision='tip',
 
                 f_path='', annotate=True, conditions=dict(function=check_repo))
 

	
 
    rmap.connect('files_edit_home',
 
                 '/{repo_name:.*?}/edit/{revision}/{f_path:.*}',
 
                 controller='files', action='edit', revision='tip',
 
                 f_path='', conditions=dict(function=check_repo))
 

	
 
    rmap.connect('files_add_home',
 
                 '/{repo_name:.*?}/add/{revision}/{f_path:.*}',
 
                 controller='files', action='add', revision='tip',
 
                 f_path='', conditions=dict(function=check_repo))
 

	
 
    rmap.connect('files_archive_home', '/{repo_name:.*?}/archive/{fname}',
 
                controller='files', action='archivefile',
 
                conditions=dict(function=check_repo))
 

	
 
    rmap.connect('files_nodelist_home',
 
                 '/{repo_name:.*?}/nodelist/{revision}/{f_path:.*}',
 
                controller='files', action='nodelist',
 
                conditions=dict(function=check_repo))
 

	
 
    rmap.connect('repo_settings_delete', '/{repo_name:.*?}/settings',
 
                controller='settings', action="delete",
 
                conditions=dict(method=["DELETE"], function=check_repo))
 

	
 
    rmap.connect('repo_settings_update', '/{repo_name:.*?}/settings',
 
                controller='settings', action="update",
 
                conditions=dict(method=["PUT"], function=check_repo))
 

	
 
    rmap.connect('repo_settings_home', '/{repo_name:.*?}/settings',
 
                controller='settings', action='index',
 
                conditions=dict(function=check_repo))
 

	
 
    rmap.connect('toggle_locking', "/{repo_name:.*?}/locking_toggle",
 
                 controller='settings', action="toggle_locking",
 
                 conditions=dict(method=["GET"], function=check_repo))
 

	
 
    rmap.connect('repo_fork_create_home', '/{repo_name:.*?}/fork',
 
                controller='forks', action='fork_create',
 
                conditions=dict(function=check_repo, method=["POST"]))
 

	
 
    rmap.connect('repo_fork_home', '/{repo_name:.*?}/fork',
 
                controller='forks', action='fork',
 
                conditions=dict(function=check_repo))
 

	
 
    rmap.connect('repo_forks_home', '/{repo_name:.*?}/forks',
 
                 controller='forks', action='forks',
 
                 conditions=dict(function=check_repo))
 

	
 
    rmap.connect('repo_followers_home', '/{repo_name:.*?}/followers',
 
                 controller='followers', action='followers',
 
                 conditions=dict(function=check_repo))
 

	
 
    return rmap
rhodecode/controllers/admin/admin.py
Show inline comments
 
# -*- coding: utf-8 -*-
 
"""
 
    rhodecode.controllers.admin.admin
 
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 

	
 
    Controller for Admin panel of Rhodecode
 

	
 
    :created_on: Apr 7, 2010
 
    :author: marcink
 
    :copyright: (C) 2010-2012 Marcin Kuzminski <marcin@python-works.com>
 
    :license: GPLv3, see COPYING for more details.
 
"""
 
# This program is free software: you can redistribute it and/or modify
 
# it under the terms of the GNU General Public License as published by
 
# the Free Software Foundation, either version 3 of the License, or
 
# (at your option) any later version.
 
#
 
# This program is distributed in the hope that it will be useful,
 
# but WITHOUT ANY WARRANTY; without even the implied warranty of
 
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 
# GNU General Public License for more details.
 
#
 
# You should have received a copy of the GNU General Public License
 
# along with this program.  If not, see <http://www.gnu.org/licenses/>.
 

	
 
import logging
 

	
 
from pylons import request, tmpl_context as c
 
from sqlalchemy.orm import joinedload
 
from webhelpers.paginate import Page
 

	
 
from rhodecode.lib.auth import LoginRequired, HasPermissionAllDecorator
 
from rhodecode.lib.base import BaseController, render
 
from rhodecode.model.db import UserLog
 
from rhodecode.lib.utils2 import safe_int
 

	
 
log = logging.getLogger(__name__)
 

	
 

	
 
class AdminController(BaseController):
 

	
 
    @LoginRequired()
 
    def __before__(self):
 
        super(AdminController, self).__before__()
 

	
 
    @HasPermissionAllDecorator('hg.admin')
 
    def index(self):
 

	
 
        users_log = UserLog.query()\
 
                .options(joinedload(UserLog.user))\
 
                .options(joinedload(UserLog.repository))\
 
                .order_by(UserLog.action_date.desc())
 

	
 
        p = int(request.params.get('page', 1))
 
        p = safe_int(request.params.get('page', 1), 1)
 
        c.users_log = Page(users_log, page=p, items_per_page=10)
 
        c.log_data = render('admin/admin_log.html')
 

	
 
        if request.environ.get('HTTP_X_PARTIAL_XHR'):
 
            return c.log_data
 
        return render('admin/admin.html')
rhodecode/controllers/admin/notifications.py
Show inline comments
 
# -*- coding: utf-8 -*-
 
"""
 
    rhodecode.controllers.admin.notifications
 
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 

	
 
    notifications controller for RhodeCode
 

	
 
    :created_on: Nov 23, 2010
 
    :author: marcink
 
    :copyright: (C) 2010-2012 Marcin Kuzminski <marcin@python-works.com>
 
    :license: GPLv3, see COPYING for more details.
 
"""
 
# This program is free software: you can redistribute it and/or modify
 
# it under the terms of the GNU General Public License as published by
 
# the Free Software Foundation, either version 3 of the License, or
 
# (at your option) any later version.
 
#
 
# This program is distributed in the hope that it will be useful,
 
# but WITHOUT ANY WARRANTY; without even the implied warranty of
 
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 
# GNU General Public License for more details.
 
#
 
# You should have received a copy of the GNU General Public License
 
# along with this program.  If not, see <http://www.gnu.org/licenses/>.
 

	
 
import logging
 
import traceback
 

	
 
from pylons import request
 
from pylons import tmpl_context as c, url
 
from pylons.controllers.util import redirect
 

	
 
from webhelpers.paginate import Page
 

	
 
from rhodecode.lib.base import BaseController, render
 
from rhodecode.model.db import Notification
 

	
 
from rhodecode.model.notification import NotificationModel
 
from rhodecode.lib.auth import LoginRequired, NotAnonymous
 
from rhodecode.lib import helpers as h
 
from rhodecode.model.meta import Session
 
from rhodecode.lib.utils2 import safe_int
 

	
 

	
 
log = logging.getLogger(__name__)
 

	
 

	
 
class NotificationsController(BaseController):
 
    """REST Controller styled on the Atom Publishing Protocol"""
 
    # To properly map this controller, ensure your config/routing.py
 
    # file has a resource setup:
 
    #     map.resource('notification', 'notifications', controller='_admin/notifications',
 
    #         path_prefix='/_admin', name_prefix='_admin_')
 

	
 
    @LoginRequired()
 
    @NotAnonymous()
 
    def __before__(self):
 
        super(NotificationsController, self).__before__()
 

	
 
    def index(self, format='html'):
 
        """GET /_admin/notifications: All items in the collection"""
 
        # url('notifications')
 
        c.user = self.rhodecode_user
 
        notif = NotificationModel().get_for_user(self.rhodecode_user.user_id,
 
                                            filter_=request.GET.getall('type'))
 
        p = int(request.params.get('page', 1))
 

	
 
        p = safe_int(request.params.get('page', 1), 1)
 
        c.notifications = Page(notif, page=p, items_per_page=10)
 
        c.pull_request_type = Notification.TYPE_PULL_REQUEST
 
        c.comment_type = [Notification.TYPE_CHANGESET_COMMENT,
 
                          Notification.TYPE_PULL_REQUEST_COMMENT]
 

	
 
        _current_filter = request.GET.getall('type')
 
        c.current_filter = 'all'
 
        if _current_filter == [c.pull_request_type]:
 
            c.current_filter = 'pull_request'
 
        elif _current_filter == c.comment_type:
 
            c.current_filter = 'comment'
 

	
 
        return render('admin/notifications/notifications.html')
 

	
 
    def mark_all_read(self):
 
        if request.environ.get('HTTP_X_PARTIAL_XHR'):
 
            nm = NotificationModel()
 
            # mark all read
 
            nm.mark_all_read_for_user(self.rhodecode_user.user_id,
 
                                      filter_=request.GET.getall('type'))
 
            Session().commit()
 
            c.user = self.rhodecode_user
 
            notif = nm.get_for_user(self.rhodecode_user.user_id,
 
                                    filter_=request.GET.getall('type'))
 
            c.notifications = Page(notif, page=1, items_per_page=10)
 
            return render('admin/notifications/notifications_data.html')
 

	
 
    def create(self):
 
        """POST /_admin/notifications: Create a new item"""
 
        # url('notifications')
 

	
 
    def new(self, format='html'):
 
        """GET /_admin/notifications/new: Form to create a new item"""
 
        # url('new_notification')
 

	
 
    def update(self, notification_id):
 
        """PUT /_admin/notifications/id: Update an existing item"""
 
        # Forms posted to this method should contain a hidden field:
 
        #    <input type="hidden" name="_method" value="PUT" />
 
        # Or using helpers:
 
        #    h.form(url('notification', notification_id=ID),
 
        #           method='put')
 
        # url('notification', notification_id=ID)
 
        try:
 
            no = Notification.get(notification_id)
 
            owner = lambda: (no.notifications_to_users.user.user_id
 
                             == c.rhodecode_user.user_id)
 
            if h.HasPermissionAny('hg.admin')() or owner:
 
                    NotificationModel().mark_read(c.rhodecode_user.user_id, no)
 
                    Session().commit()
 
                    return 'ok'
 
        except Exception:
 
            Session.rollback()
 
            log.error(traceback.format_exc())
 
        return 'fail'
 

	
 
    def delete(self, notification_id):
 
        """DELETE /_admin/notifications/id: Delete an existing item"""
 
        # Forms posted to this method should contain a hidden field:
 
        #    <input type="hidden" name="_method" value="DELETE" />
 
        # Or using helpers:
 
        #    h.form(url('notification', notification_id=ID),
 
        #           method='delete')
 
        # url('notification', notification_id=ID)
 

	
 
        try:
 
            no = Notification.get(notification_id)
 
            owner = lambda: (no.notifications_to_users.user.user_id
 
                             == c.rhodecode_user.user_id)
 
            if h.HasPermissionAny('hg.admin')() or owner:
 
                    NotificationModel().delete(c.rhodecode_user.user_id, no)
 
                    Session().commit()
 
                    return 'ok'
 
        except Exception:
 
            Session.rollback()
 
            log.error(traceback.format_exc())
 
        return 'fail'
 

	
 
    def show(self, notification_id, format='html'):
 
        """GET /_admin/notifications/id: Show a specific item"""
 
        # url('notification', notification_id=ID)
 
        c.user = self.rhodecode_user
 
        no = Notification.get(notification_id)
 

	
 
        owner = lambda: (no.notifications_to_users.user.user_id
 
                         == c.user.user_id)
 
        if no and (h.HasPermissionAny('hg.admin', 'repository.admin')() or owner):
 
            unotification = NotificationModel()\
 
                            .get_user_notification(c.user.user_id, no)
 

	
 
            # if this association to user is not valid, we don't want to show
 
            # this message
 
            if unotification:
 
                if unotification.read is False:
 
                    unotification.mark_as_read()
 
                    Session().commit()
rhodecode/controllers/admin/repos.py
Show inline comments
 
# -*- coding: utf-8 -*-
 
"""
 
    rhodecode.controllers.admin.repos
 
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 

	
 
    Repositories controller for RhodeCode
 

	
 
    :created_on: Apr 7, 2010
 
    :author: marcink
 
    :copyright: (C) 2010-2012 Marcin Kuzminski <marcin@python-works.com>
 
    :license: GPLv3, see COPYING for more details.
 
"""
 
# This program is free software: you can redistribute it and/or modify
 
# it under the terms of the GNU General Public License as published by
 
# the Free Software Foundation, either version 3 of the License, or
 
# (at your option) any later version.
 
#
 
# This program is distributed in the hope that it will be useful,
 
# but WITHOUT ANY WARRANTY; without even the implied warranty of
 
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 
# GNU General Public License for more details.
 
#
 
# You should have received a copy of the GNU General Public License
 
# along with this program.  If not, see <http://www.gnu.org/licenses/>.
 

	
 
import logging
 
import traceback
 
import formencode
 
from formencode import htmlfill
 

	
 
from webob.exc import HTTPInternalServerError
 
from pylons import request, session, tmpl_context as c, url
 
from pylons.controllers.util import redirect
 
from pylons.i18n.translation import _
 
from sqlalchemy.exc import IntegrityError
 

	
 
import rhodecode
 
from rhodecode.lib import helpers as h
 
from rhodecode.lib.auth import LoginRequired, HasPermissionAllDecorator, \
 
    HasPermissionAnyDecorator, HasRepoPermissionAllDecorator
 
from rhodecode.lib.base import BaseController, render
 
from rhodecode.lib.utils import invalidate_cache, action_logger, repo_name_slug
 
from rhodecode.lib.helpers import get_token
 
from rhodecode.model.meta import Session
 
from rhodecode.model.db import User, Repository, UserFollowing, RepoGroup
 
from rhodecode.model.forms import RepoForm
 
from rhodecode.model.scm import ScmModel
 
from rhodecode.model.repo import RepoModel
 
from rhodecode.lib.compat import json
 

	
 
log = logging.getLogger(__name__)
 

	
 

	
 
class ReposController(BaseController):
 
    """
 
    REST Controller styled on the Atom Publishing Protocol"""
 
    # To properly map this controller, ensure your config/routing.py
 
    # file has a resource setup:
 
    #     map.resource('repo', 'repos')
 

	
 
    @LoginRequired()
 
    @HasPermissionAnyDecorator('hg.admin', 'hg.create.repository')
 
    def __before__(self):
 
        c.admin_user = session.get('admin_user')
 
        c.admin_username = session.get('admin_username')
 
        super(ReposController, self).__before__()
 

	
 
    def __load_defaults(self):
 
        c.repo_groups = RepoGroup.groups_choices()
 
        c.repo_groups = RepoGroup.groups_choices(check_perms=True)
 
        c.repo_groups_choices = map(lambda k: unicode(k[0]), c.repo_groups)
 

	
 
        repo_model = RepoModel()
 
        c.users_array = repo_model.get_users_js()
 
        c.users_groups_array = repo_model.get_users_groups_js()
 
        choices, c.landing_revs = ScmModel().get_repo_landing_revs()
 
        c.landing_revs_choices = choices
 

	
 
    def __load_data(self, repo_name=None):
 
        """
 
        Load defaults settings for edit, and update
 

	
 
        :param repo_name:
 
        """
 
        self.__load_defaults()
 

	
 
        c.repo_info = db_repo = Repository.get_by_repo_name(repo_name)
 
        repo = db_repo.scm_instance
 

	
 
        if c.repo_info is None:
 
            h.flash(_('%s repository is not mapped to db perhaps'
 
                      ' it was created or renamed from the filesystem'
 
                      ' please run the application again'
 
                      ' in order to rescan repositories') % repo_name,
 
                      category='error')
 

	
 
            return redirect(url('repos'))
 

	
 
        choices, c.landing_revs = ScmModel().get_repo_landing_revs(c.repo_info)
 
        c.landing_revs_choices = choices
 

	
 
        c.default_user_id = User.get_by_username('default').user_id
 
        c.in_public_journal = UserFollowing.query()\
 
            .filter(UserFollowing.user_id == c.default_user_id)\
 
            .filter(UserFollowing.follows_repository == c.repo_info).scalar()
 

	
 
        if c.repo_info.stats:
 
            # this is on what revision we ended up so we add +1 for count
 
            last_rev = c.repo_info.stats.stat_on_revision + 1
 
        else:
 
            last_rev = 0
 
        c.stats_revision = last_rev
 

	
 
        c.repo_last_rev = repo.count() if repo.revisions else 0
 

	
 
        if last_rev == 0 or c.repo_last_rev == 0:
 
            c.stats_percentage = 0
 
        else:
 
            c.stats_percentage = '%.2f' % ((float((last_rev)) /
 
                                            c.repo_last_rev) * 100)
 

	
 
        defaults = RepoModel()._get_defaults(repo_name)
 

	
 
        c.repos_list = [('', _('--REMOVE FORK--'))]
 
        c.repos_list += [(x.repo_id, x.repo_name) for x in
 
                    Repository.query().order_by(Repository.repo_name).all()
 
                    if x.repo_id != c.repo_info.repo_id]
 

	
 
        defaults['id_fork_of'] = db_repo.fork.repo_id if db_repo.fork else ''
 
        return defaults
 

	
 
    @HasPermissionAllDecorator('hg.admin')
 
    def index(self, format='html'):
 
        """GET /repos: All items in the collection"""
 
        # url('repos')
 

	
 
        c.repos_list = Repository.query()\
 
                        .order_by(Repository.repo_name)\
 
                        .all()
 

	
 
        repos_data = []
 
        total_records = len(c.repos_list)
 

	
 
        _tmpl_lookup = rhodecode.CONFIG['pylons.app_globals'].mako_lookup
 
        template = _tmpl_lookup.get_template('data_table/_dt_elements.html')
 

	
 
        quick_menu = lambda repo_name: (template.get_def("quick_menu")
 
                                        .render(repo_name, _=_, h=h, c=c))
 
        repo_lnk = lambda name, rtype, private, fork_of: (
 
            template.get_def("repo_name")
 
            .render(name, rtype, private, fork_of, short_name=False,
 
                    admin=True, _=_, h=h, c=c))
 

	
 
        repo_actions = lambda repo_name: (template.get_def("repo_actions")
 
                                       .render(repo_name, _=_, h=h, c=c))
 

	
 
        for repo in c.repos_list:
 
            repos_data.append({
 
                "menu": quick_menu(repo.repo_name),
 
                "raw_name": repo.repo_name,
 
                "name": repo_lnk(repo.repo_name, repo.repo_type,
 
                                 repo.private, repo.fork),
 
                "desc": repo.description,
 
                "owner": repo.user.username,
 
                "action": repo_actions(repo.repo_name),
 
            })
rhodecode/controllers/admin/repos_groups.py
Show inline comments
 
@@ -199,119 +199,119 @@ class ReposGroupsController(BaseControll
 

	
 
        try:
 
            ReposGroupModel().delete(id)
 
            Session().commit()
 
            h.flash(_('removed repos group %s') % gr.group_name,
 
                    category='success')
 
            #TODO: in future action_logger(, '', '', '', self.sa)
 
        except IntegrityError, e:
 
            if str(e.message).find('groups_group_parent_id_fkey') != -1:
 
                log.error(traceback.format_exc())
 
                h.flash(_('Cannot delete this group it still contains '
 
                          'subgroups'),
 
                        category='warning')
 
            else:
 
                log.error(traceback.format_exc())
 
                h.flash(_('error occurred during deletion of repos '
 
                          'group %s') % gr.group_name, category='error')
 

	
 
        except Exception:
 
            log.error(traceback.format_exc())
 
            h.flash(_('error occurred during deletion of repos '
 
                      'group %s') % gr.group_name, category='error')
 

	
 
        return redirect(url('repos_groups'))
 

	
 
    @HasReposGroupPermissionAnyDecorator('group.admin')
 
    def delete_repos_group_user_perm(self, group_name):
 
        """
 
        DELETE an existing repositories group permission user
 

	
 
        :param group_name:
 
        """
 
        try:
 
            recursive = str2bool(request.POST.get('recursive', False))
 
            ReposGroupModel().delete_permission(
 
                repos_group=group_name, obj=request.POST['user_id'],
 
                obj_type='user', recursive=recursive
 
            )
 
            Session().commit()
 
        except Exception:
 
            log.error(traceback.format_exc())
 
            h.flash(_('An error occurred during deletion of group user'),
 
                    category='error')
 
            raise HTTPInternalServerError()
 

	
 
    @HasReposGroupPermissionAnyDecorator('group.admin')
 
    def delete_repos_group_users_group_perm(self, group_name):
 
        """
 
        DELETE an existing repositories group permission users group
 

	
 
        :param group_name:
 
        """
 

	
 
        try:
 
            recursive = str2bool(request.POST.get('recursive', False))
 
            ReposGroupModel().delete_permission(
 
                repos_group=group_name, obj=request.POST['users_group_id'],
 
                obj_type='users_group', recursive=recursive
 
            )
 
            Session().commit()
 
        except Exception:
 
            log.error(traceback.format_exc())
 
            h.flash(_('An error occurred during deletion of group'
 
                      ' users groups'),
 
                    category='error')
 
            raise HTTPInternalServerError()
 

	
 
    def show_by_name(self, group_name):
 
        """
 
        This is a proxy that does a lookup group_name -> id, and shows
 
        the group by id view instead
 
        """
 
        group_name = group_name.rstrip('/')
 
        id_ = RepoGroup.get_by_group_name(group_name)
 
        if id_:
 
            return self.show(id_.group_id)
 
        raise HTTPNotFound
 

	
 
    @HasReposGroupPermissionAnyDecorator('group.read', 'group.write',
 
                                         'group.admin')
 
    def show(self, id, format='html'):
 
        """GET /repos_groups/id: Show a specific item"""
 
        # url('repos_group', id=ID)
 

	
 
        c.group = RepoGroup.get_or_404(id)
 

	
 
        c.group_repos = c.group.repositories.all()
 

	
 
        #overwrite our cached list with current filter
 
        gr_filter = c.group_repos
 
        c.cached_repo_list = self.scm_model.get_repos(all_repos=gr_filter)
 

	
 
        c.repos_list = c.cached_repo_list
 

	
 
        c.repo_cnt = 0
 

	
 
        c.groups = RepoGroup.query().order_by(RepoGroup.group_name)\
 
        groups = RepoGroup.query().order_by(RepoGroup.group_name)\
 
            .filter(RepoGroup.group_parent_id == id).all()
 

	
 
        c.groups = self.scm_model.get_repos_groups(groups)
 
        return render('admin/repos_groups/repos_groups.html')
 

	
 
    @HasPermissionAnyDecorator('hg.admin')
 
    def edit(self, id, format='html'):
 
        """GET /repos_groups/id/edit: Form to edit an existing item"""
 
        # url('edit_repos_group', id=ID)
 

	
 
        c.repos_group = ReposGroupModel()._get_repos_group(id)
 
        defaults = self.__load_data(c.repos_group.group_id)
 

	
 
        # we need to exclude this group from the group list for editing
 
        c.repo_groups = filter(lambda x: x[0] != c.repos_group.group_id,
 
                               c.repo_groups)
 

	
 
        return htmlfill.render(
 
            render('admin/repos_groups/repos_groups_edit.html'),
 
            defaults=defaults,
 
            encoding="UTF-8",
 
            force_defaults=False
 
        )
rhodecode/controllers/admin/settings.py
Show inline comments
 
@@ -163,323 +163,340 @@ class SettingsController(BaseController)
 
            except Exception:
 
                log.error(traceback.format_exc())
 
                h.flash(_('error occurred during updating '
 
                          'application settings'),
 
                          category='error')
 

	
 
        if setting_id == 'visual':
 

	
 
            application_form = ApplicationVisualisationForm()()
 
            try:
 
                form_result = application_form.to_python(dict(request.POST))
 
            except formencode.Invalid, errors:
 
                return htmlfill.render(
 
                     render('admin/settings/settings.html'),
 
                     defaults=errors.value,
 
                     errors=errors.error_dict or {},
 
                     prefix_error=False,
 
                     encoding="UTF-8"
 
                )
 

	
 
            try:
 
                sett1 = RhodeCodeSetting.get_by_name_or_create('show_public_icon')
 
                sett1.app_settings_value = \
 
                    form_result['rhodecode_show_public_icon']
 

	
 
                sett2 = RhodeCodeSetting.get_by_name_or_create('show_private_icon')
 
                sett2.app_settings_value = \
 
                    form_result['rhodecode_show_private_icon']
 

	
 
                sett3 = RhodeCodeSetting.get_by_name_or_create('stylify_metatags')
 
                sett3.app_settings_value = \
 
                    form_result['rhodecode_stylify_metatags']
 

	
 
                Session().add(sett1)
 
                Session().add(sett2)
 
                Session().add(sett3)
 
                Session().commit()
 
                set_rhodecode_config(config)
 
                h.flash(_('Updated visualisation settings'),
 
                        category='success')
 

	
 
            except Exception:
 
                log.error(traceback.format_exc())
 
                h.flash(_('error occurred during updating '
 
                          'visualisation settings'),
 
                        category='error')
 

	
 
        if setting_id == 'vcs':
 
            application_form = ApplicationUiSettingsForm()()
 
            try:
 
                form_result = application_form.to_python(dict(request.POST))
 
            except formencode.Invalid, errors:
 
                return htmlfill.render(
 
                     render('admin/settings/settings.html'),
 
                     defaults=errors.value,
 
                     errors=errors.error_dict or {},
 
                     prefix_error=False,
 
                     encoding="UTF-8"
 
                )
 

	
 
            try:
 
                # fix namespaces for hooks and extensions
 
                _f = lambda s: s.replace('.', '_')
 

	
 
                sett = RhodeCodeUi.get_by_key('push_ssl')
 
                sett.ui_value = form_result['web_push_ssl']
 
                Session().add(sett)
 

	
 
                sett = RhodeCodeUi.get_by_key('/')
 
                sett.ui_value = form_result['paths_root_path']
 
                Session().add(sett)
 

	
 
                #HOOKS
 
                sett = RhodeCodeUi.get_by_key(RhodeCodeUi.HOOK_UPDATE)
 
                sett.ui_active = form_result[_f('hooks_%s' %
 
                                                RhodeCodeUi.HOOK_UPDATE)]
 
                Session().add(sett)
 

	
 
                sett = RhodeCodeUi.get_by_key(RhodeCodeUi.HOOK_REPO_SIZE)
 
                sett.ui_active = form_result[_f('hooks_%s' %
 
                                                RhodeCodeUi.HOOK_REPO_SIZE)]
 
                Session().add(sett)
 

	
 
                sett = RhodeCodeUi.get_by_key(RhodeCodeUi.HOOK_PUSH)
 
                sett.ui_active = form_result[_f('hooks_%s' %
 
                                                RhodeCodeUi.HOOK_PUSH)]
 
                Session().add(sett)
 

	
 
                sett = RhodeCodeUi.get_by_key(RhodeCodeUi.HOOK_PULL)
 
                sett.ui_active = form_result[_f('hooks_%s' %
 
                                                 RhodeCodeUi.HOOK_PULL)]
 

	
 
                Session().add(sett)
 

	
 
                ## EXTENSIONS
 
                sett = RhodeCodeUi.get_by_key('largefiles')
 
                if not sett:
 
                    #make one if it's not there !
 
                    sett = RhodeCodeUi()
 
                    sett.ui_key = 'largefiles'
 
                    sett.ui_section = 'extensions'
 
                sett.ui_active = form_result[_f('extensions_largefiles')]
 
                Session().add(sett)
 

	
 
                sett = RhodeCodeUi.get_by_key('hgsubversion')
 
                if not sett:
 
                    #make one if it's not there !
 
                    sett = RhodeCodeUi()
 
                    sett.ui_key = 'hgsubversion'
 
                    sett.ui_section = 'extensions'
 

	
 
                sett.ui_active = form_result[_f('extensions_hgsubversion')]
 
                Session().add(sett)
 

	
 
#                sett = RhodeCodeUi.get_by_key('hggit')
 
#                if not sett:
 
#                    #make one if it's not there !
 
#                    sett = RhodeCodeUi()
 
#                    sett.ui_key = 'hggit'
 
#                    sett.ui_section = 'extensions'
 
#
 
#                sett.ui_active = form_result[_f('extensions_hggit')]
 
#                Session().add(sett)
 

	
 
                Session().commit()
 

	
 
                h.flash(_('Updated VCS settings'), category='success')
 

	
 
            except Exception:
 
                log.error(traceback.format_exc())
 
                h.flash(_('error occurred during updating '
 
                          'application settings'), category='error')
 

	
 
        if setting_id == 'hooks':
 
            ui_key = request.POST.get('new_hook_ui_key')
 
            ui_value = request.POST.get('new_hook_ui_value')
 
            try:
 

	
 
                if ui_value and ui_key:
 
                    RhodeCodeUi.create_or_update_hook(ui_key, ui_value)
 
                    h.flash(_('Added new hook'),
 
                            category='success')
 

	
 
                # check for edits
 
                update = False
 
                _d = request.POST.dict_of_lists()
 
                for k, v in zip(_d.get('hook_ui_key', []),
 
                                _d.get('hook_ui_value_new', [])):
 
                    RhodeCodeUi.create_or_update_hook(k, v)
 
                    update = True
 

	
 
                if update:
 
                    h.flash(_('Updated hooks'), category='success')
 
                Session().commit()
 
            except Exception:
 
                log.error(traceback.format_exc())
 
                h.flash(_('error occurred during hook creation'),
 
                        category='error')
 

	
 
            return redirect(url('admin_edit_setting', setting_id='hooks'))
 

	
 
        if setting_id == 'email':
 
            test_email = request.POST.get('test_email')
 
            test_email_subj = 'RhodeCode TestEmail'
 
            test_email_body = 'RhodeCode Email test'
 

	
 
            test_email_html_body = EmailNotificationModel()\
 
                .get_email_tmpl(EmailNotificationModel.TYPE_DEFAULT,
 
                                body=test_email_body)
 

	
 
            recipients = [test_email] if [test_email] else None
 

	
 
            run_task(tasks.send_email, recipients, test_email_subj,
 
                     test_email_body, test_email_html_body)
 

	
 
            h.flash(_('Email task created'), category='success')
 
        return redirect(url('admin_settings'))
 

	
 
    @HasPermissionAllDecorator('hg.admin')
 
    def delete(self, setting_id):
 
        """DELETE /admin/settings/setting_id: Delete an existing item"""
 
        # Forms posted to this method should contain a hidden field:
 
        #    <input type="hidden" name="_method" value="DELETE" />
 
        # Or using helpers:
 
        #    h.form(url('admin_setting', setting_id=ID),
 
        #           method='delete')
 
        # url('admin_setting', setting_id=ID)
 
        if setting_id == 'hooks':
 
            hook_id = request.POST.get('hook_id')
 
            RhodeCodeUi.delete(hook_id)
 
            Session().commit()
 

	
 
    @HasPermissionAllDecorator('hg.admin')
 
    def show(self, setting_id, format='html'):
 
        """
 
        GET /admin/settings/setting_id: Show a specific item"""
 
        # url('admin_setting', setting_id=ID)
 

	
 
    @HasPermissionAllDecorator('hg.admin')
 
    def edit(self, setting_id, format='html'):
 
        """
 
        GET /admin/settings/setting_id/edit: Form to
 
        edit an existing item"""
 
        # url('admin_edit_setting', setting_id=ID)
 

	
 
        c.hooks = RhodeCodeUi.get_builtin_hooks()
 
        c.custom_hooks = RhodeCodeUi.get_custom_hooks()
 

	
 
        return htmlfill.render(
 
            render('admin/settings/hooks.html'),
 
            defaults={},
 
            encoding="UTF-8",
 
            force_defaults=False
 
        )
 

	
 
    @NotAnonymous()
 
    def my_account(self):
 
        """
 
        GET /_admin/my_account Displays info about my account
 
        """
 
        # url('admin_settings_my_account')
 

	
 
        c.user = User.get(self.rhodecode_user.user_id)
 
        all_repos = Session().query(Repository)\
 
                     .filter(Repository.user_id == c.user.user_id)\
 
                     .order_by(func.lower(Repository.repo_name)).all()
 

	
 
        c.user_repos = ScmModel().get_repos(all_repos)
 

	
 
        if c.user.username == 'default':
 
            h.flash(_("You can't edit this user since it's"
 
              " crucial for entire application"), category='warning')
 
            return redirect(url('users'))
 

	
 
        defaults = c.user.get_dict()
 

	
 
        c.form = htmlfill.render(
 
            render('admin/users/user_edit_my_account_form.html'),
 
            defaults=defaults,
 
            encoding="UTF-8",
 
            force_defaults=False
 
        )
 
        return render('admin/users/user_edit_my_account.html')
 

	
 
    @NotAnonymous()
 
    def my_account_update(self):
 
        """PUT /_admin/my_account_update: Update an existing item"""
 
        # Forms posted to this method should contain a hidden field:
 
        #    <input type="hidden" name="_method" value="PUT" />
 
        # Or using helpers:
 
        #    h.form(url('admin_settings_my_account_update'),
 
        #           method='put')
 
        # url('admin_settings_my_account_update', id=ID)
 
        uid = self.rhodecode_user.user_id
 
        email = self.rhodecode_user.email
 
        _form = UserForm(edit=True,
 
                         old_data={'user_id': uid, 'email': email})()
 
        form_result = {}
 
        try:
 
            form_result = _form.to_python(dict(request.POST))
 
            UserModel().update_my_account(uid, form_result)
 
            h.flash(_('Your account was updated successfully'),
 
                    category='success')
 
            Session().commit()
 
        except formencode.Invalid, errors:
 
            c.user = User.get(self.rhodecode_user.user_id)
 

	
 
            c.form = htmlfill.render(
 
                render('admin/users/user_edit_my_account_form.html'),
 
                defaults=errors.value,
 
                errors=errors.error_dict or {},
 
                prefix_error=False,
 
                encoding="UTF-8")
 
            return render('admin/users/user_edit_my_account.html')
 
        except Exception:
 
            log.error(traceback.format_exc())
 
            h.flash(_('error occurred during update of user %s') \
 
                    % form_result.get('username'), category='error')
 

	
 
        return redirect(url('my_account'))
 

	
 
    @NotAnonymous()
 
    def my_account_my_repos(self):
 
        all_repos = Session().query(Repository)\
 
            .filter(Repository.user_id == self.rhodecode_user.user_id)\
 
            .order_by(func.lower(Repository.repo_name))\
 
            .all()
 
        c.user_repos = ScmModel().get_repos(all_repos)
 
        return render('admin/users/user_edit_my_account_repos.html')
 

	
 
    @NotAnonymous()
 
    def my_account_my_pullrequests(self):
 
        c.my_pull_requests = PullRequest.query()\
 
                                .filter(PullRequest.user_id==
 
                                        self.rhodecode_user.user_id)\
 
                                .all()
 
        c.participate_in_pull_requests = \
 
            [x.pull_request for x in PullRequestReviewers.query()\
 
                                    .filter(PullRequestReviewers.user_id==
 
                                            self.rhodecode_user.user_id)\
 
                                    .all()]
 
        return render('admin/users/user_edit_my_account_pullrequests.html')
 

	
 
    @NotAnonymous()
 
    @HasPermissionAnyDecorator('hg.admin', 'hg.create.repository')
 
    def create_repository(self):
 
        """GET /_admin/create_repository: Form to create a new item"""
 

	
 
        c.repo_groups = RepoGroup.groups_choices()
 
        c.repo_groups = RepoGroup.groups_choices(check_perms=True)
 
        c.repo_groups_choices = map(lambda k: unicode(k[0]), c.repo_groups)
 
        choices, c.landing_revs = ScmModel().get_repo_landing_revs()
 

	
 
        new_repo = request.GET.get('repo', '')
 
        c.new_repo = repo_name_slug(new_repo)
 

	
 
        return render('admin/repos/repo_add_create_repository.html')
 

	
 
    def _get_hg_ui_settings(self):
 
        ret = RhodeCodeUi.query().all()
 

	
 
        if not ret:
 
            raise Exception('Could not get application ui settings !')
 
        settings = {}
 
        for each in ret:
 
            k = each.ui_key
 
            v = each.ui_value
 
            if k == '/':
 
                k = 'root_path'
 

	
 
            if k == 'push_ssl':
 
                v = str2bool(v)
 

	
 
            if k.find('.') != -1:
 
                k = k.replace('.', '_')
 

	
 
            if each.ui_section in ['hooks', 'extensions']:
 
                v = each.ui_active
 

	
 
            settings[each.ui_section + '_' + k] = v
 
        return settings
rhodecode/controllers/changelog.py
Show inline comments
 
# -*- coding: utf-8 -*-
 
"""
 
    rhodecode.controllers.changelog
 
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 

	
 
    changelog controller for rhodecode
 

	
 
    :created_on: Apr 21, 2010
 
    :author: marcink
 
    :copyright: (C) 2010-2012 Marcin Kuzminski <marcin@python-works.com>
 
    :license: GPLv3, see COPYING for more details.
 
"""
 
# This program is free software: you can redistribute it and/or modify
 
# it under the terms of the GNU General Public License as published by
 
# the Free Software Foundation, either version 3 of the License, or
 
# (at your option) any later version.
 
#
 
# This program is distributed in the hope that it will be useful,
 
# but WITHOUT ANY WARRANTY; without even the implied warranty of
 
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 
# GNU General Public License for more details.
 
#
 
# You should have received a copy of the GNU General Public License
 
# along with this program.  If not, see <http://www.gnu.org/licenses/>.
 

	
 
import logging
 
import traceback
 

	
 
from pylons import request, url, session, tmpl_context as c
 
from pylons.controllers.util import redirect
 
from pylons.i18n.translation import _
 

	
 
import rhodecode.lib.helpers as h
 
from rhodecode.lib.auth import LoginRequired, HasRepoPermissionAnyDecorator
 
from rhodecode.lib.base import BaseRepoController, render
 
from rhodecode.lib.helpers import RepoPage
 
from rhodecode.lib.compat import json
 
from rhodecode.lib.graphmod import _colored, _dagwalker
 
from rhodecode.lib.vcs.exceptions import RepositoryError, ChangesetDoesNotExistError
 
from rhodecode.lib.utils2 import safe_int
 

	
 
log = logging.getLogger(__name__)
 

	
 

	
 
class ChangelogController(BaseRepoController):
 

	
 
    @LoginRequired()
 
    @HasRepoPermissionAnyDecorator('repository.read', 'repository.write',
 
                                   'repository.admin')
 
    def __before__(self):
 
        super(ChangelogController, self).__before__()
 
        c.affected_files_cut_off = 60
 

	
 
    def index(self):
 
        limit = 100
 
        default = 20
 
        if request.params.get('size'):
 
            try:
 
                int_size = int(request.params.get('size'))
 
            except ValueError:
 
                int_size = default
 
            c.size = max(min(int_size, limit), 1)
 
            session['changelog_size'] = c.size
 
            session.save()
 
        else:
 
            c.size = int(session.get('changelog_size', default))
 
        # min size must be 1
 
        c.size = max(c.size, 1)
 
        p = int(request.params.get('page', 1))
 
        p = safe_int(request.params.get('page', 1), 1)
 
        branch_name = request.params.get('branch', None)
 
        try:
 
            if branch_name:
 
                collection = [z for z in
 
                              c.rhodecode_repo.get_changesets(start=0,
 
                                                    branch_name=branch_name)]
 
                c.total_cs = len(collection)
 
            else:
 
                collection = c.rhodecode_repo
 
                c.total_cs = len(c.rhodecode_repo)
 

	
 
            c.pagination = RepoPage(collection, page=p, item_count=c.total_cs,
 
                                    items_per_page=c.size, branch=branch_name)
 
            collection = list(c.pagination)
 
            page_revisions = [x.raw_id for x in collection]
 
            c.comments = c.rhodecode_db_repo.get_comments(page_revisions)
 
            c.statuses = c.rhodecode_db_repo.statuses(page_revisions)
 
        except (RepositoryError, ChangesetDoesNotExistError, Exception), e:
 
            log.error(traceback.format_exc())
 
            h.flash(str(e), category='warning')
 
            return redirect(url('home'))
 

	
 
        self._graph(c.rhodecode_repo, collection, c.total_cs, c.size, p)
 

	
 
        c.branch_name = branch_name
 
        c.branch_filters = [('', _('All Branches'))] + \
 
            [(k, k) for k in c.rhodecode_repo.branches.keys()]
 

	
 
        return render('changelog/changelog.html')
 

	
 
    def changelog_details(self, cs):
 
        if request.environ.get('HTTP_X_PARTIAL_XHR'):
 
            c.cs = c.rhodecode_repo.get_changeset(cs)
 
            return render('changelog/changelog_details.html')
 

	
 
    def _graph(self, repo, collection, repo_size, size, p):
 
        """
 
        Generates a DAG graph for mercurial
 

	
 
        :param repo: repo instance
 
        :param size: number of commits to show
 
        :param p: page number
 
        """
 
        if not collection:
 
            c.jsdata = json.dumps([])
 
            return
 

	
 
        data = []
 
        revs = [x.revision for x in collection]
 

	
 
        dag = _dagwalker(repo, revs, repo.alias)
 
        dag = _colored(dag)
 
        for (id, type, ctx, vtx, edges) in dag:
 
            data.append(['', vtx, edges])
 

	
 
        c.jsdata = json.dumps(data)
rhodecode/controllers/compare.py
Show inline comments
 
# -*- coding: utf-8 -*-
 
"""
 
    rhodecode.controllers.compare
 
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 

	
 
    compare controller for pylons showoing differences between two
 
    repos, branches, bookmarks or tips
 

	
 
    :created_on: May 6, 2012
 
    :author: marcink
 
    :copyright: (C) 2010-2012 Marcin Kuzminski <marcin@python-works.com>
 
    :license: GPLv3, see COPYING for more details.
 
"""
 
# This program is free software: you can redistribute it and/or modify
 
# it under the terms of the GNU General Public License as published by
 
# the Free Software Foundation, either version 3 of the License, or
 
# (at your option) any later version.
 
#
 
# This program is distributed in the hope that it will be useful,
 
# but WITHOUT ANY WARRANTY; without even the implied warranty of
 
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 
# GNU General Public License for more details.
 
#
 
# You should have received a copy of the GNU General Public License
 
# along with this program.  If not, see <http://www.gnu.org/licenses/>.
 
import logging
 
import traceback
 

	
 
from webob.exc import HTTPNotFound
 
from pylons import request, response, session, tmpl_context as c, url
 
from pylons.controllers.util import abort, redirect
 
from pylons.i18n.translation import _
 

	
 
from rhodecode.lib.vcs.exceptions import EmptyRepositoryError, RepositoryError
 
from rhodecode.lib import helpers as h
 
from rhodecode.lib.base import BaseRepoController, render
 
from rhodecode.lib.auth import LoginRequired, HasRepoPermissionAnyDecorator
 
from rhodecode.lib import diffs
 

	
 
from rhodecode.model.db import Repository
 
from rhodecode.model.pull_request import PullRequestModel
 
from webob.exc import HTTPBadRequest
 

	
 
log = logging.getLogger(__name__)
 

	
 

	
 
class CompareController(BaseRepoController):
 

	
 
    @LoginRequired()
 
    @HasRepoPermissionAnyDecorator('repository.read', 'repository.write',
 
                                   'repository.admin')
 
    def __before__(self):
 
        super(CompareController, self).__before__()
 

	
 
    def __get_cs_or_redirect(self, rev, repo, redirect_after=True):
 
    def __get_cs_or_redirect(self, rev, repo, redirect_after=True,
 
                             partial=False):
 
        """
 
        Safe way to get changeset if error occur it redirects to changeset with
 
        proper message
 
        proper message. If partial is set then don't do redirect raise Exception
 
        instead
 

	
 
        :param rev: revision to fetch
 
        :param repo: repo instance
 
        """
 

	
 
        try:
 
            type_, rev = rev
 
            return repo.scm_instance.get_changeset(rev)
 
        except EmptyRepositoryError, e:
 
            if not redirect_after:
 
                return None
 
            h.flash(h.literal(_('There are no changesets yet')),
 
                    category='warning')
 
            redirect(url('summary_home', repo_name=repo.repo_name))
 

	
 
        except RepositoryError, e:
 
            log.error(traceback.format_exc())
 
            h.flash(str(e), category='warning')
 
            redirect(h.url('summary_home', repo_name=repo.repo_name))
 
            if not partial:
 
                redirect(h.url('summary_home', repo_name=repo.repo_name))
 
            raise HTTPBadRequest()
 

	
 
    def index(self, org_ref_type, org_ref, other_ref_type, other_ref):
 

	
 
        org_repo = c.rhodecode_db_repo.repo_name
 
        org_ref = (org_ref_type, org_ref)
 
        other_ref = (other_ref_type, other_ref)
 
        other_repo = request.GET.get('repo', org_repo)
 

	
 
        c.swap_url = h.url('compare_url', repo_name=other_repo,
 
              org_ref_type=other_ref[0], org_ref=other_ref[1],
 
              other_ref_type=org_ref[0], other_ref=org_ref[1],
 
              repo=org_repo)
 

	
 
        c.org_repo = org_repo = Repository.get_by_repo_name(org_repo)
 
        c.other_repo = other_repo = Repository.get_by_repo_name(other_repo)
 

	
 
        if c.org_repo is None or c.other_repo is None:
 
            log.error('Could not found repo %s or %s' % (org_repo, other_repo))
 
            raise HTTPNotFound
 

	
 
        if c.org_repo.scm_instance.alias != 'hg':
 
            log.error('Review not available for GIT REPOS')
 
            raise HTTPNotFound
 

	
 
        self.__get_cs_or_redirect(rev=org_ref, repo=org_repo)
 
        self.__get_cs_or_redirect(rev=other_ref, repo=other_repo)
 
        partial = request.environ.get('HTTP_X_PARTIAL_XHR')
 
        self.__get_cs_or_redirect(rev=org_ref, repo=org_repo, partial=partial)
 
        self.__get_cs_or_redirect(rev=other_ref, repo=other_repo, partial=partial)
 

	
 
        c.cs_ranges, discovery_data = PullRequestModel().get_compare_data(
 
                                       org_repo, org_ref, other_repo, other_ref
 
                                      )
 

	
 
        c.statuses = c.rhodecode_db_repo.statuses([x.raw_id for x in
 
                                                   c.cs_ranges])
 
        c.target_repo = c.repo_name
 
        # defines that we need hidden inputs with changesets
 
        c.as_form = request.GET.get('as_form', False)
 
        if request.environ.get('HTTP_X_PARTIAL_XHR'):
 
        if partial:
 
            return render('compare/compare_cs.html')
 

	
 
        c.org_ref = org_ref[1]
 
        c.other_ref = other_ref[1]
 
        # diff needs to have swapped org with other to generate proper diff
 
        _diff = diffs.differ(other_repo, other_ref, org_repo, org_ref,
 
                             discovery_data)
 
        diff_processor = diffs.DiffProcessor(_diff, format='gitdiff')
 
        _parsed = diff_processor.prepare()
 

	
 
        c.files = []
 
        c.changes = {}
 

	
 
        for f in _parsed:
 
            fid = h.FID('', f['filename'])
 
            c.files.append([fid, f['operation'], f['filename'], f['stats']])
 
            diff = diff_processor.as_html(enable_comments=False, diff_lines=[f])
 
            c.changes[fid] = [f['operation'], f['filename'], diff]
 

	
 
        return render('compare/compare_diff.html')
rhodecode/controllers/followers.py
Show inline comments
 
# -*- coding: utf-8 -*-
 
"""
 
    rhodecode.controllers.followers
 
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 

	
 
    Followers controller for rhodecode
 

	
 
    :created_on: Apr 23, 2011
 
    :author: marcink
 
    :copyright: (C) 2011-2012 Marcin Kuzminski <marcin@python-works.com>
 
    :license: GPLv3, see COPYING for more details.
 
"""
 
# This program is free software: you can redistribute it and/or modify
 
# it under the terms of the GNU General Public License as published by
 
# the Free Software Foundation, either version 3 of the License, or
 
# (at your option) any later version.
 
#
 
# This program is distributed in the hope that it will be useful,
 
# but WITHOUT ANY WARRANTY; without even the implied warranty of
 
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 
# GNU General Public License for more details.
 
#
 
# You should have received a copy of the GNU General Public License
 
# along with this program.  If not, see <http://www.gnu.org/licenses/>.
 
import logging
 

	
 
from pylons import tmpl_context as c, request
 

	
 
from rhodecode.lib.helpers import Page
 
from rhodecode.lib.auth import LoginRequired, HasRepoPermissionAnyDecorator
 
from rhodecode.lib.base import BaseRepoController, render
 
from rhodecode.model.db import Repository, User, UserFollowing
 
from rhodecode.lib.utils2 import safe_int
 

	
 
log = logging.getLogger(__name__)
 

	
 

	
 
class FollowersController(BaseRepoController):
 

	
 
    @LoginRequired()
 
    @HasRepoPermissionAnyDecorator('repository.read', 'repository.write',
 
                                   'repository.admin')
 
    def __before__(self):
 
        super(FollowersController, self).__before__()
 

	
 
    def followers(self, repo_name):
 
        p = int(request.params.get('page', 1))
 
        p = safe_int(request.params.get('page', 1), 1)
 
        repo_id = c.rhodecode_db_repo.repo_id
 
        d = UserFollowing.get_repo_followers(repo_id)\
 
            .order_by(UserFollowing.follows_from)
 
        c.followers_pager = Page(d, page=p, items_per_page=20)
 

	
 
        c.followers_data = render('/followers/followers_data.html')
 

	
 
        if request.environ.get('HTTP_X_PARTIAL_XHR'):
 
            return c.followers_data
 

	
 
        return render('/followers/followers.html')
rhodecode/controllers/forks.py
Show inline comments
 
# -*- coding: utf-8 -*-
 
"""
 
    rhodecode.controllers.forks
 
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 

	
 
    forks controller for rhodecode
 

	
 
    :created_on: Apr 23, 2011
 
    :author: marcink
 
    :copyright: (C) 2011-2012 Marcin Kuzminski <marcin@python-works.com>
 
    :license: GPLv3, see COPYING for more details.
 
"""
 
# This program is free software: you can redistribute it and/or modify
 
# it under the terms of the GNU General Public License as published by
 
# the Free Software Foundation, either version 3 of the License, or
 
# (at your option) any later version.
 
#
 
# This program is distributed in the hope that it will be useful,
 
# but WITHOUT ANY WARRANTY; without even the implied warranty of
 
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 
# GNU General Public License for more details.
 
#
 
# You should have received a copy of the GNU General Public License
 
# along with this program.  If not, see <http://www.gnu.org/licenses/>.
 
import logging
 
import formencode
 
import traceback
 
from formencode import htmlfill
 

	
 
from pylons import tmpl_context as c, request, url
 
from pylons.controllers.util import redirect
 
from pylons.i18n.translation import _
 

	
 
import rhodecode.lib.helpers as h
 

	
 
from rhodecode.lib.helpers import Page
 
from rhodecode.lib.auth import LoginRequired, HasRepoPermissionAnyDecorator, \
 
    NotAnonymous, HasRepoPermissionAny, HasPermissionAllDecorator,\
 
    HasPermissionAnyDecorator
 
from rhodecode.lib.base import BaseRepoController, render
 
from rhodecode.model.db import Repository, RepoGroup, UserFollowing, User
 
from rhodecode.model.repo import RepoModel
 
from rhodecode.model.forms import RepoForkForm
 
from rhodecode.model.scm import ScmModel
 
from rhodecode.lib.utils2 import safe_int
 

	
 
log = logging.getLogger(__name__)
 

	
 

	
 
class ForksController(BaseRepoController):
 

	
 
    @LoginRequired()
 
    def __before__(self):
 
        super(ForksController, self).__before__()
 

	
 
    def __load_defaults(self):
 
        c.repo_groups = RepoGroup.groups_choices()
 
        c.repo_groups = RepoGroup.groups_choices(check_perms=True)
 
        c.repo_groups_choices = map(lambda k: unicode(k[0]), c.repo_groups)
 
        choices, c.landing_revs = ScmModel().get_repo_landing_revs()
 
        c.landing_revs_choices = choices
 

	
 
    def __load_data(self, repo_name=None):
 
        """
 
        Load defaults settings for edit, and update
 

	
 
        :param repo_name:
 
        """
 
        self.__load_defaults()
 

	
 
        c.repo_info = db_repo = Repository.get_by_repo_name(repo_name)
 
        repo = db_repo.scm_instance
 

	
 
        if c.repo_info is None:
 
            h.flash(_('%s repository is not mapped to db perhaps'
 
                      ' it was created or renamed from the filesystem'
 
                      ' please run the application again'
 
                      ' in order to rescan repositories') % repo_name,
 
                      category='error')
 

	
 
            return redirect(url('repos'))
 

	
 
        c.default_user_id = User.get_by_username('default').user_id
 
        c.in_public_journal = UserFollowing.query()\
 
            .filter(UserFollowing.user_id == c.default_user_id)\
 
            .filter(UserFollowing.follows_repository == c.repo_info).scalar()
 

	
 
        if c.repo_info.stats:
 
            last_rev = c.repo_info.stats.stat_on_revision+1
 
        else:
 
            last_rev = 0
 
        c.stats_revision = last_rev
 

	
 
        c.repo_last_rev = repo.count() if repo.revisions else 0
 

	
 
        if last_rev == 0 or c.repo_last_rev == 0:
 
            c.stats_percentage = 0
 
        else:
 
            c.stats_percentage = '%.2f' % ((float((last_rev)) /
 
                                            c.repo_last_rev) * 100)
 

	
 
        defaults = RepoModel()._get_defaults(repo_name)
 
        # add prefix to fork
 
        defaults['repo_name'] = 'fork-' + defaults['repo_name']
 
        return defaults
 

	
 
    @HasRepoPermissionAnyDecorator('repository.read', 'repository.write',
 
                                   'repository.admin')
 
    def forks(self, repo_name):
 
        p = int(request.params.get('page', 1))
 
        p = safe_int(request.params.get('page', 1), 1)
 
        repo_id = c.rhodecode_db_repo.repo_id
 
        d = []
 
        for r in Repository.get_repo_forks(repo_id):
 
            if not HasRepoPermissionAny(
 
                'repository.read', 'repository.write', 'repository.admin'
 
            )(r.repo_name, 'get forks check'):
 
                continue
 
            d.append(r)
 
        c.forks_pager = Page(d, page=p, items_per_page=20)
 

	
 
        c.forks_data = render('/forks/forks_data.html')
 

	
 
        if request.environ.get('HTTP_X_PARTIAL_XHR'):
 
            return c.forks_data
 

	
 
        return render('/forks/forks.html')
 

	
 
    @NotAnonymous()
 
    @HasPermissionAnyDecorator('hg.admin', 'hg.fork.repository')
 
    @HasRepoPermissionAnyDecorator('repository.read', 'repository.write',
 
                                   'repository.admin')
 
    def fork(self, repo_name):
 
        c.repo_info = Repository.get_by_repo_name(repo_name)
 
        if not c.repo_info:
 
            h.flash(_('%s repository is not mapped to db perhaps'
 
                      ' it was created or renamed from the file system'
 
                      ' please run the application again'
 
                      ' in order to rescan repositories') % repo_name,
 
                      category='error')
 

	
 
            return redirect(url('home'))
 

	
 
        defaults = self.__load_data(repo_name)
 

	
 
        return htmlfill.render(
 
            render('forks/fork.html'),
 
            defaults=defaults,
 
            encoding="UTF-8",
 
            force_defaults=False
 
        )
 

	
 
    @NotAnonymous()
 
    @HasPermissionAnyDecorator('hg.admin', 'hg.fork.repository')
 
    @HasRepoPermissionAnyDecorator('repository.read', 'repository.write',
 
                                   'repository.admin')
 
    def fork_create(self, repo_name):
 
        self.__load_defaults()
 
        c.repo_info = Repository.get_by_repo_name(repo_name)
 
        _form = RepoForkForm(old_data={'repo_type': c.repo_info.repo_type},
 
                             repo_groups=c.repo_groups_choices,
 
                             landing_revs=c.landing_revs_choices)()
 
        form_result = {}
 
        try:
 
            form_result = _form.to_python(dict(request.POST))
 

	
 
            # create fork is done sometimes async on celery, db transaction
 
            # management is handled there.
 
            RepoModel().create_fork(form_result, self.rhodecode_user.user_id)
 
            h.flash(_('forked %s repository as %s') \
 
                      % (repo_name, form_result['repo_name']),
 
                    category='success')
 
        except formencode.Invalid, errors:
 
            c.new_repo = errors.value['repo_name']
 

	
 
            return htmlfill.render(
 
                render('forks/fork.html'),
 
                defaults=errors.value,
 
                errors=errors.error_dict or {},
 
                prefix_error=False,
 
                encoding="UTF-8")
 
        except Exception:
 
            log.error(traceback.format_exc())
 
            h.flash(_('An error occurred during repository forking %s') %
 
                    repo_name, category='error')
 

	
 
        return redirect(url('home'))
rhodecode/controllers/journal.py
Show inline comments
 
# -*- coding: utf-8 -*-
 
"""
 
    rhodecode.controllers.journal
 
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 

	
 
    Journal controller for pylons
 

	
 
    :created_on: Nov 21, 2010
 
    :author: marcink
 
    :copyright: (C) 2010-2012 Marcin Kuzminski <marcin@python-works.com>
 
    :license: GPLv3, see COPYING for more details.
 
"""
 
# This program is free software: you can redistribute it and/or modify
 
# it under the terms of the GNU General Public License as published by
 
# the Free Software Foundation, either version 3 of the License, or
 
# (at your option) any later version.
 
#
 
# This program is distributed in the hope that it will be useful,
 
# but WITHOUT ANY WARRANTY; without even the implied warranty of
 
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 
# GNU General Public License for more details.
 
#
 
# You should have received a copy of the GNU General Public License
 
# along with this program.  If not, see <http://www.gnu.org/licenses/>.
 
import logging
 
from itertools import groupby
 

	
 
from sqlalchemy import or_
 
from sqlalchemy.orm import joinedload
 
from webhelpers.paginate import Page
 
from webhelpers.feedgenerator import Atom1Feed, Rss201rev2Feed
 

	
 
from webob.exc import HTTPBadRequest
 
from pylons import request, tmpl_context as c, response, url
 
from pylons.i18n.translation import _
 

	
 
import rhodecode.lib.helpers as h
 
from rhodecode.lib.auth import LoginRequired, NotAnonymous
 
from rhodecode.lib.base import BaseController, render
 
from rhodecode.model.db import UserLog, UserFollowing, Repository, User
 
from rhodecode.model.meta import Session
 
from sqlalchemy.sql.expression import func
 
from rhodecode.model.scm import ScmModel
 
from rhodecode.lib.utils2 import safe_int
 

	
 
log = logging.getLogger(__name__)
 

	
 

	
 
class JournalController(BaseController):
 

	
 
    def __before__(self):
 
        super(JournalController, self).__before__()
 
        self.language = 'en-us'
 
        self.ttl = "5"
 
        self.feed_nr = 20
 

	
 
    @LoginRequired()
 
    @NotAnonymous()
 
    def index(self):
 
        # Return a rendered template
 
        p = int(request.params.get('page', 1))
 
        p = safe_int(request.params.get('page', 1), 1)
 

	
 
        c.user = User.get(self.rhodecode_user.user_id)
 
        all_repos = self.sa.query(Repository)\
 
                     .filter(Repository.user_id == c.user.user_id)\
 
                     .order_by(func.lower(Repository.repo_name)).all()
 

	
 
        c.user_repos = ScmModel().get_repos(all_repos)
 

	
 
        c.following = self.sa.query(UserFollowing)\
 
            .filter(UserFollowing.user_id == self.rhodecode_user.user_id)\
 
            .options(joinedload(UserFollowing.follows_repository))\
 
            .all()
 

	
 
        journal = self._get_journal_data(c.following)
 

	
 
        c.journal_pager = Page(journal, page=p, items_per_page=20)
 

	
 
        c.journal_day_aggreagate = self._get_daily_aggregate(c.journal_pager)
 

	
 
        c.journal_data = render('journal/journal_data.html')
 
        if request.environ.get('HTTP_X_PARTIAL_XHR'):
 
            return c.journal_data
 
        return render('journal/journal.html')
 

	
 
    @LoginRequired(api_access=True)
 
    @NotAnonymous()
 
    def journal_atom(self):
 
        """
 
        Produce an atom-1.0 feed via feedgenerator module
 
        """
 
        following = self.sa.query(UserFollowing)\
 
            .filter(UserFollowing.user_id == self.rhodecode_user.user_id)\
 
            .options(joinedload(UserFollowing.follows_repository))\
 
            .all()
 
        return self._atom_feed(following, public=False)
 

	
 
    @LoginRequired(api_access=True)
 
    @NotAnonymous()
 
    def journal_rss(self):
 
        """
 
        Produce an rss feed via feedgenerator module
 
        """
 
        following = self.sa.query(UserFollowing)\
 
            .filter(UserFollowing.user_id == self.rhodecode_user.user_id)\
 
            .options(joinedload(UserFollowing.follows_repository))\
 
            .all()
 
        return self._rss_feed(following, public=False)
 

	
 
    def _get_daily_aggregate(self, journal):
 
        groups = []
 
        for k, g in groupby(journal, lambda x: x.action_as_day):
 
            user_group = []
 
            for k2, g2 in groupby(list(g), lambda x: x.user.email):
 
                l = list(g2)
 
                user_group.append((l[0].user, l))
 

	
 
            groups.append((k, user_group,))
 

	
 
        return groups
 

	
 
    def _get_journal_data(self, following_repos):
 
        repo_ids = [x.follows_repository.repo_id for x in following_repos
 
                    if x.follows_repository is not None]
 
        user_ids = [x.follows_user.user_id for x in following_repos
 
                    if x.follows_user is not None]
 

	
 
        filtering_criterion = None
 

	
 
        if repo_ids and user_ids:
 
            filtering_criterion = or_(UserLog.repository_id.in_(repo_ids),
 
                        UserLog.user_id.in_(user_ids))
 
        if repo_ids and not user_ids:
 
            filtering_criterion = UserLog.repository_id.in_(repo_ids)
 
        if not repo_ids and user_ids:
 
            filtering_criterion = UserLog.user_id.in_(user_ids)
 
        if filtering_criterion is not None:
 
            journal = self.sa.query(UserLog)\
 
                .options(joinedload(UserLog.user))\
 
                .options(joinedload(UserLog.repository))\
 
                .filter(filtering_criterion)\
 
                .order_by(UserLog.action_date.desc())
 
        else:
 
            journal = []
 

	
 
        return journal
 

	
 
    @LoginRequired()
 
    @NotAnonymous()
 
    def toggle_following(self):
 
        cur_token = request.POST.get('auth_token')
 
        token = h.get_token()
 
        if cur_token == token:
 

	
 
            user_id = request.POST.get('follows_user_id')
 
            if user_id:
 
                try:
 
                    self.scm_model.toggle_following_user(user_id,
 
                                                self.rhodecode_user.user_id)
 
                    Session.commit()
 
                    return 'ok'
 
                except:
 
                    raise HTTPBadRequest()
 

	
 
            repo_id = request.POST.get('follows_repo_id')
 
            if repo_id:
 
                try:
 
                    self.scm_model.toggle_following_repo(repo_id,
 
                                                self.rhodecode_user.user_id)
 
                    Session.commit()
 
                    return 'ok'
 
                except:
 
                    raise HTTPBadRequest()
 

	
 
        log.debug('token mismatch %s vs %s' % (cur_token, token))
 
        raise HTTPBadRequest()
 

	
 
    @LoginRequired()
 
    def public_journal(self):
 
        # Return a rendered template
 
        p = int(request.params.get('page', 1))
 
        p = safe_int(request.params.get('page', 1), 1)
 

	
 
        c.following = self.sa.query(UserFollowing)\
 
            .filter(UserFollowing.user_id == self.rhodecode_user.user_id)\
 
            .options(joinedload(UserFollowing.follows_repository))\
 
            .all()
 

	
 
        journal = self._get_journal_data(c.following)
 

	
 
        c.journal_pager = Page(journal, page=p, items_per_page=20)
 

	
 
        c.journal_day_aggreagate = self._get_daily_aggregate(c.journal_pager)
 

	
 
        c.journal_data = render('journal/journal_data.html')
 
        if request.environ.get('HTTP_X_PARTIAL_XHR'):
 
            return c.journal_data
 
        return render('journal/public_journal.html')
 

	
 
    def _atom_feed(self, repos, public=True):
 
        journal = self._get_journal_data(repos)
 
        if public:
 
            _link = url('public_journal_atom', qualified=True)
 
            _desc = '%s %s %s' % (c.rhodecode_name, _('public journal'),
 
                                  'atom feed')
 
        else:
 
            _link = url('journal_atom', qualified=True)
 
            _desc = '%s %s %s' % (c.rhodecode_name, _('journal'), 'atom feed')
 

	
 
        feed = Atom1Feed(title=_desc,
 
                         link=_link,
 
                         description=_desc,
 
                         language=self.language,
 
                         ttl=self.ttl)
 

	
 
        for entry in journal[:self.feed_nr]:
 
            action, action_extra, ico = h.action_parser(entry, feed=True)
 
            title = "%s - %s %s" % (entry.user.short_contact, action(),
 
                                 entry.repository.repo_name)
 
            desc = action_extra()
 
            _url = None
 
            if entry.repository is not None:
 
                _url = url('changelog_home',
 
                           repo_name=entry.repository.repo_name,
 
                           qualified=True)
 

	
 
            feed.add_item(title=title,
 
                          pubdate=entry.action_date,
 
                          link=_url or url('', qualified=True),
 
                          author_email=entry.user.email,
 
                          author_name=entry.user.full_contact,
 
                          description=desc)
 

	
 
        response.content_type = feed.mime_type
 
        return feed.writeString('utf-8')
 

	
 
    def _rss_feed(self, repos, public=True):
 
        journal = self._get_journal_data(repos)
 
        if public:
 
            _link = url('public_journal_atom', qualified=True)
 
            _desc = '%s %s %s' % (c.rhodecode_name, _('public journal'),
 
                                  'rss feed')
 
        else:
 
            _link = url('journal_atom', qualified=True)
 
            _desc = '%s %s %s' % (c.rhodecode_name, _('journal'), 'rss feed')
 

	
 
        feed = Rss201rev2Feed(title=_desc,
 
                         link=_link,
 
                         description=_desc,
 
                         language=self.language,
 
                         ttl=self.ttl)
 

	
 
        for entry in journal[:self.feed_nr]:
 
            action, action_extra, ico = h.action_parser(entry, feed=True)
 
            title = "%s - %s %s" % (entry.user.short_contact, action(),
 
                                 entry.repository.repo_name)
 
            desc = action_extra()
 
            _url = None
 
            if entry.repository is not None:
 
                _url = url('changelog_home',
 
                           repo_name=entry.repository.repo_name,
 
                           qualified=True)
 

	
 
            feed.add_item(title=title,
 
                          pubdate=entry.action_date,
 
                          link=_url or url('', qualified=True),
 
                          author_email=entry.user.email,
 
                          author_name=entry.user.full_contact,
 
                          description=desc)
 

	
 
        response.content_type = feed.mime_type
 
        return feed.writeString('utf-8')
 

	
 
    @LoginRequired(api_access=True)
 
    def public_journal_atom(self):
 
        """
 
        Produce an atom-1.0 feed via feedgenerator module
 
        """
rhodecode/controllers/pullrequests.py
Show inline comments
 
# -*- coding: utf-8 -*-
 
"""
 
    rhodecode.controllers.pullrequests
 
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 

	
 
    pull requests controller for rhodecode for initializing pull requests
 

	
 
    :created_on: May 7, 2012
 
    :author: marcink
 
    :copyright: (C) 2010-2012 Marcin Kuzminski <marcin@python-works.com>
 
    :license: GPLv3, see COPYING for more details.
 
"""
 
# This program is free software: you can redistribute it and/or modify
 
# it under the terms of the GNU General Public License as published by
 
# the Free Software Foundation, either version 3 of the License, or
 
# (at your option) any later version.
 
#
 
# This program is distributed in the hope that it will be useful,
 
# but WITHOUT ANY WARRANTY; without even the implied warranty of
 
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 
# GNU General Public License for more details.
 
#
 
# You should have received a copy of the GNU General Public License
 
# along with this program.  If not, see <http://www.gnu.org/licenses/>.
 
import logging
 
import traceback
 
import formencode
 

	
 
from webob.exc import HTTPNotFound, HTTPForbidden
 
from collections import defaultdict
 
from itertools import groupby
 

	
 
from pylons import request, response, session, tmpl_context as c, url
 
from pylons.controllers.util import abort, redirect
 
from pylons.i18n.translation import _
 
from pylons.decorators import jsonify
 

	
 
from rhodecode.lib.compat import json
 
from rhodecode.lib.base import BaseRepoController, render
 
from rhodecode.lib.auth import LoginRequired, HasRepoPermissionAnyDecorator,\
 
    NotAnonymous
 
from rhodecode.lib import helpers as h
 
from rhodecode.lib import diffs
 
from rhodecode.lib.utils import action_logger
 
from rhodecode.model.db import User, PullRequest, ChangesetStatus,\
 
    ChangesetComment
 
from rhodecode.model.pull_request import PullRequestModel
 
from rhodecode.model.meta import Session
 
from rhodecode.model.repo import RepoModel
 
from rhodecode.model.comment import ChangesetCommentsModel
 
from rhodecode.model.changeset_status import ChangesetStatusModel
 
from rhodecode.model.forms import PullRequestForm
 

	
 
log = logging.getLogger(__name__)
 

	
 

	
 
class PullrequestsController(BaseRepoController):
 

	
 
    @LoginRequired()
 
    @HasRepoPermissionAnyDecorator('repository.read', 'repository.write',
 
                                   'repository.admin')
 
    def __before__(self):
 
        super(PullrequestsController, self).__before__()
 
        repo_model = RepoModel()
 
        c.users_array = repo_model.get_users_js()
 
        c.users_groups_array = repo_model.get_users_groups_js()
 

	
 
    def _get_repo_refs(self, repo):
 
        hist_l = []
 

	
 
        branches_group = ([('branch:%s:%s' % (k, v), k) for
 
                         k, v in repo.branches.iteritems()], _("Branches"))
 
        bookmarks_group = ([('book:%s:%s' % (k, v), k) for
 
                         k, v in repo.bookmarks.iteritems()], _("Bookmarks"))
 
        tags_group = ([('tag:%s:%s' % (k, v), k) for
 
                         k, v in repo.tags.iteritems()], _("Tags"))
 

	
 
        hist_l.append(bookmarks_group)
 
        hist_l.append(branches_group)
 
        hist_l.append(tags_group)
 

	
 
        return hist_l
 

	
 
    def _get_default_rev(self, repo):
 
        """
 
        Get's default revision to do compare on pull request
 

	
 
        :param repo:
 
        """
 
        repo = repo.scm_instance
 
        if 'default' in repo.branches:
 
            return 'default'
 
        else:
 
            #if repo doesn't have default branch return first found
 
            return repo.branches.keys()[0]
 

	
 
    def show_all(self, repo_name):
 
        c.pull_requests = PullRequestModel().get_all(repo_name)
 
        c.repo_name = repo_name
 
        return render('/pullrequests/pullrequest_show_all.html')
 

	
 
    @NotAnonymous()
 
    def index(self):
 
        org_repo = c.rhodecode_db_repo
 

	
 
        if org_repo.scm_instance.alias != 'hg':
 
            log.error('Review not available for GIT REPOS')
 
            raise HTTPNotFound
 

	
 
        other_repos_info = {}
 

	
 
        c.org_refs = self._get_repo_refs(c.rhodecode_repo)
 
        c.org_repos = []
 
        c.other_repos = []
 
        c.org_repos.append((org_repo.repo_name, '%s/%s' % (
 
                                org_repo.user.username, c.repo_name))
 
                           )
 

	
 
        # add org repo to other so we can open pull request agains itself
 
        c.other_repos.extend(c.org_repos)
 

	
 
        c.default_pull_request = org_repo.repo_name
 
        c.default_pull_request = org_repo.repo_name  # repo name pre-selected
 
        c.default_pull_request_rev = self._get_default_rev(org_repo)  # revision pre-selected
 
        c.default_revs = self._get_repo_refs(org_repo.scm_instance)
 
        #add orginal repo
 
        other_repos_info[org_repo.repo_name] = {
 
            'gravatar': h.gravatar_url(org_repo.user.email, 24),
 
            'description': org_repo.description,
 
            'revs': h.select('other_ref', '', c.default_revs, class_='refs')
 
        }
 

	
 
        #gather forks and add to this list
 
        for fork in org_repo.forks:
 
            c.other_repos.append((fork.repo_name, '%s/%s' % (
 
                                    fork.user.username, fork.repo_name))
 
                                 )
 
            other_repos_info[fork.repo_name] = {
 
                'gravatar': h.gravatar_url(fork.user.email, 24),
 
                'description': fork.description,
 
                'revs': h.select('other_ref', '',
 
                                 self._get_repo_refs(fork.scm_instance),
 
                                 class_='refs')
 
            }
 
        #add parents of this fork also
 
        if org_repo.parent:
 
            c.default_pull_request = org_repo.parent.repo_name
 
            c.default_pull_request_rev = self._get_default_rev(org_repo.parent)
 
            c.default_revs = self._get_repo_refs(org_repo.parent.scm_instance)
 
            c.other_repos.append((org_repo.parent.repo_name, '%s/%s' % (
 
                                        org_repo.parent.user.username,
 
                                        org_repo.parent.repo_name))
 
                                     )
 
            other_repos_info[org_repo.parent.repo_name] = {
 
                'gravatar': h.gravatar_url(org_repo.parent.user.email, 24),
 
                'description': org_repo.parent.description,
 
                'revs': h.select('other_ref', '',
 
                                 self._get_repo_refs(org_repo.parent.scm_instance),
 
                                 class_='refs')
 
            }
 

	
 
        c.other_repos_info = json.dumps(other_repos_info)
 
        c.review_members = [org_repo.user]
 
        return render('/pullrequests/pullrequest.html')
 

	
 
    @NotAnonymous()
 
    def create(self, repo_name):
 
        try:
 
            _form = PullRequestForm()().to_python(request.POST)
 
        except formencode.Invalid, errors:
 
            log.error(traceback.format_exc())
 
            if errors.error_dict.get('revisions'):
 
                msg = 'Revisions: %s' % errors.error_dict['revisions']
 
            elif errors.error_dict.get('pullrequest_title'):
 
                msg = _('Pull request requires a title with min. 3 chars')
 
            else:
 
                msg = _('error during creation of pull request')
 

	
 
            h.flash(msg, 'error')
 
            return redirect(url('pullrequest_home', repo_name=repo_name))
 

	
 
        org_repo = _form['org_repo']
 
        org_ref = _form['org_ref']
 
        other_repo = _form['other_repo']
 
        other_ref = _form['other_ref']
 
        revisions = _form['revisions']
 
        reviewers = _form['review_members']
 

	
 
        title = _form['pullrequest_title']
 
        description = _form['pullrequest_desc']
 

	
 
        try:
 
            pull_request = PullRequestModel().create(
 
                self.rhodecode_user.user_id, org_repo, org_ref, other_repo,
 
                other_ref, revisions, reviewers, title, description
 
            )
 
            Session().commit()
 
            h.flash(_('Successfully opened new pull request'),
 
                    category='success')
 
        except Exception:
 
            h.flash(_('Error occurred during sending pull request'),
 
                    category='error')
 
            log.error(traceback.format_exc())
 
            return redirect(url('pullrequest_home', repo_name=repo_name))
 

	
 
        return redirect(url('pullrequest_show', repo_name=other_repo,
 
                            pull_request_id=pull_request.pull_request_id))
 

	
 
    @NotAnonymous()
 
    @jsonify
 
    def update(self, repo_name, pull_request_id):
 
        pull_request = PullRequest.get_or_404(pull_request_id)
 
        if pull_request.is_closed():
 
            raise HTTPForbidden()
 
        #only owner or admin can update it
 
        owner = pull_request.author.user_id == c.rhodecode_user.user_id
 
        if h.HasPermissionAny('hg.admin', 'repository.admin')() or owner:
 
            reviewers_ids = map(int, filter(lambda v: v not in [None, ''],
 
                       request.POST.get('reviewers_ids', '').split(',')))
 

	
 
            PullRequestModel().update_reviewers(pull_request_id, reviewers_ids)
 
            Session.commit()
 
            return True
 
        raise HTTPForbidden()
 

	
 
    @NotAnonymous()
 
    @jsonify
 
    def delete(self, repo_name, pull_request_id):
 
        pull_request = PullRequest.get_or_404(pull_request_id)
 
        #only owner can delete it !
 
        if pull_request.author.user_id == c.rhodecode_user.user_id:
 
            PullRequestModel().delete(pull_request)
 
            Session().commit()
 
            h.flash(_('Successfully deleted pull request'),
 
                    category='success')
 
            return redirect(url('admin_settings_my_account'))
 
        raise HTTPForbidden()
 

	
 
    def _load_compare_data(self, pull_request, enable_comments=True):
 
        """
 
        Load context data needed for generating compare diff
 

	
 
        :param pull_request:
 
        :type pull_request:
 
        """
rhodecode/controllers/search.py
Show inline comments
 
# -*- coding: utf-8 -*-
 
"""
 
    rhodecode.controllers.search
 
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 

	
 
    Search controller for RhodeCode
 

	
 
    :created_on: Aug 7, 2010
 
    :author: marcink
 
    :copyright: (C) 2010-2012 Marcin Kuzminski <marcin@python-works.com>
 
    :license: GPLv3, see COPYING for more details.
 
"""
 
# This program is free software: you can redistribute it and/or modify
 
# it under the terms of the GNU General Public License as published by
 
# the Free Software Foundation, either version 3 of the License, or
 
# (at your option) any later version.
 
#
 
# This program is distributed in the hope that it will be useful,
 
# but WITHOUT ANY WARRANTY; without even the implied warranty of
 
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 
# GNU General Public License for more details.
 
#
 
# You should have received a copy of the GNU General Public License
 
# along with this program.  If not, see <http://www.gnu.org/licenses/>.
 
import logging
 
import traceback
 

	
 
from pylons.i18n.translation import _
 
from pylons import request, config, tmpl_context as c
 

	
 
from rhodecode.lib.auth import LoginRequired
 
from rhodecode.lib.base import BaseController, render
 
from rhodecode.lib.indexers import CHGSETS_SCHEMA, SCHEMA, CHGSET_IDX_NAME, \
 
    IDX_NAME, WhooshResultWrapper
 

	
 
from webhelpers.paginate import Page
 
from webhelpers.util import update_params
 

	
 
from whoosh.index import open_dir, EmptyIndexError
 
from whoosh.qparser import QueryParser, QueryParserError
 
from whoosh.query import Phrase, Wildcard, Term, Prefix
 
from rhodecode.model.repo import RepoModel
 
from rhodecode.lib.utils2 import safe_str, safe_int
 

	
 
log = logging.getLogger(__name__)
 

	
 

	
 
class SearchController(BaseController):
 

	
 
    @LoginRequired()
 
    def __before__(self):
 
        super(SearchController, self).__before__()
 

	
 
    def index(self, search_repo=None):
 
        c.repo_name = search_repo
 
        c.formated_results = []
 
        c.runtime = ''
 
        c.cur_query = request.GET.get('q', None)
 
        c.cur_type = request.GET.get('type', 'content')
 
        c.cur_search = search_type = {'content': 'content',
 
                                      'commit': 'message',
 
                                      'path': 'path',
 
                                      'repository': 'repository'
 
                                      }.get(c.cur_type, 'content')
 

	
 
        index_name = {
 
            'content': IDX_NAME,
 
            'commit': CHGSET_IDX_NAME,
 
            'path': IDX_NAME
 
        }.get(c.cur_type, IDX_NAME)
 

	
 
        schema_defn = {
 
            'content': SCHEMA,
 
            'commit': CHGSETS_SCHEMA,
 
            'path': SCHEMA
 
        }.get(c.cur_type, SCHEMA)
 

	
 
        log.debug('IDX: %s' % index_name)
 
        log.debug('SCHEMA: %s' % schema_defn)
 

	
 
        if c.cur_query:
 
            cur_query = c.cur_query.lower()
 
            log.debug(cur_query)
 

	
 
        if c.cur_query:
 
            p = int(request.params.get('page', 1))
 
            p = safe_int(request.params.get('page', 1), 1)
 
            highlight_items = set()
 
            try:
 
                idx = open_dir(config['app_conf']['index_dir'],
 
                               indexname=index_name)
 
                searcher = idx.searcher()
 

	
 
                qp = QueryParser(search_type, schema=schema_defn)
 
                if c.repo_name:
 
                    cur_query = u'repository:%s %s' % (c.repo_name, cur_query)
 
                try:
 
                    query = qp.parse(unicode(cur_query))
 
                    # extract words for highlight
 
                    if isinstance(query, Phrase):
 
                        highlight_items.update(query.words)
 
                    elif isinstance(query, Prefix):
 
                        highlight_items.add(query.text)
 
                    else:
 
                        for i in query.all_terms():
 
                            if i[0] in ['content', 'message']:
 
                                highlight_items.add(i[1])
 

	
 
                    matcher = query.matcher(searcher)
 

	
 
                    log.debug('query: %s' % query)
 
                    log.debug('hl terms: %s' % highlight_items)
 
                    results = searcher.search(query)
 
                    res_ln = len(results)
 
                    c.runtime = '%s results (%.3f seconds)' % (
 
                        res_ln, results.runtime
 
                    )
 

	
 
                    def url_generator(**kw):
 
                        return update_params("?q=%s&type=%s" \
 
                                           % (c.cur_query, c.cur_type), **kw)
 
                        % (safe_str(c.cur_query), safe_str(c.cur_type)), **kw)
 
                    repo_location = RepoModel().repos_path
 
                    c.formated_results = Page(
 
                        WhooshResultWrapper(search_type, searcher, matcher,
 
                                            highlight_items, repo_location),
 
                        page=p,
 
                        item_count=res_ln,
 
                        items_per_page=10,
 
                        url=url_generator
 
                    )
 

	
 
                except QueryParserError:
 
                    c.runtime = _('Invalid search query. Try quoting it.')
 
                searcher.close()
 
            except (EmptyIndexError, IOError):
 
                log.error(traceback.format_exc())
 
                log.error('Empty Index data')
 
                c.runtime = _('There is no index to search in. '
 
                              'Please run whoosh indexer')
 
            except (Exception):
 
                log.error(traceback.format_exc())
 
                c.runtime = _('An error occurred during this search operation')
 

	
 
        # Return a rendered template
 
        return render('/search/search.html')
rhodecode/controllers/settings.py
Show inline comments
 
# -*- coding: utf-8 -*-
 
"""
 
    rhodecode.controllers.settings
 
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 

	
 
    Settings controller for rhodecode
 

	
 
    :created_on: Jun 30, 2010
 
    :author: marcink
 
    :copyright: (C) 2010-2012 Marcin Kuzminski <marcin@python-works.com>
 
    :license: GPLv3, see COPYING for more details.
 
"""
 
# This program is free software: you can redistribute it and/or modify
 
# it under the terms of the GNU General Public License as published by
 
# the Free Software Foundation, either version 3 of the License, or
 
# (at your option) any later version.
 
#
 
# This program is distributed in the hope that it will be useful,
 
# but WITHOUT ANY WARRANTY; without even the implied warranty of
 
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 
# GNU General Public License for more details.
 
#
 
# You should have received a copy of the GNU General Public License
 
# along with this program.  If not, see <http://www.gnu.org/licenses/>.
 

	
 
import logging
 
import traceback
 
import formencode
 

	
 
from formencode import htmlfill
 

	
 
from pylons import tmpl_context as c, request, url
 
from pylons.controllers.util import redirect
 
from pylons.i18n.translation import _
 

	
 
import rhodecode.lib.helpers as h
 

	
 
from rhodecode.lib.auth import LoginRequired, HasRepoPermissionAllDecorator
 
from rhodecode.lib.auth import LoginRequired, HasRepoPermissionAllDecorator,\
 
    HasRepoPermissionAnyDecorator
 
from rhodecode.lib.base import BaseRepoController, render
 
from rhodecode.lib.utils import invalidate_cache, action_logger
 

	
 
from rhodecode.model.forms import RepoSettingsForm
 
from rhodecode.model.repo import RepoModel
 
from rhodecode.model.db import RepoGroup
 
from rhodecode.model.db import RepoGroup, Repository
 
from rhodecode.model.meta import Session
 
from rhodecode.model.scm import ScmModel
 

	
 
log = logging.getLogger(__name__)
 

	
 

	
 
class SettingsController(BaseRepoController):
 

	
 
    @LoginRequired()
 
    def __before__(self):
 
        super(SettingsController, self).__before__()
 

	
 
    def __load_defaults(self):
 
        c.repo_groups = RepoGroup.groups_choices()
 
        c.repo_groups = RepoGroup.groups_choices(check_perms=True)
 
        c.repo_groups_choices = map(lambda k: unicode(k[0]), c.repo_groups)
 

	
 
        repo_model = RepoModel()
 
        c.users_array = repo_model.get_users_js()
 
        c.users_groups_array = repo_model.get_users_groups_js()
 
        choices, c.landing_revs = ScmModel().get_repo_landing_revs()
 
        c.landing_revs_choices = choices
 

	
 
    @HasRepoPermissionAllDecorator('repository.admin')
 
    def index(self, repo_name):
 
        repo_model = RepoModel()
 
        c.repo_info = repo = repo_model.get_by_repo_name(repo_name)
 
        if not repo:
 
            h.flash(_('%s repository is not mapped to db perhaps'
 
                      ' it was created or renamed from the file system'
 
                      ' please run the application again'
 
                      ' in order to rescan repositories') % repo_name,
 
                      category='error')
 

	
 
            return redirect(url('home'))
 

	
 
        self.__load_defaults()
 

	
 
        defaults = RepoModel()._get_defaults(repo_name)
 

	
 
        return htmlfill.render(
 
            render('settings/repo_settings.html'),
 
            defaults=defaults,
 
            encoding="UTF-8",
 
            force_defaults=False
 
        )
 

	
 
    @HasRepoPermissionAllDecorator('repository.admin')
 
    def update(self, repo_name):
 
        repo_model = RepoModel()
 
        changed_name = repo_name
 

	
 
        self.__load_defaults()
 

	
 
        _form = RepoSettingsForm(edit=True,
 
                                 old_data={'repo_name': repo_name},
 
                                 repo_groups=c.repo_groups_choices,
 
                                 landing_revs=c.landing_revs_choices)()
 
        try:
 
            form_result = _form.to_python(dict(request.POST))
 

	
 
            repo_model.update(repo_name, form_result)
 
            invalidate_cache('get_repo_cached_%s' % repo_name)
 
            h.flash(_('Repository %s updated successfully') % repo_name,
 
                    category='success')
 
            changed_name = form_result['repo_name_full']
 
            action_logger(self.rhodecode_user, 'user_updated_repo',
 
                          changed_name, self.ip_addr, self.sa)
 
            Session.commit()
 
            Session().commit()
 
        except formencode.Invalid, errors:
 
            c.repo_info = repo_model.get_by_repo_name(repo_name)
 
            c.users_array = repo_model.get_users_js()
 
            errors.value.update({'user': c.repo_info.user.username})
 
            return htmlfill.render(
 
                render('settings/repo_settings.html'),
 
                defaults=errors.value,
 
                errors=errors.error_dict or {},
 
                prefix_error=False,
 
                encoding="UTF-8")
 
        except Exception:
 
            log.error(traceback.format_exc())
 
            h.flash(_('error occurred during update of repository %s') \
 
                    % repo_name, category='error')
 

	
 
        return redirect(url('repo_settings_home', repo_name=changed_name))
 

	
 
    @HasRepoPermissionAllDecorator('repository.admin')
 
    def delete(self, repo_name):
 
        """DELETE /repos/repo_name: Delete an existing item"""
 
        # Forms posted to this method should contain a hidden field:
 
        #    <input type="hidden" name="_method" value="DELETE" />
 
        # Or using helpers:
 
        #    h.form(url('repo_settings_delete', repo_name=ID),
 
        #           method='delete')
 
        # url('repo_settings_delete', repo_name=ID)
 

	
 
        repo_model = RepoModel()
 
        repo = repo_model.get_by_repo_name(repo_name)
 
        if not repo:
 
            h.flash(_('%s repository is not mapped to db perhaps'
 
                      ' it was moved or renamed  from the filesystem'
 
                      ' please run the application again'
 
                      ' in order to rescan repositories') % repo_name,
 
                      category='error')
 

	
 
            return redirect(url('home'))
 
        try:
 
            action_logger(self.rhodecode_user, 'user_deleted_repo',
 
                              repo_name, self.ip_addr, self.sa)
 
            repo_model.delete(repo)
 
            invalidate_cache('get_repo_cached_%s' % repo_name)
 
            h.flash(_('deleted repository %s') % repo_name, category='success')
 
            Session.commit()
 
            Session().commit()
 
        except Exception:
 
            log.error(traceback.format_exc())
 
            h.flash(_('An error occurred during deletion of %s') % repo_name,
 
                    category='error')
 

	
 
        return redirect(url('home'))
 

	
 
    @HasRepoPermissionAnyDecorator('repository.write', 'repository.admin')
 
    def toggle_locking(self, repo_name):
 
        """
 
        Toggle locking of repository by simple GET call to url
 

	
 
        :param repo_name:
 
        """
 

	
 
        try:
 
            repo = Repository.get_by_repo_name(repo_name)
 

	
 
            if repo.enable_locking:
 
                if repo.locked[0]:
 
                    Repository.unlock(repo)
 
                    action = _('unlocked')
 
                else:
 
                    Repository.lock(repo, c.rhodecode_user.user_id)
 
                    action = _('locked')
 

	
 
                h.flash(_('Repository has been %s') % action,
 
                        category='success')
 
        except Exception, e:
 
            log.error(traceback.format_exc())
 
            h.flash(_('An error occurred during unlocking'),
 
                    category='error')
 
        return redirect(url('summary_home', repo_name=repo_name))
 

	
rhodecode/controllers/shortlog.py
Show inline comments
 
# -*- coding: utf-8 -*-
 
"""
 
    rhodecode.controllers.shortlog
 
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 

	
 
    Shortlog controller for rhodecode
 

	
 
    :created_on: Apr 18, 2010
 
    :author: marcink
 
    :copyright: (C) 2010-2012 Marcin Kuzminski <marcin@python-works.com>
 
    :license: GPLv3, see COPYING for more details.
 
"""
 
# This program is free software: you can redistribute it and/or modify
 
# it under the terms of the GNU General Public License as published by
 
# the Free Software Foundation, either version 3 of the License, or
 
# (at your option) any later version.
 
#
 
# This program is distributed in the hope that it will be useful,
 
# but WITHOUT ANY WARRANTY; without even the implied warranty of
 
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 
# GNU General Public License for more details.
 
#
 
# You should have received a copy of the GNU General Public License
 
# along with this program.  If not, see <http://www.gnu.org/licenses/>.
 

	
 
import logging
 

	
 
from pylons import tmpl_context as c, request, url
 

	
 
from rhodecode.lib.auth import LoginRequired, HasRepoPermissionAnyDecorator
 
from rhodecode.lib.base import BaseRepoController, render
 
from rhodecode.lib.helpers import RepoPage
 
from pylons.controllers.util import redirect
 
from rhodecode.lib.utils2 import safe_int
 

	
 
log = logging.getLogger(__name__)
 

	
 

	
 
class ShortlogController(BaseRepoController):
 

	
 
    @LoginRequired()
 
    @HasRepoPermissionAnyDecorator('repository.read', 'repository.write',
 
                                   'repository.admin')
 
    def __before__(self):
 
        super(ShortlogController, self).__before__()
 

	
 
    def index(self, repo_name):
 
        p = int(request.params.get('page', 1))
 
        size = int(request.params.get('size', 20))
 
        p = safe_int(request.params.get('page', 1), 1)
 
        size = safe_int(request.params.get('size', 20), 20)
 

	
 
        def url_generator(**kw):
 
            return url('shortlog_home', repo_name=repo_name, size=size, **kw)
 

	
 
        c.repo_changesets = RepoPage(c.rhodecode_repo, page=p,
 
                                    items_per_page=size, url=url_generator)
 

	
 
        if not c.repo_changesets:
 
            return redirect(url('summary_home', repo_name=repo_name))
 

	
 
        c.shortlog_data = render('shortlog/shortlog_data.html')
 
        if request.environ.get('HTTP_X_PARTIAL_XHR'):
 
            return c.shortlog_data
 
        r = render('shortlog/shortlog.html')
 
        return r
rhodecode/i18n/zh_CN/LC_MESSAGES/rhodecode.mo
Show inline comments
 
binary diff not shown
rhodecode/i18n/zh_CN/LC_MESSAGES/rhodecode.po
Show inline comments
 
# Chinese (China) translations for RhodeCode.
 
# Copyright (C) 2011 ORGANIZATION
 
# This file is distributed under the same license as the RhodeCode project.
 
# FIRST AUTHOR <EMAIL@ADDRESS>, 2011.
 
# mikespook <mikespook@gmail.com>, 2012.
 
# xpol <xpolife@gmail.com>, 2012.
 
msgid ""
 
msgstr ""
 
"Project-Id-Version: RhodeCode 1.2.0\n"
 
"Report-Msgid-Bugs-To: EMAIL@ADDRESS\n"
 
"POT-Creation-Date: 2012-09-02 20:30+0200\n"
 
"PO-Revision-Date: 2012-04-05 17:37+0800\n"
 
"Last-Translator: mikespook <mikespook@gmail.com>\n"
 
"PO-Revision-Date: 2012-09-19 13:27+0800\n"
 
"Last-Translator: xpol <xpolife@gmail.com>\n"
 
"Language-Team: mikespook\n"
 
"Plural-Forms: nplurals=1; plural=0\n"
 
"Plural-Forms: nplurals=1; plural=0;\n"
 
"MIME-Version: 1.0\n"
 
"Content-Type: text/plain; charset=utf-8\n"
 
"Content-Type: text/plain; charset=UTF-8\n"
 
"Content-Transfer-Encoding: 8bit\n"
 
"Generated-By: Babel 0.9.6\n"
 
"X-Generator: Poedit 1.5.3\n"
 
"X-Poedit-Basepath: E:\\home\\rhodecode\n"
 
"X-Poedit-SourceCharset: UTF-8\n"
 

	
 
#: rhodecode/controllers/changelog.py:94
 
#, fuzzy
 
msgid "All Branches"
 
msgstr "分支"
 
msgstr "所有分支"
 

	
 
#: rhodecode/controllers/changeset.py:83
 
msgid "show white space"
 
msgstr ""
 
msgstr "显示空白字符"
 

	
 
#: rhodecode/controllers/changeset.py:90 rhodecode/controllers/changeset.py:97
 
msgid "ignore white space"
 
msgstr ""
 
msgstr "忽略空白字符"
 

	
 
#: rhodecode/controllers/changeset.py:157
 
#, fuzzy, python-format
 
#, python-format
 
msgid "%s line context"
 
msgstr "文件内容"
 
msgstr "%s 行上下文"
 

	
 
#: rhodecode/controllers/changeset.py:333
 
#: rhodecode/controllers/changeset.py:348 rhodecode/lib/diffs.py:70
 
msgid "binary file"
 
msgstr "二进制文件"
 

	
 
#: rhodecode/controllers/changeset.py:408
 
msgid ""
 
"Changing status on a changeset associated witha closed pull request is "
 
"not allowed"
 
msgstr ""
 
"Changing status on a changeset associated witha closed pull request is not "
 
"allowed"
 
msgstr "不允许修改已关闭拉取请求的修订集状态"
 

	
 
#: rhodecode/controllers/compare.py:69
 
#, fuzzy
 
msgid "There are no changesets yet"
 
msgstr "没有任何变更"
 
msgstr "还没有修订集"
 

	
 
#: rhodecode/controllers/error.py:69
 
msgid "Home page"
 
msgstr "主页"
 

	
 
#: rhodecode/controllers/error.py:98
 
msgid "The request could not be understood by the server due to malformed syntax."
 
msgid ""
 
"The request could not be understood by the server due to malformed syntax."
 
msgstr "由于错误的语法,服务器无法对请求进行响应。"
 

	
 
#: rhodecode/controllers/error.py:101
 
msgid "Unauthorized access to resource"
 
msgstr "未授权的资源访问"
 

	
 
#: rhodecode/controllers/error.py:103
 
msgid "You don't have permission to view this page"
 
msgstr "无权访问该页面"
 

	
 
#: rhodecode/controllers/error.py:105
 
msgid "The resource could not be found"
 
msgstr "资源未找到"
 

	
 
#: rhodecode/controllers/error.py:107
 
msgid ""
 
"The server encountered an unexpected condition which prevented it from "
 
"fulfilling the request."
 
msgstr "服务进入非预期的混乱状态,这会阻止它对请求进行响应。"
 

	
 
#: rhodecode/controllers/feed.py:49
 
#, python-format
 
msgid "Changes on %s repository"
 
msgstr "%s 库的修改"
 

	
 
#: rhodecode/controllers/feed.py:50
 
#, python-format
 
msgid "%s %s feed"
 
msgstr "%s %s 订阅"
 

	
 
#: rhodecode/controllers/feed.py:75
 
#, fuzzy
 
msgid "commited on"
 
msgstr "提交"
 
msgstr "提交于"
 

	
 
#: rhodecode/controllers/files.py:84
 
#, fuzzy
 
msgid "click here to add new file"
 
msgstr "添加新用户"
 
msgstr "点击此处添加新文件"
 

	
 
#: rhodecode/controllers/files.py:85
 
#, fuzzy, python-format
 
#, python-format
 
msgid "There are no files yet %s"
 
msgstr "尚无文件"
 
msgstr "还没有文件 %s"
 

	
 
#: rhodecode/controllers/files.py:239 rhodecode/controllers/files.py:299
 
#, python-format
 
msgid "This repository is has been locked by %s on %s"
 
msgstr ""
 
msgstr "版本库由 %s 于 %s 锁定"
 

	
 
#: rhodecode/controllers/files.py:266
 
#, python-format
 
msgid "Edited %s via RhodeCode"
 
msgstr "通过 RhodeCode 修改了 %s"
 

	
 
#: rhodecode/controllers/files.py:271
 
msgid "No changes"
 
msgstr "无变更"
 

	
 
#: rhodecode/controllers/files.py:282 rhodecode/controllers/files.py:346
 
#, python-format
 
msgid "Successfully committed to %s"
 
msgstr "成功提交到 %s"
 

	
 
#: rhodecode/controllers/files.py:287 rhodecode/controllers/files.py:352
 
msgid "Error occurred during commit"
 
msgstr "提交时发生错误"
 

	
 
#: rhodecode/controllers/files.py:318
 
#, fuzzy, python-format
 
#, python-format
 
msgid "Added %s via RhodeCode"
 
msgstr "通过 RhodeCode 修改了 %s"
 
msgstr "通过 RhodeCode 添加了 %s"
 

	
 
#: rhodecode/controllers/files.py:332
 
#, fuzzy
 
msgid "No content"
 
msgstr "文件内容"
 
msgstr "无内容"
 

	
 
#: rhodecode/controllers/files.py:336
 
#, fuzzy
 
msgid "No filename"
 
msgstr "文件名"
 
msgstr "无文件名"
 

	
 
#: rhodecode/controllers/files.py:378
 
msgid "downloads disabled"
 
msgstr "禁止下载"
 

	
 
#: rhodecode/controllers/files.py:389
 
#, python-format
 
msgid "Unknown revision %s"
 
msgstr "未知版本 %s"
 

	
 
#: rhodecode/controllers/files.py:391
 
msgid "Empty repository"
 
msgstr "空版本库"
 

	
 
#: rhodecode/controllers/files.py:393
 
msgid "Unknown archive type"
 
msgstr "未知包类型"
 

	
 
#: rhodecode/controllers/files.py:494
 
#: rhodecode/templates/changeset/changeset_range.html:13
 
#: rhodecode/templates/changeset/changeset_range.html:31
 
msgid "Changesets"
 
msgstr "变更集"
 
msgstr "修订集"
 

	
 
#: rhodecode/controllers/files.py:495 rhodecode/controllers/pullrequests.py:72
 
#: rhodecode/controllers/summary.py:232 rhodecode/model/scm.py:543
 
msgid "Branches"
 
msgstr "分支"
 

	
 
#: rhodecode/controllers/files.py:496 rhodecode/controllers/pullrequests.py:76
 
#: rhodecode/controllers/summary.py:233 rhodecode/model/scm.py:554
 
msgid "Tags"
 
msgstr "标签"
 

	
 
#: rhodecode/controllers/forks.py:73 rhodecode/controllers/admin/repos.py:90
 
#, python-format
 
msgid ""
 
"%s repository is not mapped to db perhaps it was created or renamed from "
 
"the filesystem please run the application again in order to rescan "
 
"repositories"
 
"%s repository is not mapped to db perhaps it was created or renamed from the "
 
"filesystem please run the application again in order to rescan repositories"
 
msgstr ""
 
"版本库 %s 没有映射到数据库,可能是从文件系统创建或者重命名,请重启 RhodeCode "
 
"以重新扫描版本库"
 

	
 
#: rhodecode/controllers/forks.py:133 rhodecode/controllers/settings.py:72
 
#, python-format
 
msgid ""
 
"%s repository is not mapped to db perhaps it was created or renamed from "
 
"the file system please run the application again in order to rescan "
 
"repositories"
 
"%s repository is not mapped to db perhaps it was created or renamed from the "
 
"file system please run the application again in order to rescan repositories"
 
msgstr ""
 
" 版本库 %s 没有映射到数据库,可能是从文件系统创建或者重命名,请重启 "
 
"RhodeCode 以重新扫描版本库"
 

	
 
#: rhodecode/controllers/forks.py:167
 
#, python-format
 
msgid "forked %s repository as %s"
 
msgstr "版本库 %s 被分支到 %s"
 

	
 
#: rhodecode/controllers/forks.py:181
 
#, python-format
 
msgid "An error occurred during repository forking %s"
 
msgstr ""
 
msgstr "在分支版本库 %s 的时候发生错误"
 

	
 
#: rhodecode/controllers/journal.py:202 rhodecode/controllers/journal.py:239
 
#, fuzzy
 
msgid "public journal"
 
msgstr "公共日志"
 

	
 
#: rhodecode/controllers/journal.py:206 rhodecode/controllers/journal.py:243
 
#: rhodecode/templates/base/base.html:220
 
msgid "journal"
 
msgstr "日志"
 

	
 
#: rhodecode/controllers/login.py:143
 
msgid "You have successfully registered into rhodecode"
 
msgstr "成功注册到 rhodecode"
 

	
 
#: rhodecode/controllers/login.py:164
 
msgid "Your password reset link was sent"
 
msgstr "密码重置链接已经发送"
 

	
 
#: rhodecode/controllers/login.py:184
 
msgid ""
 
"Your password reset was successful, new password has been sent to your "
 
"email"
 
"Your password reset was successful, new password has been sent to your email"
 
msgstr "密码已经成功重置,新密码已经发送到你的邮箱"
 

	
 
#: rhodecode/controllers/pullrequests.py:74 rhodecode/model/scm.py:549
 
msgid "Bookmarks"
 
msgstr ""
 
msgstr "书签"
 

	
 
#: rhodecode/controllers/pullrequests.py:158
 
msgid "Pull request requires a title with min. 3 chars"
 
msgstr ""
 
msgstr "拉取请求的标题至少 3 个字符"
 

	
 
#: rhodecode/controllers/pullrequests.py:160
 
#, fuzzy
 
msgid "error during creation of pull request"
 
msgstr "提交时发生错误"
 
msgstr "提交拉取请求时发生错误"
 

	
 
#: rhodecode/controllers/pullrequests.py:181
 
#, fuzzy
 
msgid "Successfully opened new pull request"
 
msgstr "用户删除成功"
 
msgstr "成功提交拉取请求"
 

	
 
#: rhodecode/controllers/pullrequests.py:184
 
#, fuzzy
 
msgid "Error occurred during sending pull request"
 
msgstr "提交时发生错误"
 
msgstr "提交拉取请求时发生错误"
 

	
 
#: rhodecode/controllers/pullrequests.py:217
 
#, fuzzy
 
msgid "Successfully deleted pull request"
 
msgstr "用户删除成功"
 
msgstr "成功删除拉取请求"
 

	
 
#: rhodecode/controllers/search.py:131
 
msgid "Invalid search query. Try quoting it."
 
msgstr "错误的搜索。请尝试用引号包含它。"
 

	
 
#: rhodecode/controllers/search.py:136
 
msgid "There is no index to search in. Please run whoosh indexer"
 
msgstr "没有索引用于搜索。请运行 whoosh 索引器"
 

	
 
#: rhodecode/controllers/search.py:140
 
msgid "An error occurred during this search operation"
 
msgstr "在搜索操作中发生异常"
 

	
 
#: rhodecode/controllers/settings.py:107
 
#: rhodecode/controllers/admin/repos.py:266
 
#, python-format
 
msgid "Repository %s updated successfully"
 
msgstr "版本库 %s 成功更新"
 

	
 
#: rhodecode/controllers/settings.py:125
 
#: rhodecode/controllers/admin/repos.py:284
 
#, python-format
 
msgid "error occurred during update of repository %s"
 
msgstr ""
 
msgstr "在更新版本库 %s 的时候发生错误"
 

	
 
#: rhodecode/controllers/settings.py:143
 
#: rhodecode/controllers/admin/repos.py:302
 
#, python-format
 
msgid ""
 
"%s repository is not mapped to db perhaps it was moved or renamed  from "
 
"the filesystem please run the application again in order to rescan "
 
"repositories"
 
"%s repository is not mapped to db perhaps it was moved or renamed  from the "
 
"filesystem please run the application again in order to rescan repositories"
 
msgstr ""
 
"版本库 %s 没有映射到数据库,可能是从文件系统创建或者重命名,请重启 RhodeCode "
 
"以重新扫描版本库"
 

	
 
#: rhodecode/controllers/settings.py:155
 
#: rhodecode/controllers/admin/repos.py:314
 
#, python-format
 
msgid "deleted repository %s"
 
msgstr "已经删除版本库 %s"
 

	
 
#: rhodecode/controllers/settings.py:159
 
#: rhodecode/controllers/admin/repos.py:324
 
#: rhodecode/controllers/admin/repos.py:330
 
#, python-format
 
msgid "An error occurred during deletion of %s"
 
msgstr ""
 
msgstr "在删除 %s 的时候发生错误"
 

	
 
#: rhodecode/controllers/summary.py:138
 
msgid "No data loaded yet"
 
msgstr ""
 
msgstr "数据未加载"
 

	
 
#: rhodecode/controllers/summary.py:142
 
#: rhodecode/templates/summary/summary.html:148
 
msgid "Statistics are disabled for this repository"
 
msgstr "该版本库统计功能已经禁用"
 

	
 
#: rhodecode/controllers/admin/ldap_settings.py:50
 
msgid "BASE"
 
msgstr ""
 
msgstr "BASE"
 

	
 
#: rhodecode/controllers/admin/ldap_settings.py:51
 
msgid "ONELEVEL"
 
msgstr ""
 
msgstr "ONELEVEL"
 

	
 
#: rhodecode/controllers/admin/ldap_settings.py:52
 
msgid "SUBTREE"
 
msgstr ""
 
msgstr "SUBTREE"
 

	
 
#: rhodecode/controllers/admin/ldap_settings.py:56
 
msgid "NEVER"
 
msgstr ""
 
msgstr "NEVER"
 

	
 
#: rhodecode/controllers/admin/ldap_settings.py:57
 
msgid "ALLOW"
 
msgstr ""
 
msgstr "ALLOW"
 

	
 
#: rhodecode/controllers/admin/ldap_settings.py:58
 
msgid "TRY"
 
msgstr ""
 
msgstr "TRY"
 

	
 
#: rhodecode/controllers/admin/ldap_settings.py:59
 
msgid "DEMAND"
 
msgstr ""
 
msgstr "DEMAND"
 

	
 
#: rhodecode/controllers/admin/ldap_settings.py:60
 
msgid "HARD"
 
msgstr ""
 
msgstr "HARD"
 

	
 
#: rhodecode/controllers/admin/ldap_settings.py:64
 
msgid "No encryption"
 
msgstr "未加密"
 

	
 
#: rhodecode/controllers/admin/ldap_settings.py:65
 
msgid "LDAPS connection"
 
msgstr ""
 
msgstr "LDAPS 连接"
 

	
 
#: rhodecode/controllers/admin/ldap_settings.py:66
 
msgid "START_TLS on LDAP connection"
 
msgstr ""
 
msgstr "LDAP 连接上的 START_TLS"
 

	
 
#: rhodecode/controllers/admin/ldap_settings.py:126
 
msgid "Ldap settings updated successfully"
 
msgstr "LDAP 设置已经成功更新"
 

	
 
#: rhodecode/controllers/admin/ldap_settings.py:130
 
msgid "Unable to activate ldap. The \"python-ldap\" library is missing."
 
msgstr "无法启用 LDAP。“python-ldap”缺失。"
 
msgstr "无法启用 LDAP。缺失“python-ldap”。"
 

	
 
#: rhodecode/controllers/admin/ldap_settings.py:147
 
msgid "error occurred during update of ldap settings"
 
msgstr ""
 
msgstr "更新 LDAP 设置时发生错误"
 

	
 
#: rhodecode/controllers/admin/permissions.py:59
 
msgid "None"
 
msgstr "无"
 

	
 
#: rhodecode/controllers/admin/permissions.py:60
 
msgid "Read"
 
msgstr "读"
 

	
 
#: rhodecode/controllers/admin/permissions.py:61
 
msgid "Write"
 
msgstr "写"
 

	
 
#: rhodecode/controllers/admin/permissions.py:62
 
#: rhodecode/templates/admin/ldap/ldap.html:9
 
#: rhodecode/templates/admin/permissions/permissions.html:9
 
#: rhodecode/templates/admin/repos/repo_add.html:9
 
#: rhodecode/templates/admin/repos/repo_edit.html:9
 
#: rhodecode/templates/admin/repos/repos.html:9
 
#: rhodecode/templates/admin/repos_groups/repos_groups_add.html:8
 
#: rhodecode/templates/admin/repos_groups/repos_groups_edit.html:8
 
#: rhodecode/templates/admin/repos_groups/repos_groups_show.html:10
 
#: rhodecode/templates/admin/settings/hooks.html:9
 
#: rhodecode/templates/admin/settings/settings.html:9
 
#: rhodecode/templates/admin/users/user_add.html:8
 
#: rhodecode/templates/admin/users/user_edit.html:9
 
#: rhodecode/templates/admin/users/user_edit.html:122
 
#: rhodecode/templates/admin/users/users.html:9
 
#: rhodecode/templates/admin/users_groups/users_group_add.html:8
 
#: rhodecode/templates/admin/users_groups/users_group_edit.html:9
 
#: rhodecode/templates/admin/users_groups/users_groups.html:9
 
#: rhodecode/templates/base/base.html:197
 
#: rhodecode/templates/base/base.html:337
 
#: rhodecode/templates/base/base.html:339
 
#: rhodecode/templates/base/base.html:341
 
msgid "Admin"
 
msgstr "管理"
 

	
 
#: rhodecode/controllers/admin/permissions.py:65
 
msgid "disabled"
 
msgstr "禁用"
 

	
 
#: rhodecode/controllers/admin/permissions.py:67
 
msgid "allowed with manual account activation"
 
msgstr "允许手工启用帐号"
 

	
 
#: rhodecode/controllers/admin/permissions.py:69
 
msgid "allowed with automatic account activation"
 
msgstr "允许自动启用帐号"
 

	
 
#: rhodecode/controllers/admin/permissions.py:71
 
#: rhodecode/controllers/admin/permissions.py:74
 
msgid "Disabled"
 
msgstr "停用"
 

	
 
#: rhodecode/controllers/admin/permissions.py:72
 
#: rhodecode/controllers/admin/permissions.py:75
 
msgid "Enabled"
 
msgstr "启用"
 

	
 
#: rhodecode/controllers/admin/permissions.py:116
 
msgid "Default permissions updated successfully"
 
msgstr "成功更新默认权限"
 

	
 
#: rhodecode/controllers/admin/permissions.py:130
 
msgid "error occurred during update of permissions"
 
msgstr ""
 
msgstr "更新权限时发生错误"
 

	
 
#: rhodecode/controllers/admin/repos.py:123
 
msgid "--REMOVE FORK--"
 
msgstr ""
 
msgstr "-- 移除分支 --"
 

	
 
#: rhodecode/controllers/admin/repos.py:192
 
#, python-format
 
msgid "created repository %s from %s"
 
msgstr "新版本库 %s 基于 %s 建立。"
 

	
 
#: rhodecode/controllers/admin/repos.py:196
 
#, python-format
 
msgid "created repository %s"
 
msgstr "建立版本库 %s"
 

	
 
#: rhodecode/controllers/admin/repos.py:227
 
#, python-format
 
msgid "error occurred during creation of repository %s"
 
msgstr ""
 
msgstr "创建版本库时发生错误 %s"
 

	
 
#: rhodecode/controllers/admin/repos.py:319
 
#, python-format
 
msgid "Cannot delete %s it still contains attached forks"
 
msgstr ""
 
msgstr "无法删除 %s 因为它还有其他分支版本库"
 

	
 
#: rhodecode/controllers/admin/repos.py:348
 
msgid "An error occurred during deletion of repository user"
 
msgstr ""
 
msgstr "删除版本库用户时发生错误"
 

	
 
#: rhodecode/controllers/admin/repos.py:367
 
msgid "An error occurred during deletion of repository users groups"
 
msgstr ""
 
msgstr "删除版本库用户组时发生错误"
 

	
 
#: rhodecode/controllers/admin/repos.py:385
 
msgid "An error occurred during deletion of repository stats"
 
msgstr ""
 
msgstr "删除版本库统计时发生错误"
 

	
 
#: rhodecode/controllers/admin/repos.py:402
 
msgid "An error occurred during cache invalidation"
 
msgstr ""
 
msgstr "清除缓存时发生错误"
 

	
 
#: rhodecode/controllers/admin/repos.py:422
 
#, fuzzy
 
msgid "An error occurred during unlocking"
 
msgstr "在搜索操作中发生异常"
 
msgstr "解锁时发生错误"
 

	
 
#: rhodecode/controllers/admin/repos.py:442
 
msgid "Updated repository visibility in public journal"
 
msgstr ""
 
msgstr "成功更新在公共日志中的可见性"
 

	
 
#: rhodecode/controllers/admin/repos.py:446
 
msgid "An error occurred during setting this repository in public journal"
 
msgstr ""
 
msgstr "设置版本库到公共日志时发生错误"
 

	
 
#: rhodecode/controllers/admin/repos.py:451 rhodecode/model/validators.py:299
 
msgid "Token mismatch"
 
msgstr ""
 
msgstr "令牌不匹配"
 

	
 
#: rhodecode/controllers/admin/repos.py:464
 
msgid "Pulled from remote location"
 
msgstr ""
 
msgstr "成功拉取自远程路径"
 

	
 
#: rhodecode/controllers/admin/repos.py:466
 
msgid "An error occurred during pull from remote location"
 
msgstr ""
 
msgstr "从远程路径拉取时发生错误"
 

	
 
#: rhodecode/controllers/admin/repos.py:482
 
msgid "Nothing"
 
msgstr ""
 
msgstr ""
 

	
 
#: rhodecode/controllers/admin/repos.py:484
 
#, fuzzy, python-format
 
#, python-format
 
msgid "Marked repo %s as fork of %s"
 
msgstr "新版本库 %s 基于 %s 建立。"
 
msgstr "成功将版本库 %s 标记为从 %s 分支"
 

	
 
#: rhodecode/controllers/admin/repos.py:488
 
#, fuzzy
 
msgid "An error occurred during this operation"
 
msgstr "在搜索操作中发生异常"
 
msgstr "在搜索操作中发生错误"
 

	
 
#: rhodecode/controllers/admin/repos_groups.py:116
 
#, python-format
 
msgid "created repos group %s"
 
msgstr "建立版本库组 %s"
 

	
 
#: rhodecode/controllers/admin/repos_groups.py:129
 
#, python-format
 
msgid "error occurred during creation of repos group %s"
 
msgstr ""
 
msgstr "创建版本库组时发生错误 %s"
 

	
 
#: rhodecode/controllers/admin/repos_groups.py:163
 
#, python-format
 
msgid "updated repos group %s"
 
msgstr "更新版本库组 %s"
 

	
 
#: rhodecode/controllers/admin/repos_groups.py:176
 
#, python-format
 
msgid "error occurred during update of repos group %s"
 
msgstr ""
 
msgstr "更新版本库组时发生错误 %s"
 

	
 
#: rhodecode/controllers/admin/repos_groups.py:194
 
#, python-format
 
msgid "This group contains %s repositores and cannot be deleted"
 
msgstr ""
 
msgstr "这个组内有 %s 个版本库因而无法删除"
 

	
 
#: rhodecode/controllers/admin/repos_groups.py:202
 
#, python-format
 
msgid "removed repos group %s"
 
msgstr "移除版本库组 %s"
 

	
 
#: rhodecode/controllers/admin/repos_groups.py:208
 
msgid "Cannot delete this group it still contains subgroups"
 
msgstr ""
 
msgstr "不能删除包含子组的组"
 

	
 
#: rhodecode/controllers/admin/repos_groups.py:213
 
#: rhodecode/controllers/admin/repos_groups.py:218
 
#, python-format
 
msgid "error occurred during deletion of repos group %s"
 
msgstr ""
 
msgstr "删除版本库组时发生错误 %s"
 

	
 
#: rhodecode/controllers/admin/repos_groups.py:238
 
#, fuzzy
 
msgid "An error occurred during deletion of group user"
 
msgstr "在搜索操作中发生异常"
 
msgstr "删除组用户时发生错误"
 

	
 
#: rhodecode/controllers/admin/repos_groups.py:258
 
msgid "An error occurred during deletion of group users groups"
 
msgstr ""
 
msgstr "删除版本库组的用户组时发生错误"
 

	
 
#: rhodecode/controllers/admin/settings.py:121
 
#, python-format
 
msgid "Repositories successfully rescanned added: %s,removed: %s"
 
msgstr ""
 
msgstr "重新扫描版本库成功,增加 %s, 移除 %s"
 

	
 
#: rhodecode/controllers/admin/settings.py:129
 
msgid "Whoosh reindex task scheduled"
 
msgstr "Whoosh 重新索引任务调度"
 

	
 
#: rhodecode/controllers/admin/settings.py:160
 
msgid "Updated application settings"
 
msgstr "更新应用设置"
 

	
 
#: rhodecode/controllers/admin/settings.py:164
 
#: rhodecode/controllers/admin/settings.py:275
 
msgid "error occurred during updating application settings"
 
msgstr ""
 
msgstr "更新设置时发生错误"
 

	
 
#: rhodecode/controllers/admin/settings.py:200
 
#, fuzzy
 
msgid "Updated visualisation settings"
 
msgstr "更新应用设置"
 
msgstr "成功更新可视化设置"
 

	
 
#: rhodecode/controllers/admin/settings.py:205
 
#, fuzzy
 
msgid "error occurred during updating visualisation settings"
 
msgstr "提交时发生错误"
 
msgstr "更新可视化设置时发生错误"
 

	
 
#: rhodecode/controllers/admin/settings.py:271
 
#, fuzzy
 
msgid "Updated VCS settings"
 
msgstr "更新 mercurial 设置"
 
msgstr "成功更新版本控制系统设置"
 

	
 
#: rhodecode/controllers/admin/settings.py:285
 
msgid "Added new hook"
 
msgstr "新增钩子"
 
msgstr "新建钩子"
 

	
 
#: rhodecode/controllers/admin/settings.py:297
 
msgid "Updated hooks"
 
msgstr "更新钩子"
 

	
 
#: rhodecode/controllers/admin/settings.py:301
 
msgid "error occurred during hook creation"
 
msgstr ""
 
msgstr "创建钩子时发生错误"
 

	
 
#: rhodecode/controllers/admin/settings.py:320
 
msgid "Email task created"
 
msgstr ""
 
msgstr "已创建电子邮件任务"
 

	
 
#: rhodecode/controllers/admin/settings.py:375
 
msgid "You can't edit this user since it's crucial for entire application"
 
msgstr ""
 
msgstr "由于是系统帐号,无法编辑该用户"
 

	
 
#: rhodecode/controllers/admin/settings.py:406
 
msgid "Your account was updated successfully"
 
msgstr "你的帐号已经更新完成"
 

	
 
#: rhodecode/controllers/admin/settings.py:421
 
#: rhodecode/controllers/admin/users.py:191
 
#, python-format
 
msgid "error occurred during update of user %s"
 
msgstr ""
 
msgstr "更新用户 %s 时发生错误"
 

	
 
#: rhodecode/controllers/admin/users.py:130
 
#, python-format
 
msgid "created user %s"
 
msgstr "创建用户 %s"
 

	
 
#: rhodecode/controllers/admin/users.py:142
 
#, python-format
 
msgid "error occurred during creation of user %s"
 
msgstr ""
 
msgstr "创建用户 %s 时发生错误"
 

	
 
#: rhodecode/controllers/admin/users.py:171
 
msgid "User updated successfully"
 
msgstr "用户更新成功"
 

	
 
#: rhodecode/controllers/admin/users.py:207
 
msgid "successfully deleted user"
 
msgstr "用户删除成功"
 

	
 
#: rhodecode/controllers/admin/users.py:212
 
msgid "An error occurred during deletion of user"
 
msgstr ""
 
msgstr "删除用户时发生错误"
 

	
 
#: rhodecode/controllers/admin/users.py:226
 
msgid "You can't edit this user"
 
msgstr "无法编辑该用户"
 

	
 
#: rhodecode/controllers/admin/users.py:266
 
msgid "Granted 'repository create' permission to user"
 
msgstr ""
 
msgstr "已授予用户‘创建版本库’的权限"
 

	
 
#: rhodecode/controllers/admin/users.py:271
 
msgid "Revoked 'repository create' permission to user"
 
msgstr ""
 
msgstr "已撤销用户‘创建版本库’的权限"
 

	
 
#: rhodecode/controllers/admin/users.py:277
 
#, fuzzy
 
msgid "Granted 'repository fork' permission to user"
 
msgstr "版本库权限"
 
msgstr "成功授予了用户“分支版本库”权限"
 

	
 
#: rhodecode/controllers/admin/users.py:282
 
#, fuzzy
 
msgid "Revoked 'repository fork' permission to user"
 
msgstr "版本库权限"
 
msgstr "成功撤销用户“分支版本库”权限"
 

	
 
#: rhodecode/controllers/admin/users.py:288
 
#: rhodecode/controllers/admin/users_groups.py:255
 
#, fuzzy
 
msgid "An error occurred during permissions saving"
 
msgstr "在搜索操作中发生异常"
 
msgstr "保存权限时发生错误"
 

	
 
#: rhodecode/controllers/admin/users.py:303
 
#, python-format
 
msgid "Added email %s to user"
 
msgstr ""
 
msgstr "已为用户添加电子邮件 %s"
 

	
 
#: rhodecode/controllers/admin/users.py:309
 
#, fuzzy
 
msgid "An error occurred during email saving"
 
msgstr "在搜索操作中发生异常"
 
msgstr "保存电子邮件时发生错误"
 

	
 
#: rhodecode/controllers/admin/users.py:319
 
#, fuzzy
 
msgid "Removed email from user"
 
msgstr "移除版本库组 %s"
 
msgstr "成功删除用户电子邮件"
 

	
 
#: rhodecode/controllers/admin/users_groups.py:84
 
#, python-format
 
msgid "created users group %s"
 
msgstr "建立用户组 %s"
 

	
 
#: rhodecode/controllers/admin/users_groups.py:95
 
#, python-format
 
msgid "error occurred during creation of users group %s"
 
msgstr ""
 
msgstr "创建用户组 %s 时发生错误"
 

	
 
#: rhodecode/controllers/admin/users_groups.py:135
 
#, python-format
 
msgid "updated users group %s"
 
msgstr "更新用户组 %s"
 

	
 
#: rhodecode/controllers/admin/users_groups.py:157
 
#, python-format
 
msgid "error occurred during update of users group %s"
 
msgstr ""
 
msgstr "更新用户组 %s 时发生错误"
 

	
 
#: rhodecode/controllers/admin/users_groups.py:174
 
msgid "successfully deleted users group"
 
msgstr "删除用户组成功"
 

	
 
#: rhodecode/controllers/admin/users_groups.py:179
 
msgid "An error occurred during deletion of users group"
 
msgstr ""
 
msgstr "删除用户组时发生错误"
 

	
 
#: rhodecode/controllers/admin/users_groups.py:233
 
msgid "Granted 'repository create' permission to users group"
 
msgstr ""
 
msgstr "已授予用户组‘创建版本库’的权限"
 

	
 
#: rhodecode/controllers/admin/users_groups.py:238
 
msgid "Revoked 'repository create' permission to users group"
 
msgstr ""
 
msgstr "已撤销用户组‘创建版本库’的权限"
 

	
 
#: rhodecode/controllers/admin/users_groups.py:244
 
msgid "Granted 'repository fork' permission to users group"
 
msgstr ""
 
msgstr "已授予用户组‘分支版本库’的权限"
 

	
 
#: rhodecode/controllers/admin/users_groups.py:249
 
msgid "Revoked 'repository fork' permission to users group"
 
msgstr ""
 
msgstr "已撤销用户组‘分支版本库’的权限"
 

	
 
#: rhodecode/lib/auth.py:499
 
msgid "You need to be a registered user to perform this action"
 
msgstr "必须是注册用户才能进行此操作"
 

	
 
#: rhodecode/lib/auth.py:540
 
msgid "You need to be a signed in to view this page"
 
msgstr "必须登录才能访问该页面"
 

	
 
#: rhodecode/lib/diffs.py:86
 
msgid "Changeset was too big and was cut off, use diff menu to display this diff"
 
msgstr "变更集因过大而被截断,可查看原始变更集作为替代"
 
msgid ""
 
"Changeset was too big and was cut off, use diff menu to display this diff"
 
msgstr "修订集因过大而被截断,可查看原始修订集作为替代"
 

	
 
#: rhodecode/lib/diffs.py:96
 
#, fuzzy
 
msgid "No changes detected"
 
msgstr "尚无修订"
 
msgstr "未发现差异"
 

	
 
#: rhodecode/lib/helpers.py:372
 
#, python-format
 
msgid "%a, %d %b %Y %H:%M:%S"
 
msgstr ""
 
msgstr "%Y/%b/%d %H:%M:%S %a"
 

	
 
#: rhodecode/lib/helpers.py:484
 
msgid "True"
 
msgstr ""
 
msgstr ""
 

	
 
#: rhodecode/lib/helpers.py:488
 
msgid "False"
 
msgstr ""
 
msgstr ""
 

	
 
#: rhodecode/lib/helpers.py:532
 
#, fuzzy
 
msgid "Changeset not found"
 
msgstr "修改"
 
msgstr "未找到修订集"
 

	
 
#: rhodecode/lib/helpers.py:555
 
#, python-format
 
msgid "Show all combined changesets %s->%s"
 
msgstr ""
 
msgstr "显示合并的修订集 %s->%s"
 

	
 
#: rhodecode/lib/helpers.py:561
 
msgid "compare view"
 
msgstr ""
 
msgstr "比较显示"
 

	
 
#: rhodecode/lib/helpers.py:581
 
msgid "and"
 
msgstr ""
 
msgstr "还有"
 

	
 
#: rhodecode/lib/helpers.py:582
 
#, python-format
 
msgid "%s more"
 
msgstr ""
 

	
 
#: rhodecode/lib/helpers.py:583 rhodecode/templates/changelog/changelog.html:48
 
msgstr "%s 个"
 

	
 
#: rhodecode/lib/helpers.py:583
 
#: rhodecode/templates/changelog/changelog.html:48
 
msgid "revisions"
 
msgstr "修订"
 

	
 
#: rhodecode/lib/helpers.py:606
 
msgid "fork name "
 
msgstr "分支名称"
 

	
 
#: rhodecode/lib/helpers.py:620
 
#: rhodecode/templates/pullrequests/pullrequest_show.html:4
 
#: rhodecode/templates/pullrequests/pullrequest_show.html:12
 
#, python-format
 
msgid "Pull request #%s"
 
msgstr ""
 
msgstr "拉取请求 #%s"
 

	
 
#: rhodecode/lib/helpers.py:626
 
msgid "[deleted] repository"
 
msgstr ""
 
msgstr "[删除] 版本库"
 

	
 
#: rhodecode/lib/helpers.py:628 rhodecode/lib/helpers.py:638
 
msgid "[created] repository"
 
msgstr ""
 
msgstr "[创建] 版本库"
 

	
 
#: rhodecode/lib/helpers.py:630
 
#, fuzzy
 
msgid "[created] repository as fork"
 
msgstr "建立版本库 %s"
 
msgstr "[创建] 分支版本库"
 

	
 
#: rhodecode/lib/helpers.py:632 rhodecode/lib/helpers.py:640
 
msgid "[forked] repository"
 
msgstr ""
 
msgstr "[分支] 版本库"
 

	
 
#: rhodecode/lib/helpers.py:634 rhodecode/lib/helpers.py:642
 
msgid "[updated] repository"
 
msgstr ""
 
msgstr "[更新] 版本库"
 

	
 
#: rhodecode/lib/helpers.py:636
 
msgid "[delete] repository"
 
msgstr ""
 
msgstr "[删除] 版本库"
 

	
 
#: rhodecode/lib/helpers.py:644
 
#, fuzzy
 
msgid "[created] user"
 
msgstr "创建用户 %s"
 
msgstr "[创建] 用户"
 

	
 
#: rhodecode/lib/helpers.py:646
 
#, fuzzy
 
msgid "[updated] user"
 
msgstr "更新用户组 %s"
 
msgstr "[更新] 用户"
 

	
 
#: rhodecode/lib/helpers.py:648
 
#, fuzzy
 
msgid "[created] users group"
 
msgstr "建立用户组 %s"
 
msgstr "[创建] 用户组"
 

	
 
#: rhodecode/lib/helpers.py:650
 
#, fuzzy
 
msgid "[updated] users group"
 
msgstr "更新用户组 %s"
 
msgstr "[更新] 用户组"
 

	
 
#: rhodecode/lib/helpers.py:652
 
msgid "[commented] on revision in repository"
 
msgstr ""
 
msgstr "[评论] 了版本库中的修订"
 

	
 
#: rhodecode/lib/helpers.py:654
 
#, fuzzy
 
msgid "[commented] on pull request for"
 
msgstr "创建用户 %s"
 
msgstr "[评论] 拉取请求"
 

	
 
#: rhodecode/lib/helpers.py:656
 
msgid "[closed] pull request for"
 
msgstr ""
 
msgstr "[关闭] 拉取请求"
 

	
 
#: rhodecode/lib/helpers.py:658
 
msgid "[pushed] into"
 
msgstr ""
 
msgstr "[推送] 到"
 

	
 
#: rhodecode/lib/helpers.py:660
 
msgid "[committed via RhodeCode] into repository"
 
msgstr ""
 
msgstr "[通过 RhodeCode 提交] 到版本库"
 

	
 
#: rhodecode/lib/helpers.py:662
 
msgid "[pulled from remote] into repository"
 
msgstr ""
 
msgstr "[远程拉取] 到版本库"
 

	
 
#: rhodecode/lib/helpers.py:664
 
msgid "[pulled] from"
 
msgstr ""
 
msgstr "[拉取] 自"
 

	
 
#: rhodecode/lib/helpers.py:666
 
msgid "[started following] repository"
 
msgstr ""
 
msgstr "[开始关注] 版本库"
 

	
 
#: rhodecode/lib/helpers.py:668
 
msgid "[stopped following] repository"
 
msgstr ""
 
msgstr "[停止关注] 版本库"
 

	
 
#: rhodecode/lib/helpers.py:840
 
#, python-format
 
msgid " and %s more"
 
msgstr ""
 
msgstr "还有 %s 个"
 

	
 
#: rhodecode/lib/helpers.py:844
 
msgid "No Files"
 
msgstr "没有文件"
 

	
 
#: rhodecode/lib/utils2.py:335
 
#, fuzzy, python-format
 
#, python-format
 
msgid "%d year"
 
msgid_plural "%d years"
 
msgstr[0] "年"
 
msgstr[0] "%d 年"
 

	
 
#: rhodecode/lib/utils2.py:336
 
#, fuzzy, python-format
 
#, python-format
 
msgid "%d month"
 
msgid_plural "%d months"
 
msgstr[0] "月"
 
msgstr[0] "%d 月"
 

	
 
#: rhodecode/lib/utils2.py:337
 
#, fuzzy, python-format
 
#, python-format
 
msgid "%d day"
 
msgid_plural "%d days"
 
msgstr[0] ""
 
msgstr[0] "%d 天"
 

	
 
#: rhodecode/lib/utils2.py:338
 
#, fuzzy, python-format
 
#, python-format
 
msgid "%d hour"
 
msgid_plural "%d hours"
 
msgstr[0] ""
 
msgstr[0] "%d 小时"
 

	
 
#: rhodecode/lib/utils2.py:339
 
#, fuzzy, python-format
 
#, python-format
 
msgid "%d minute"
 
msgid_plural "%d minutes"
 
msgstr[0] ""
 
msgstr[0] "%d 分钟"
 

	
 
#: rhodecode/lib/utils2.py:340
 
#, fuzzy, python-format
 
#, python-format
 
msgid "%d second"
 
msgid_plural "%d seconds"
 
msgstr[0] "秒"
 
msgstr[0] "%d 秒"
 

	
 
#: rhodecode/lib/utils2.py:355
 
#, fuzzy, python-format
 
#, python-format
 
msgid "%s ago"
 
msgstr "之前"
 
msgstr "%s 之前"
 

	
 
#: rhodecode/lib/utils2.py:357
 
#, python-format
 
msgid "%s and %s ago"
 
msgstr ""
 
msgstr "%s 零 %s 之前"
 

	
 
#: rhodecode/lib/utils2.py:360
 
msgid "just now"
 
msgstr "现在"
 
msgstr "刚才"
 

	
 
#: rhodecode/lib/celerylib/tasks.py:269
 
#, fuzzy
 
msgid "password reset link"
 
msgstr "密码重置链接已经发送"
 
msgstr "密码重置链接"
 

	
 
#: rhodecode/model/comment.py:110
 
#, python-format
 
msgid "on line %s"
 
msgstr ""
 
msgstr " %s 行"
 

	
 
#: rhodecode/model/comment.py:157
 
msgid "[Mention]"
 
msgstr ""
 
msgstr "[提及]"
 

	
 
#: rhodecode/model/db.py:1140
 
#, fuzzy
 
msgid "Repository no access"
 
msgstr "个版本库"
 
msgstr "无版本库访问权限"
 

	
 
#: rhodecode/model/db.py:1141
 
#, fuzzy
 
msgid "Repository read access"
 
msgstr "这个版本库已经存在"
 
msgstr "版本库读取权限"
 

	
 
#: rhodecode/model/db.py:1142
 
#, fuzzy
 
msgid "Repository write access"
 
msgstr "个版本库"
 
msgstr "版本库写入权限"
 

	
 
#: rhodecode/model/db.py:1143
 
#, fuzzy
 
msgid "Repository admin access"
 
msgstr "个版本库"
 
msgstr "版本库管理权限"
 

	
 
#: rhodecode/model/db.py:1145
 
#, fuzzy
 
msgid "Repositories Group no access"
 
msgstr "版本库组"
 
msgstr "无版本库组访问权限"
 

	
 
#: rhodecode/model/db.py:1146
 
#, fuzzy
 
msgid "Repositories Group read access"
 
msgstr "版本库组"
 
msgstr "版本库组读取权限"
 

	
 
#: rhodecode/model/db.py:1147
 
#, fuzzy
 
msgid "Repositories Group write access"
 
msgstr "版本库组"
 
msgstr "版本库组写入"
 

	
 
#: rhodecode/model/db.py:1148
 
#, fuzzy
 
msgid "Repositories Group admin access"
 
msgstr "版本库组"
 
msgstr "版本库组管理权限"
 

	
 
#: rhodecode/model/db.py:1150
 
#, fuzzy
 
msgid "RhodeCode Administrator"
 
msgstr "用户管理员"
 
msgstr "RhodeCode 管理员"
 

	
 
#: rhodecode/model/db.py:1151
 
#, fuzzy
 
msgid "Repository creation disabled"
 
msgstr "建立版本库"
 
msgstr "禁用创建版本库"
 

	
 
#: rhodecode/model/db.py:1152
 
#, fuzzy
 
msgid "Repository creation enabled"
 
msgstr "建立版本库"
 
msgstr "允许创建版本库"
 

	
 
#: rhodecode/model/db.py:1153
 
#, fuzzy
 
msgid "Repository forking disabled"
 
msgstr "建立版本库"
 
msgstr "禁用分支 版本库"
 

	
 
#: rhodecode/model/db.py:1154
 
#, fuzzy
 
msgid "Repository forking enabled"
 
msgstr "建立版本库"
 
msgstr "允许分支版本库"
 

	
 
#: rhodecode/model/db.py:1155
 
#, fuzzy
 
msgid "Register disabled"
 
msgstr "禁用"
 
msgstr "禁用注册"
 

	
 
#: rhodecode/model/db.py:1156
 
msgid "Register new user with RhodeCode with manual activation"
 
msgstr ""
 
msgstr "用手动激活注册新用户"
 

	
 
#: rhodecode/model/db.py:1159
 
msgid "Register new user with RhodeCode with auto activation"
 
msgstr ""
 
msgstr "用自动激活注册新用户"
 

	
 
#: rhodecode/model/db.py:1579
 
msgid "Not Reviewed"
 
msgstr ""
 
msgstr "未检视"
 

	
 
#: rhodecode/model/db.py:1580
 
#, fuzzy
 
msgid "Approved"
 
msgstr "移除"
 
msgstr "已批准"
 

	
 
#: rhodecode/model/db.py:1581
 
msgid "Rejected"
 
msgstr ""
 
msgstr "驳回"
 

	
 
#: rhodecode/model/db.py:1582
 
msgid "Under Review"
 
msgstr ""
 
msgstr "检视中"
 

	
 
#: rhodecode/model/forms.py:43
 
msgid "Please enter a login"
 
msgstr "请登录"
 

	
 
#: rhodecode/model/forms.py:44
 
#, python-format
 
msgid "Enter a value %(min)i characters long or more"
 
msgstr ""
 
msgstr "输入一个不少于 %(min)i 个字符的值"
 

	
 
#: rhodecode/model/forms.py:52
 
msgid "Please enter a password"
 
msgstr "请输入密码"
 

	
 
#: rhodecode/model/forms.py:53
 
#, python-format
 
msgid "Enter %(min)i characters or more"
 
msgstr ""
 
msgstr "输入少于 %(min)i 个字符"
 

	
 
#: rhodecode/model/notification.py:220
 
msgid "commented on commit"
 
msgstr ""
 
msgstr "评论了评论"
 

	
 
#: rhodecode/model/notification.py:221
 
#, fuzzy
 
msgid "sent message"
 
msgstr "提交信息"
 
msgstr "发送信息"
 

	
 
#: rhodecode/model/notification.py:222
 
msgid "mentioned you"
 
msgstr ""
 
msgstr "提到了你"
 

	
 
#: rhodecode/model/notification.py:223
 
#, fuzzy
 
msgid "registered in RhodeCode"
 
msgstr "成功注册到 rhodecode"
 
msgstr "注册到 RhodeCode"
 

	
 
#: rhodecode/model/notification.py:224
 
msgid "opened new pull request"
 
msgstr ""
 
msgstr "创建新的拉取请求"
 

	
 
#: rhodecode/model/notification.py:225
 
msgid "commented on pull request"
 
msgstr ""
 
msgstr "评论了拉取请求"
 

	
 
#: rhodecode/model/pull_request.py:84
 
#, python-format
 
msgid "%(user)s wants you to review pull request #%(pr_id)s"
 
msgstr ""
 
msgstr "%(user)s 想要你检视拉取请求 #%(pr_id)s"
 

	
 
#: rhodecode/model/scm.py:535
 
#, fuzzy
 
msgid "latest tip"
 
msgstr "最后登录"
 
msgstr "最后 tip 版本"
 

	
 
#: rhodecode/model/user.py:230
 
#, fuzzy
 
msgid "new user registration"
 
msgstr "[RhodeCode] 新用户注册"
 

	
 
#: rhodecode/model/user.py:255 rhodecode/model/user.py:277
 
#: rhodecode/model/user.py:299
 
msgid "You can't Edit this user since it's crucial for entire application"
 
msgstr "由于是系统帐号,无法编辑该用户"
 

	
 
#: rhodecode/model/user.py:323
 
msgid "You can't remove this user since it's crucial for entire application"
 
msgstr "由于是系统帐号,无法删除该用户"
 

	
 
#: rhodecode/model/user.py:329
 
#, fuzzy, python-format
 
#, python-format
 
msgid ""
 
"user \"%s\" still owns %s repositories and cannot be removed. Switch "
 
"owners or remove those repositories. %s"
 
msgstr "由于该用户拥有版本库 %s 因而无法删除,请变更版本库所有者或删除版本库"
 
"user \"%s\" still owns %s repositories and cannot be removed. Switch owners "
 
"or remove those repositories. %s"
 
msgstr ""
 
"由于用户 \"%s\" 拥有版本库 %s 因而无法删除,请修改版本库所有者或删除版本"
 
"库。%s"
 

	
 
#: rhodecode/model/validators.py:35 rhodecode/model/validators.py:36
 
msgid "Value cannot be an empty list"
 
msgstr ""
 
msgstr "值不能为空"
 

	
 
#: rhodecode/model/validators.py:82
 
#, fuzzy, python-format
 
#, python-format
 
msgid "Username \"%(username)s\" already exists"
 
msgstr "该用户名已经存在"
 
msgstr "用户名称 %(username)s 已经存在"
 

	
 
#: rhodecode/model/validators.py:84
 
#, python-format
 
msgid "Username \"%(username)s\" is forbidden"
 
msgstr ""
 
msgstr "不允许用户名 \"%(username)s\""
 

	
 
#: rhodecode/model/validators.py:86
 
msgid ""
 
"Username may only contain alphanumeric characters underscores, periods or"
 
" dashes and must begin with alphanumeric character"
 
msgstr "只能使用字母、数字、下划线、小数点或减号作为用户名,且必须由数字或字母开头"
 
"Username may only contain alphanumeric characters underscores, periods or "
 
"dashes and must begin with alphanumeric character"
 
msgstr ""
 
"只能使用字母、数字、下划线、小数点或减号作为用户名,且必须由数字或字母开头"
 

	
 
#: rhodecode/model/validators.py:114
 
#, fuzzy, python-format
 
#, python-format
 
msgid "Username %(username)s is not valid"
 
msgstr "用户或用户组名称无效"
 
msgstr "用户名称 %(username)s 无效"
 

	
 
#: rhodecode/model/validators.py:133
 
#, fuzzy
 
msgid "Invalid users group name"
 
msgstr "无效用户名"
 
msgstr "无效的用户组名"
 

	
 
#: rhodecode/model/validators.py:134
 
#, fuzzy, python-format
 
#, python-format
 
msgid "Users group \"%(usersgroup)s\" already exists"
 
msgstr "该用户组名称已经存在"
 
msgstr "用户组 \"%(usersgroup)s\" 已经存在"
 

	
 
#: rhodecode/model/validators.py:136
 
msgid ""
 
"users group name may only contain  alphanumeric characters underscores, "
 
"periods or dashes and must begin with alphanumeric character"
 
msgstr "只能使用字母、数字、下划线、小数点或减号作为用户组名,且必须由数字或字母开头"
 
msgstr ""
 
"只能使用字母、数字、下划线、小数点或减号作为用户组名,且必须由数字或字母开头"
 

	
 
#: rhodecode/model/validators.py:174
 
msgid "Cannot assign this group as parent"
 
msgstr ""
 
msgstr "不能将这个组作为 parent"
 

	
 
#: rhodecode/model/validators.py:175
 
#, fuzzy, python-format
 
#, python-format
 
msgid "Group \"%(group_name)s\" already exists"
 
msgstr "该用户名已经存在"
 
msgstr "组 \"%(group_name)s\" 已经存在"
 

	
 
#: rhodecode/model/validators.py:177
 
#, fuzzy, python-format
 
#, python-format
 
msgid "Repository with name \"%(group_name)s\" already exists"
 
msgstr "这个版本库已经存在"
 
msgstr "已经存在名为 \"%(group_name)s\" 的版本库"
 

	
 
#: rhodecode/model/validators.py:235
 
#, fuzzy
 
msgid "Invalid characters (non-ascii) in password"
 
msgstr "密码含有无效字符"
 
msgstr "密码含有无效(非ASCII)字符"
 

	
 
#: rhodecode/model/validators.py:250
 
msgid "Passwords do not match"
 
msgstr "密码不符"
 

	
 
#: rhodecode/model/validators.py:267
 
msgid "invalid password"
 
msgstr "无效密码"
 

	
 
#: rhodecode/model/validators.py:268
 
msgid "invalid user name"
 
msgstr "无效用户名"
 

	
 
#: rhodecode/model/validators.py:269
 
msgid "Your account is disabled"
 
msgstr "该帐号已被禁用"
 

	
 
#: rhodecode/model/validators.py:313
 
#, fuzzy, python-format
 
#, python-format
 
msgid "Repository name %(repo)s is disallowed"
 
msgstr "该版本库名称被禁用"
 
msgstr "版本库名称不能为 %(repo)s"
 

	
 
#: rhodecode/model/validators.py:315
 
#, fuzzy, python-format
 
#, python-format
 
msgid "Repository named %(repo)s already exists"
 
msgstr "这个版本库已经存在"
 
msgstr "已经存在版本库 %(repo)s"
 

	
 
#: rhodecode/model/validators.py:316
 
#, fuzzy, python-format
 
#, python-format
 
msgid "Repository \"%(repo)s\" already exists in group \"%(group)s\""
 
msgstr "组中已经存在该版本库"
 
msgstr "版本库组 \"%(group)s\" 中已经存在版本库 \"%(repo)s\""
 

	
 
#: rhodecode/model/validators.py:318
 
#, fuzzy, python-format
 
#, python-format
 
msgid "Repositories group with name \"%(repo)s\" already exists"
 
msgstr "这个版本库已经存在"
 
msgstr "已经存在名为 \"%(repo)s\" 的版本库组"
 

	
 
#: rhodecode/model/validators.py:431
 
msgid "invalid clone url"
 
msgstr "无效的 clone 地址"
 
msgstr "无效的克隆地址"
 

	
 
#: rhodecode/model/validators.py:432
 
msgid "Invalid clone url, provide a valid clone http(s)/svn+http(s) url"
 
msgstr ""
 
msgstr "无效的克隆地址,提供一个有效的克隆 http(s) 或 svn+http(s) 地址"
 

	
 
#: rhodecode/model/validators.py:457
 
#, fuzzy
 
msgid "Fork have to be the same type as parent"
 
msgstr "分支必须使用相同的版本库类型"
 
msgstr "分支必须使用和父版本库相同的类型"
 

	
 
#: rhodecode/model/validators.py:478
 
msgid "This username or users group name is not valid"
 
msgstr "用户或用户组名称无效"
 

	
 
#: rhodecode/model/validators.py:562
 
msgid "This is not a valid path"
 
msgstr "不是一个合法的路径"
 

	
 
#: rhodecode/model/validators.py:577
 
msgid "This e-mail address is already taken"
 
msgstr "该邮件地址已被使用"
 

	
 
#: rhodecode/model/validators.py:597
 
#, fuzzy, python-format
 
#, python-format
 
msgid "e-mail \"%(email)s\" does not exist."
 
msgstr "该邮件地址不存在"
 
msgstr "邮件地址  \"%(email)s\" 不存在"
 

	
 
#: rhodecode/model/validators.py:634
 
msgid ""
 
"The LDAP Login attribute of the CN must be specified - this is the name "
 
"of the attribute that is equivalent to \"username\""
 
msgstr ""
 
"The LDAP Login attribute of the CN must be specified - this is the name of "
 
"the attribute that is equivalent to \"username\""
 
msgstr "LDAP 登陆属性的 CN 必须指定 - 这个名字作为用户名"
 

	
 
#: rhodecode/model/validators.py:653
 
#, python-format
 
msgid "Revisions %(revs)s are already part of pull request or have set status"
 
msgstr ""
 
msgstr "修订 %(revs)s 已经包含在拉取请求中或者或者已经设置状态"
 

	
 
#: rhodecode/templates/index.html:3
 
msgid "Dashboard"
 
msgstr ""
 
msgstr "控制面板"
 

	
 
#: rhodecode/templates/index_base.html:6
 
#: rhodecode/templates/repo_switcher_list.html:4
 
#: rhodecode/templates/admin/repos/repos.html:9
 
#: rhodecode/templates/admin/users/user_edit_my_account.html:31
 
#: rhodecode/templates/admin/users/users.html:9
 
#: rhodecode/templates/bookmarks/bookmarks.html:10
 
#: rhodecode/templates/branches/branches.html:9
 
#: rhodecode/templates/journal/journal.html:40
 
#: rhodecode/templates/tags/tags.html:10
 
msgid "quick filter..."
 
msgstr "快速过滤..."
 

	
 
#: rhodecode/templates/index_base.html:6
 
#: rhodecode/templates/admin/repos/repos.html:9
 
#: rhodecode/templates/base/base.html:221
 
msgid "repositories"
 
msgstr "个版本库"
 

	
 
#: rhodecode/templates/index_base.html:13
 
#: rhodecode/templates/index_base.html:15
 
#: rhodecode/templates/admin/repos/repos.html:21
 
msgid "ADD REPOSITORY"
 
msgstr "新增版本库"
 
msgstr "新建版本库"
 

	
 
#: rhodecode/templates/index_base.html:29
 
#: rhodecode/templates/admin/repos_groups/repos_groups_add.html:32
 
#: rhodecode/templates/admin/repos_groups/repos_groups_edit.html:32
 
#: rhodecode/templates/admin/repos_groups/repos_groups_show.html:33
 
#: rhodecode/templates/admin/users_groups/users_group_add.html:32
 
#: rhodecode/templates/admin/users_groups/users_group_edit.html:33
 
msgid "Group name"
 
msgstr "组名"
 

	
 
#: rhodecode/templates/index_base.html:30
 
#: rhodecode/templates/index_base.html:71
 
#: rhodecode/templates/index_base.html:142
 
#: rhodecode/templates/index_base.html:168
 
#: rhodecode/templates/admin/repos/repo_add_base.html:56
 
#: rhodecode/templates/admin/repos/repo_edit.html:75
 
#: rhodecode/templates/admin/repos/repos.html:72
 
#: rhodecode/templates/admin/repos_groups/repos_groups_add.html:41
 
#: rhodecode/templates/admin/repos_groups/repos_groups_edit.html:41
 
#: rhodecode/templates/admin/repos_groups/repos_groups_show.html:34
 
#: rhodecode/templates/forks/fork.html:59
 
#: rhodecode/templates/settings/repo_settings.html:66
 
#: rhodecode/templates/summary/summary.html:105
 
msgid "Description"
 
msgstr "描述"
 

	
 
#: rhodecode/templates/index_base.html:40
 
#: rhodecode/templates/admin/repos_groups/repos_groups_show.html:46
 
msgid "Repositories group"
 
msgstr "版本库组"
 

	
 
#: rhodecode/templates/index_base.html:70
 
#: rhodecode/templates/index_base.html:166
 
#: rhodecode/templates/admin/repos/repo_add_base.html:9
 
#: rhodecode/templates/admin/repos/repo_edit.html:32
 
#: rhodecode/templates/admin/repos/repos.html:70
 
#: rhodecode/templates/admin/users/user_edit.html:192
 
#: rhodecode/templates/admin/users/user_edit_my_account.html:59
 
#: rhodecode/templates/admin/users/user_edit_my_account.html:157
 
#: rhodecode/templates/admin/users/user_edit_my_account.html:193
 
#: rhodecode/templates/admin/users/user_edit_my_account_repos.html:6
 
#: rhodecode/templates/bookmarks/bookmarks.html:36
 
#: rhodecode/templates/bookmarks/bookmarks_data.html:6
 
#: rhodecode/templates/branches/branches.html:51
 
#: rhodecode/templates/files/files_browser.html:47
 
#: rhodecode/templates/journal/journal.html:59
 
#: rhodecode/templates/journal/journal.html:107
 
#: rhodecode/templates/journal/journal.html:186
 
#: rhodecode/templates/settings/repo_settings.html:31
 
#: rhodecode/templates/summary/summary.html:43
 
#: rhodecode/templates/summary/summary.html:123
 
#: rhodecode/templates/tags/tags.html:36
 
#: rhodecode/templates/tags/tags_data.html:6
 
msgid "Name"
 
msgstr "名称"
 

	
 
#: rhodecode/templates/index_base.html:72
 
msgid "Last change"
 
msgstr "最后修改"
 

	
 
#: rhodecode/templates/index_base.html:73
 
#: rhodecode/templates/index_base.html:171
 
#: rhodecode/templates/admin/users/user_edit_my_account.html:159
 
#: rhodecode/templates/journal/journal.html:188
 
msgid "Tip"
 
msgstr ""
 
msgstr "Tip"
 

	
 
#: rhodecode/templates/index_base.html:74
 
#: rhodecode/templates/index_base.html:173
 
#: rhodecode/templates/admin/repos/repo_edit.html:121
 
#: rhodecode/templates/admin/repos/repos.html:73
 
msgid "Owner"
 
msgstr "所有者"
 

	
 
#: rhodecode/templates/index_base.html:75
 
#: rhodecode/templates/summary/summary.html:48
 
#: rhodecode/templates/summary/summary.html:51
 
msgid "RSS"
 
msgstr ""
 
msgstr "RSS"
 

	
 
#: rhodecode/templates/index_base.html:76
 
msgid "Atom"
 
msgstr ""
 
msgstr "Atom"
 

	
 
#: rhodecode/templates/index_base.html:110
 
#: rhodecode/templates/index_base.html:112
 
#, python-format
 
msgid "Subscribe to %s rss feed"
 
msgstr "订阅 rss %s"
 
msgstr "订阅 %s 的 RSS"
 

	
 
#: rhodecode/templates/index_base.html:117
 
#: rhodecode/templates/index_base.html:119
 
#, python-format
 
msgid "Subscribe to %s atom feed"
 
msgstr "订阅 atom %s"
 
msgstr "订阅 %s 的 Atom"
 

	
 
#: rhodecode/templates/index_base.html:140
 
#, fuzzy
 
msgid "Group Name"
 
msgstr "组名"
 

	
 
#: rhodecode/templates/index_base.html:158
 
#: rhodecode/templates/index_base.html:198
 
#: rhodecode/templates/admin/repos/repos.html:94
 
#: rhodecode/templates/admin/users/user_edit_my_account.html:179
 
#: rhodecode/templates/admin/users/users.html:107
 
#: rhodecode/templates/bookmarks/bookmarks.html:60
 
#: rhodecode/templates/branches/branches.html:77
 
#: rhodecode/templates/journal/journal.html:211
 
#: rhodecode/templates/tags/tags.html:60
 
msgid "Click to sort ascending"
 
msgstr ""
 
msgstr "点击以升序排列"
 

	
 
#: rhodecode/templates/index_base.html:159
 
#: rhodecode/templates/index_base.html:199
 
#: rhodecode/templates/admin/repos/repos.html:95
 
#: rhodecode/templates/admin/users/user_edit_my_account.html:180
 
#: rhodecode/templates/admin/users/users.html:108
 
#: rhodecode/templates/bookmarks/bookmarks.html:61
 
#: rhodecode/templates/branches/branches.html:78
 
#: rhodecode/templates/journal/journal.html:212
 
#: rhodecode/templates/tags/tags.html:61
 
msgid "Click to sort descending"
 
msgstr ""
 
msgstr "点击以降序排列"
 

	
 
#: rhodecode/templates/index_base.html:169
 
#, fuzzy
 
msgid "Last Change"
 
msgstr "最后修改"
 

	
 
#: rhodecode/templates/index_base.html:200
 
#: rhodecode/templates/admin/repos/repos.html:96
 
#: rhodecode/templates/admin/users/user_edit_my_account.html:181
 
#: rhodecode/templates/admin/users/users.html:109
 
#: rhodecode/templates/bookmarks/bookmarks.html:62
 
#: rhodecode/templates/branches/branches.html:79
 
#: rhodecode/templates/journal/journal.html:213
 
#: rhodecode/templates/tags/tags.html:62
 
msgid "No records found."
 
msgstr ""
 
msgstr "没有找到记录"
 

	
 
#: rhodecode/templates/index_base.html:201
 
#: rhodecode/templates/admin/repos/repos.html:97
 
#: rhodecode/templates/admin/users/user_edit_my_account.html:182
 
#: rhodecode/templates/admin/users/users.html:110
 
#: rhodecode/templates/bookmarks/bookmarks.html:63
 
#: rhodecode/templates/branches/branches.html:80
 
#: rhodecode/templates/journal/journal.html:214
 
#: rhodecode/templates/tags/tags.html:63
 
msgid "Data error."
 
msgstr ""
 
msgstr "数据错误"
 

	
 
#: rhodecode/templates/index_base.html:202
 
#: rhodecode/templates/admin/repos/repos.html:98
 
#: rhodecode/templates/admin/users/user_edit_my_account.html:183
 
#: rhodecode/templates/admin/users/users.html:111
 
#: rhodecode/templates/bookmarks/bookmarks.html:64
 
#: rhodecode/templates/branches/branches.html:81
 
#: rhodecode/templates/journal/journal.html:215
 
#: rhodecode/templates/tags/tags.html:64
 
#, fuzzy
 
msgid "Loading..."
 
msgstr "加载文件列表..."
 
msgstr "载入中..."
 

	
 
#: rhodecode/templates/login.html:5 rhodecode/templates/login.html:54
 
msgid "Sign In"
 
msgstr "登录"
 

	
 
#: rhodecode/templates/login.html:21
 
msgid "Sign In to"
 
msgstr "登录到"
 

	
 
#: rhodecode/templates/login.html:31 rhodecode/templates/register.html:20
 
#: rhodecode/templates/admin/admin_log.html:5
 
#: rhodecode/templates/admin/users/user_add.html:32
 
#: rhodecode/templates/admin/users/user_edit.html:50
 
#: rhodecode/templates/admin/users/user_edit_my_account_form.html:26
 
#: rhodecode/templates/base/base.html:83
 
#: rhodecode/templates/summary/summary.html:122
 
msgid "Username"
 
msgstr "帐号"
 

	
 
#: rhodecode/templates/login.html:40 rhodecode/templates/register.html:29
 
#: rhodecode/templates/admin/ldap/ldap.html:46
 
#: rhodecode/templates/admin/users/user_add.html:41
 
#: rhodecode/templates/base/base.html:92
 
msgid "Password"
 
msgstr "密码"
 

	
 
#: rhodecode/templates/login.html:50
 
#, fuzzy
 
msgid "Remember me"
 
msgstr "成员"
 
msgstr "记住密码"
 

	
 
#: rhodecode/templates/login.html:60
 
msgid "Forgot your password ?"
 
msgstr "忘记了密码?"
 

	
 
#: rhodecode/templates/login.html:63 rhodecode/templates/base/base.html:103
 
msgid "Don't have an account ?"
 
msgstr "还没有帐号?"
 

	
 
#: rhodecode/templates/password_reset.html:5
 
msgid "Reset your password"
 
msgstr "重置密码"
 

	
 
#: rhodecode/templates/password_reset.html:11
 
msgid "Reset your password to"
 
msgstr "重置密码"
 

	
 
#: rhodecode/templates/password_reset.html:21
 
msgid "Email address"
 
msgstr "邮件地址"
 

	
 
#: rhodecode/templates/password_reset.html:30
 
msgid "Reset my password"
 
msgstr "重置密码"
 

	
 
#: rhodecode/templates/password_reset.html:31
 
msgid "Password reset link will be send to matching email address"
 
msgstr "密码重置地址已经发送到邮件"
 

	
 
#: rhodecode/templates/register.html:5 rhodecode/templates/register.html:74
 
msgid "Sign Up"
 
msgstr "注册"
 

	
 
#: rhodecode/templates/register.html:11
 
msgid "Sign Up to"
 
msgstr "注册"
 

	
 
#: rhodecode/templates/register.html:38
 
msgid "Re-enter password"
 
msgstr "确认密码"
 

	
 
#: rhodecode/templates/register.html:47
 
#: rhodecode/templates/admin/users/user_add.html:59
 
#: rhodecode/templates/admin/users/user_edit.html:86
 
#: rhodecode/templates/admin/users/user_edit_my_account_form.html:53
 
msgid "First Name"
 
msgstr "名"
 

	
 
#: rhodecode/templates/register.html:56
 
#: rhodecode/templates/admin/users/user_add.html:68
 
#: rhodecode/templates/admin/users/user_edit.html:95
 
#: rhodecode/templates/admin/users/user_edit_my_account_form.html:62
 
msgid "Last Name"
 
msgstr "姓"
 

	
 
#: rhodecode/templates/register.html:65
 
#: rhodecode/templates/admin/users/user_add.html:77
 
#: rhodecode/templates/admin/users/user_edit.html:104
 
#: rhodecode/templates/admin/users/user_edit_my_account_form.html:71
 
#: rhodecode/templates/summary/summary.html:124
 
msgid "Email"
 
msgstr "电子邮件"
 

	
 
#: rhodecode/templates/register.html:76
 
msgid "Your account will be activated right after registration"
 
msgstr "注册后,帐号将启用"
 

	
 
#: rhodecode/templates/register.html:78
 
msgid "Your account must wait for activation by administrator"
 
msgstr "管理员审核后,你注册的帐号将被启用"
 

	
 
#: rhodecode/templates/repo_switcher_list.html:11
 
#: rhodecode/templates/admin/repos/repo_add_base.html:65
 
#: rhodecode/templates/admin/repos/repo_edit.html:85
 
#: rhodecode/templates/settings/repo_settings.html:76
 
msgid "Private repository"
 
msgstr "私有版本库"
 

	
 
#: rhodecode/templates/repo_switcher_list.html:16
 
msgid "Public repository"
 
msgstr "公共版本库"
 

	
 
#: rhodecode/templates/switch_to_list.html:3
 
#: rhodecode/templates/branches/branches.html:14
 
msgid "branches"
 
msgstr "分支"
 

	
 
#: rhodecode/templates/switch_to_list.html:10
 
#: rhodecode/templates/branches/branches_data.html:57
 
msgid "There are no branches yet"
 
msgstr "没有任何分支"
 

	
 
#: rhodecode/templates/switch_to_list.html:15
 
#: rhodecode/templates/shortlog/shortlog_data.html:10
 
#: rhodecode/templates/tags/tags.html:15
 
msgid "tags"
 
msgstr "标签"
 

	
 
#: rhodecode/templates/switch_to_list.html:22
 
#: rhodecode/templates/tags/tags_data.html:33
 
msgid "There are no tags yet"
 
msgstr "没有任何标签"
 

	
 
#: rhodecode/templates/switch_to_list.html:28
 
#: rhodecode/templates/bookmarks/bookmarks.html:15
 
msgid "bookmarks"
 
msgstr ""
 
msgstr "书签"
 

	
 
#: rhodecode/templates/switch_to_list.html:35
 
#: rhodecode/templates/bookmarks/bookmarks_data.html:32
 
#, fuzzy
 
msgid "There are no bookmarks yet"
 
msgstr "尚未有任何分支"
 
msgstr "无书签"
 

	
 
#: rhodecode/templates/admin/admin.html:5
 
#: rhodecode/templates/admin/admin.html:9
 
msgid "Admin journal"
 
msgstr "管理员日志"
 

	
 
#: rhodecode/templates/admin/admin_log.html:6
 
#: rhodecode/templates/admin/repos/repos.html:74
 
#: rhodecode/templates/admin/users/user_edit_my_account_repos.html:8
 
#: rhodecode/templates/admin/users/user_edit_my_account_repos.html:9
 
#: rhodecode/templates/journal/journal.html:61
 
#: rhodecode/templates/journal/journal.html:62
 
msgid "Action"
 
msgstr "操作"
 

	
 
#: rhodecode/templates/admin/admin_log.html:7
 
msgid "Repository"
 
msgstr "版本库"
 

	
 
#: rhodecode/templates/admin/admin_log.html:8
 
#: rhodecode/templates/bookmarks/bookmarks.html:37
 
#: rhodecode/templates/bookmarks/bookmarks_data.html:7
 
#: rhodecode/templates/branches/branches.html:52
 
#: rhodecode/templates/tags/tags.html:37
 
#: rhodecode/templates/tags/tags_data.html:7
 
msgid "Date"
 
msgstr "日期"
 

	
 
#: rhodecode/templates/admin/admin_log.html:9
 
msgid "From IP"
 
msgstr "来源 IP"
 

	
 
#: rhodecode/templates/admin/admin_log.html:53
 
msgid "No actions yet"
 
msgstr "尚无操作"
 
msgstr "无操作"
 

	
 
#: rhodecode/templates/admin/ldap/ldap.html:5
 
msgid "LDAP administration"
 
msgstr "LDAP 管理员"
 

	
 
#: rhodecode/templates/admin/ldap/ldap.html:11
 
msgid "Ldap"
 
msgstr ""
 
msgstr "LDAP"
 

	
 
#: rhodecode/templates/admin/ldap/ldap.html:28
 
msgid "Connection settings"
 
msgstr "连接设置"
 

	
 
#: rhodecode/templates/admin/ldap/ldap.html:30
 
msgid "Enable LDAP"
 
msgstr "启用 LDAP"
 

	
 
#: rhodecode/templates/admin/ldap/ldap.html:34
 
msgid "Host"
 
msgstr "主机"
 

	
 
#: rhodecode/templates/admin/ldap/ldap.html:38
 
msgid "Port"
 
msgstr "端口"
 

	
 
#: rhodecode/templates/admin/ldap/ldap.html:42
 
msgid "Account"
 
msgstr "帐号"
 

	
 
#: rhodecode/templates/admin/ldap/ldap.html:50
 
msgid "Connection security"
 
msgstr "连接安全"
 

	
 
#: rhodecode/templates/admin/ldap/ldap.html:54
 
msgid "Certificate Checks"
 
msgstr "凭证确认"
 

	
 
#: rhodecode/templates/admin/ldap/ldap.html:57
 
msgid "Search settings"
 
msgstr "搜索设置"
 

	
 
#: rhodecode/templates/admin/ldap/ldap.html:59
 
msgid "Base DN"
 
msgstr ""
 
msgstr "Base DN"
 

	
 
#: rhodecode/templates/admin/ldap/ldap.html:63
 
msgid "LDAP Filter"
 
msgstr ""
 
msgstr "LDAP 过滤器"
 

	
 
#: rhodecode/templates/admin/ldap/ldap.html:67
 
msgid "LDAP Search Scope"
 
msgstr ""
 
msgstr "LDAP 搜索范围"
 

	
 
#: rhodecode/templates/admin/ldap/ldap.html:70
 
msgid "Attribute mappings"
 
msgstr "属性映射"
 

	
 
#: rhodecode/templates/admin/ldap/ldap.html:72
 
msgid "Login Attribute"
 
msgstr "登录属性"
 

	
 
#: rhodecode/templates/admin/ldap/ldap.html:76
 
msgid "First Name Attribute"
 
msgstr "名"
 

	
 
#: rhodecode/templates/admin/ldap/ldap.html:80
 
msgid "Last Name Attribute"
 
msgstr "姓"
 

	
 
#: rhodecode/templates/admin/ldap/ldap.html:84
 
msgid "E-mail Attribute"
 
msgstr "电子邮件属性"
 

	
 
#: rhodecode/templates/admin/ldap/ldap.html:89
 
#: rhodecode/templates/admin/repos/repo_edit.html:141
 
#: rhodecode/templates/admin/repos_groups/repos_groups_edit.html:74
 
#: rhodecode/templates/admin/settings/hooks.html:73
 
#: rhodecode/templates/admin/users/user_edit.html:129
 
#: rhodecode/templates/admin/users/user_edit.html:174
 
#: rhodecode/templates/admin/users/user_edit_my_account_form.html:79
 
#: rhodecode/templates/admin/users_groups/users_group_edit.html:135
 
#: rhodecode/templates/settings/repo_settings.html:93
 
msgid "Save"
 
msgstr "保存"
 

	
 
#: rhodecode/templates/admin/notifications/notifications.html:5
 
#: rhodecode/templates/admin/notifications/notifications.html:9
 
msgid "My Notifications"
 
msgstr ""
 
msgstr "我的通知"
 

	
 
#: rhodecode/templates/admin/notifications/notifications.html:29
 
msgid "All"
 
msgstr ""
 
msgstr "全部"
 

	
 
#: rhodecode/templates/admin/notifications/notifications.html:30
 
#, fuzzy
 
msgid "Comments"
 
msgstr "提交"
 
msgstr "评论"
 

	
 
#: rhodecode/templates/admin/notifications/notifications.html:31
 
#: rhodecode/templates/base/base.html:254
 
#: rhodecode/templates/base/base.html:256
 
msgid "Pull requests"
 
msgstr ""
 
msgstr "拉取请求"
 

	
 
#: rhodecode/templates/admin/notifications/notifications.html:35
 
msgid "Mark all read"
 
msgstr ""
 
msgstr "全部标记为已读"
 

	
 
#: rhodecode/templates/admin/notifications/notifications_data.html:39
 
#, fuzzy
 
msgid "No notifications here yet"
 
msgstr "尚无操作"
 
msgstr "无通知"
 

	
 
#: rhodecode/templates/admin/notifications/show_notification.html:5
 
#: rhodecode/templates/admin/notifications/show_notification.html:11
 
#, fuzzy
 
msgid "Show notification"
 
msgstr "显示注释"
 
msgstr "显示通知"
 

	
 
#: rhodecode/templates/admin/notifications/show_notification.html:9
 
#, fuzzy
 
msgid "Notifications"
 
msgstr "位置"
 
msgstr "通知"
 

	
 
#: rhodecode/templates/admin/permissions/permissions.html:5
 
msgid "Permissions administration"
 
msgstr "权限管理"
 

	
 
#: rhodecode/templates/admin/permissions/permissions.html:11
 
#: rhodecode/templates/admin/repos/repo_edit.html:134
 
#: rhodecode/templates/admin/repos_groups/repos_groups_edit.html:58
 
#: rhodecode/templates/admin/users/user_edit.html:139
 
#: rhodecode/templates/admin/users_groups/users_group_edit.html:100
 
#: rhodecode/templates/settings/repo_settings.html:86
 
msgid "Permissions"
 
msgstr "权限"
 

	
 
#: rhodecode/templates/admin/permissions/permissions.html:24
 
msgid "Default permissions"
 
msgstr "默认权限"
 

	
 
#: rhodecode/templates/admin/permissions/permissions.html:31
 
msgid "Anonymous access"
 
msgstr "匿名访问"
 

	
 
#: rhodecode/templates/admin/permissions/permissions.html:41
 
msgid "Repository permission"
 
msgstr "版本库权限"
 

	
 
#: rhodecode/templates/admin/permissions/permissions.html:49
 
msgid ""
 
"All default permissions on each repository will be reset to choosen "
 
"permission, note that all custom default permission on repositories will "
 
"be lost"
 
"permission, note that all custom default permission on repositories will be "
 
"lost"
 
msgstr ""
 
"所有版本库的默认权限将被重置到选择的权限,所有版本库的自定义权限将被丢弃"
 

	
 
#: rhodecode/templates/admin/permissions/permissions.html:50
 
msgid "overwrite existing settings"
 
msgstr "覆盖已有设置"
 

	
 
#: rhodecode/templates/admin/permissions/permissions.html:55
 
msgid "Registration"
 
msgstr "注册"
 

	
 
#: rhodecode/templates/admin/permissions/permissions.html:63
 
msgid "Repository creation"
 
msgstr "建立版本库"
 

	
 
#: rhodecode/templates/admin/permissions/permissions.html:71
 
#, fuzzy
 
msgid "Repository forking"
 
msgstr "建立版本库"
 
msgstr "版本库分支"
 

	
 
#: rhodecode/templates/admin/permissions/permissions.html:78
 
#: rhodecode/templates/admin/repos/repo_edit.html:241
 
msgid "set"
 
msgstr "设置"
 

	
 
#: rhodecode/templates/admin/repos/repo_add.html:5
 
#: rhodecode/templates/admin/repos/repo_add_create_repository.html:5
 
msgid "Add repository"
 
msgstr "添加版本库"
 

	
 
#: rhodecode/templates/admin/repos/repo_add.html:11
 
#: rhodecode/templates/admin/repos/repo_edit.html:11
 
#: rhodecode/templates/admin/repos_groups/repos_groups_show.html:10
 
msgid "Repositories"
 
msgstr "版本库"
 

	
 
#: rhodecode/templates/admin/repos/repo_add.html:13
 
msgid "add new"
 
msgstr "新增"
 
msgstr "新建"
 

	
 
#: rhodecode/templates/admin/repos/repo_add_base.html:20
 
#: rhodecode/templates/summary/summary.html:95
 
#: rhodecode/templates/summary/summary.html:96
 
msgid "Clone from"
 
msgstr "clone 自"
 
msgstr "克隆自"
 

	
 
#: rhodecode/templates/admin/repos/repo_add_base.html:24
 
#: rhodecode/templates/admin/repos/repo_edit.html:44
 
#: rhodecode/templates/settings/repo_settings.html:43
 
msgid "Optional http[s] url from which repository should be cloned."
 
msgstr ""
 
msgstr "可选的,指定版本库应该从哪个 http[s] 地址克隆。"
 

	
 
#: rhodecode/templates/admin/repos/repo_add_base.html:29
 
#: rhodecode/templates/admin/repos/repo_edit.html:49
 
#: rhodecode/templates/admin/repos_groups/repos_groups.html:4
 
#: rhodecode/templates/forks/fork.html:50
 
#: rhodecode/templates/settings/repo_settings.html:48
 
msgid "Repository group"
 
msgstr "版本库组"
 

	
 
#: rhodecode/templates/admin/repos/repo_add_base.html:33
 
#: rhodecode/templates/forks/fork.html:54
 
msgid "Optionaly select a group to put this repository into."
 
msgstr ""
 
msgstr "可选的,选择一个组将版本库放到其中"
 

	
 
#: rhodecode/templates/admin/repos/repo_add_base.html:38
 
#: rhodecode/templates/admin/repos/repo_edit.html:58
 
msgid "Type"
 
msgstr "类型"
 

	
 
#: rhodecode/templates/admin/repos/repo_add_base.html:42
 
#, fuzzy
 
msgid "Type of repository to create."
 
msgstr "建立版本库"
 
msgstr "要创建的版本库类型"
 

	
 
#: rhodecode/templates/admin/repos/repo_add_base.html:47
 
#: rhodecode/templates/admin/repos/repo_edit.html:66
 
#: rhodecode/templates/forks/fork.html:41
 
#: rhodecode/templates/settings/repo_settings.html:57
 
#, fuzzy
 
msgid "Landing revision"
 
msgstr "下一个修订"
 
msgstr "默认修订"
 

	
 
#: rhodecode/templates/admin/repos/repo_add_base.html:51
 
#: rhodecode/templates/admin/repos/repo_edit.html:70
 
#: rhodecode/templates/forks/fork.html:45
 
#: rhodecode/templates/settings/repo_settings.html:61
 
msgid "Default revision for files page, downloads, whoosh and readme"
 
msgstr ""
 
msgstr "文件浏览、下载、whoosh和readme的默认修订版本"
 

	
 
#: rhodecode/templates/admin/repos/repo_add_base.html:60
 
#: rhodecode/templates/admin/repos/repo_edit.html:79
 
#: rhodecode/templates/forks/fork.html:63
 
#: rhodecode/templates/settings/repo_settings.html:70
 
msgid "Keep it short and to the point. Use a README file for longer descriptions."
 
msgstr ""
 
msgid ""
 
"Keep it short and to the point. Use a README file for longer descriptions."
 
msgstr "保持简短。用 README 文件来写更长的描述。"
 

	
 
#: rhodecode/templates/admin/repos/repo_add_base.html:69
 
#: rhodecode/templates/admin/repos/repo_edit.html:89
 
#: rhodecode/templates/forks/fork.html:72
 
#: rhodecode/templates/settings/repo_settings.html:80
 
msgid ""
 
"Private repositories are only visible to people explicitly added as "
 
"collaborators."
 
msgstr ""
 
msgstr "私有版本库只对显示添加的合作者可见。"
 

	
 
#: rhodecode/templates/admin/repos/repo_add_base.html:73
 
msgid "add"
 
msgstr "新增"
 
msgstr "新建"
 

	
 
#: rhodecode/templates/admin/repos/repo_add_create_repository.html:9
 
msgid "add new repository"
 
msgstr "新增版本库"
 
msgstr "新建版本库"
 

	
 
#: rhodecode/templates/admin/repos/repo_edit.html:5
 
msgid "Edit repository"
 
msgstr "编辑版本库"
 

	
 
#: rhodecode/templates/admin/repos/repo_edit.html:13
 
#: rhodecode/templates/admin/users/user_edit.html:13
 
#: rhodecode/templates/admin/users/user_edit.html:224
 
#: rhodecode/templates/admin/users/user_edit.html:226
 
#: rhodecode/templates/admin/users/user_edit_my_account_repos.html:28
 
#: rhodecode/templates/admin/users_groups/users_group_edit.html:13
 
#: rhodecode/templates/files/files_source.html:44
 
#: rhodecode/templates/journal/journal.html:81
 
msgid "edit"
 
msgstr "编辑"
 

	
 
#: rhodecode/templates/admin/repos/repo_edit.html:40
 
#: rhodecode/templates/settings/repo_settings.html:39
 
msgid "Clone uri"
 
msgstr "clone 地址"
 
msgstr "克隆地址"
 

	
 
#: rhodecode/templates/admin/repos/repo_edit.html:53
 
#: rhodecode/templates/settings/repo_settings.html:52
 
msgid "Optional select a group to put this repository into."
 
msgstr ""
 
msgstr "可选的,选择一个组将版本库放到其中"
 

	
 
#: rhodecode/templates/admin/repos/repo_edit.html:94
 
msgid "Enable statistics"
 
msgstr "启用统计"
 

	
 
#: rhodecode/templates/admin/repos/repo_edit.html:98
 
msgid "Enable statistics window on summary page."
 
msgstr ""
 
msgstr "启用概况页的统计窗口"
 

	
 
#: rhodecode/templates/admin/repos/repo_edit.html:103
 
msgid "Enable downloads"
 
msgstr "启用下载"
 

	
 
#: rhodecode/templates/admin/repos/repo_edit.html:107
 
msgid "Enable download menu on summary page."
 
msgstr ""
 
msgstr "启用概况页的下载菜单"
 

	
 
#: rhodecode/templates/admin/repos/repo_edit.html:112
 
#: rhodecode/templates/admin/repos_groups/repos_groups_edit.html:66
 
#, fuzzy
 
msgid "Enable locking"
 
msgstr "启用"
 
msgstr "启用锁定"
 

	
 
#: rhodecode/templates/admin/repos/repo_edit.html:116
 
msgid "Enable lock-by-pulling on repository."
 
msgstr ""
 
msgstr "启用版本库的拉取锁定"
 

	
 
#: rhodecode/templates/admin/repos/repo_edit.html:126
 
#, fuzzy
 
msgid "Change owner of this repository."
 
msgstr "%s 库的修改"
 
msgstr "修改这个版本库的所有者"
 

	
 
#: rhodecode/templates/admin/repos/repo_edit.html:142
 
#: rhodecode/templates/admin/repos_groups/repos_groups_edit.html:75
 
#: rhodecode/templates/admin/settings/settings.html:113
 
#: rhodecode/templates/admin/settings/settings.html:168
 
#: rhodecode/templates/admin/settings/settings.html:258
 
#: rhodecode/templates/admin/users/user_edit.html:130
 
#: rhodecode/templates/admin/users/user_edit.html:175
 
#: rhodecode/templates/admin/users/user_edit.html:278
 
#: rhodecode/templates/admin/users/user_edit_my_account_form.html:80
 
#: rhodecode/templates/admin/users_groups/users_group_edit.html:136
 
#: rhodecode/templates/files/files_add.html:82
 
#: rhodecode/templates/files/files_edit.html:68
 
#: rhodecode/templates/pullrequests/pullrequest.html:124
 
#: rhodecode/templates/settings/repo_settings.html:94
 
msgid "Reset"
 
msgstr "重置"
 

	
 
#: rhodecode/templates/admin/repos/repo_edit.html:152
 
msgid "Administration"
 
msgstr "管理"
 

	
 
#: rhodecode/templates/admin/repos/repo_edit.html:155
 
msgid "Statistics"
 
msgstr "统计"
 

	
 
#: rhodecode/templates/admin/repos/repo_edit.html:159
 
msgid "Reset current statistics"
 
msgstr "重置统计"
 

	
 
#: rhodecode/templates/admin/repos/repo_edit.html:159
 
msgid "Confirm to remove current statistics"
 
msgstr "确认移除当前统计"
 

	
 
#: rhodecode/templates/admin/repos/repo_edit.html:162
 
msgid "Fetched to rev"
 
msgstr ""
 
msgstr "获取到修订"
 

	
 
#: rhodecode/templates/admin/repos/repo_edit.html:163
 
msgid "Stats gathered"
 
msgstr ""
 
msgstr "已收集的统计"
 

	
 
#: rhodecode/templates/admin/repos/repo_edit.html:171
 
msgid "Remote"
 
msgstr "远程"
 

	
 
#: rhodecode/templates/admin/repos/repo_edit.html:175
 
msgid "Pull changes from remote location"
 
msgstr ""
 
msgstr "从远程路径拉取修订集"
 

	
 
#: rhodecode/templates/admin/repos/repo_edit.html:175
 
msgid "Confirm to pull changes from remote side"
 
msgstr ""
 
msgstr "确认从远程拉取修订集"
 

	
 
#: rhodecode/templates/admin/repos/repo_edit.html:186
 
msgid "Cache"
 
msgstr "缓存"
 

	
 
#: rhodecode/templates/admin/repos/repo_edit.html:190
 
msgid "Invalidate repository cache"
 
msgstr ""
 
msgstr "清除版本库缓存"
 

	
 
#: rhodecode/templates/admin/repos/repo_edit.html:190
 
msgid "Confirm to invalidate repository cache"
 
msgstr "确认清除版本库缓存"
 

	
 
#: rhodecode/templates/admin/repos/repo_edit.html:195
 
#: rhodecode/templates/base/base.html:318
 
#: rhodecode/templates/base/base.html:320
 
#: rhodecode/templates/base/base.html:322
 
msgid "Public journal"
 
msgstr "公共日志"
 

	
 
#: rhodecode/templates/admin/repos/repo_edit.html:201
 
msgid "Remove from public journal"
 
msgstr "从公共日志删除"
 

	
 
#: rhodecode/templates/admin/repos/repo_edit.html:203
 
msgid "Add to public journal"
 
msgstr "添加到公共日志"
 

	
 
#: rhodecode/templates/admin/repos/repo_edit.html:208
 
msgid ""
 
"All actions made on this repository will be accessible to everyone in "
 
"public journal"
 
msgstr ""
 
"All actions made on this repository will be accessible to everyone in public "
 
"journal"
 
msgstr "任何人都可以在公共日志上看到这个版本库上的所有动作"
 

	
 
#: rhodecode/templates/admin/repos/repo_edit.html:215
 
#, fuzzy
 
msgid "Locking"
 
msgstr "解锁"
 
msgstr "锁定"
 

	
 
#: rhodecode/templates/admin/repos/repo_edit.html:220
 
msgid "Unlock locked repo"
 
msgstr ""
 
msgstr "解锁版本库"
 

	
 
#: rhodecode/templates/admin/repos/repo_edit.html:220
 
#, fuzzy
 
msgid "Confirm to unlock repository"
 
msgstr "确认删除版本库"
 
msgstr "确认解锁版本库"
 

	
 
#: rhodecode/templates/admin/repos/repo_edit.html:223
 
msgid "lock repo"
 
msgstr ""
 
msgstr "锁定版本库"
 

	
 
#: rhodecode/templates/admin/repos/repo_edit.html:223
 
#, fuzzy
 
msgid "Confirm to lock repository"
 
msgstr "确认删除版本库"
 
msgstr "确认锁定版本库"
 

	
 
#: rhodecode/templates/admin/repos/repo_edit.html:224
 
#, fuzzy
 
msgid "Repository is not locked"
 
msgstr "个版本库"
 
msgstr "版本库未锁定"
 

	
 
#: rhodecode/templates/admin/repos/repo_edit.html:229
 
msgid "Force locking on repository. Works only when anonymous access is disabled"
 
msgstr ""
 
msgid ""
 
"Force locking on repository. Works only when anonymous access is disabled"
 
msgstr "强制锁定版本库。只有在禁止匿名访问时候才有效"
 

	
 
#: rhodecode/templates/admin/repos/repo_edit.html:236
 
msgid "Set as fork of"
 
msgstr ""
 
msgstr "设置 fork 自"
 

	
 
#: rhodecode/templates/admin/repos/repo_edit.html:245
 
msgid "Manually set this repository as a fork of another from the list"
 
msgstr ""
 
msgstr "从列表中手动设置这个版本库 fork 自另一版本库"
 

	
 
#: rhodecode/templates/admin/repos/repo_edit.html:251
 
#: rhodecode/templates/changeset/changeset_file_comment.html:26
 
msgid "Delete"
 
msgstr "删除"
 

	
 
#: rhodecode/templates/admin/repos/repo_edit.html:255
 
msgid "Remove this repository"
 
msgstr "删除版本库"
 

	
 
#: rhodecode/templates/admin/repos/repo_edit.html:255
 
#: rhodecode/templates/journal/journal.html:84
 
msgid "Confirm to delete this repository"
 
msgstr "确认删除版本库"
 

	
 
#: rhodecode/templates/admin/repos/repo_edit.html:259
 
msgid ""
 
"This repository will be renamed in a special way in order to be "
 
"unaccesible for RhodeCode and VCS systems.\n"
 
"                         If you need fully delete it from filesystem "
 
"please do it manually"
 
"This repository will be renamed in a special way in order to be unaccesible "
 
"for RhodeCode and VCS systems.\n"
 
"                         If you need fully delete it from filesystem please "
 
"do it manually"
 
msgstr ""
 
"这个版本库将以特殊的方式重命名这样 RhodeCode 和版本控制系统将不能访问它。\n"
 
"                         如果需要从文件系统完全删除,你需要手动操作"
 

	
 
#: rhodecode/templates/admin/repos/repo_edit_perms.html:3
 
#: rhodecode/templates/admin/repos_groups/repos_group_edit_perms.html:3
 
msgid "none"
 
msgstr "无"
 

	
 
#: rhodecode/templates/admin/repos/repo_edit_perms.html:4
 
#: rhodecode/templates/admin/repos_groups/repos_group_edit_perms.html:4
 
msgid "read"
 
msgstr "读"
 

	
 
#: rhodecode/templates/admin/repos/repo_edit_perms.html:5
 
#: rhodecode/templates/admin/repos_groups/repos_group_edit_perms.html:5
 
msgid "write"
 
msgstr "写"
 

	
 
#: rhodecode/templates/admin/repos/repo_edit_perms.html:6
 
#: rhodecode/templates/admin/repos_groups/repos_group_edit_perms.html:6
 
#: rhodecode/templates/admin/users/users.html:85
 
#: rhodecode/templates/base/base.html:217
 
msgid "admin"
 
msgstr "管理员"
 

	
 
#: rhodecode/templates/admin/repos/repo_edit_perms.html:7
 
#: rhodecode/templates/admin/repos_groups/repos_group_edit_perms.html:7
 
msgid "member"
 
msgstr "成员"
 

	
 
#: rhodecode/templates/admin/repos/repo_edit_perms.html:16
 
#: rhodecode/templates/data_table/_dt_elements.html:67
 
#: rhodecode/templates/journal/journal.html:132
 
#: rhodecode/templates/summary/summary.html:76
 
msgid "private repository"
 
msgstr "私有版本库"
 

	
 
#: rhodecode/templates/admin/repos/repo_edit_perms.html:19
 
#: rhodecode/templates/admin/repos/repo_edit_perms.html:28
 
#: rhodecode/templates/admin/repos_groups/repos_group_edit_perms.html:18
 
#, fuzzy
 
msgid "default"
 
msgstr "删除"
 
msgstr "默认"
 

	
 
#: rhodecode/templates/admin/repos/repo_edit_perms.html:33
 
#: rhodecode/templates/admin/repos/repo_edit_perms.html:58
 
#: rhodecode/templates/admin/repos_groups/repos_group_edit_perms.html:23
 
#: rhodecode/templates/admin/repos_groups/repos_group_edit_perms.html:42
 
msgid "revoke"
 
msgstr ""
 
msgstr "移除"
 

	
 
#: rhodecode/templates/admin/repos/repo_edit_perms.html:83
 
#: rhodecode/templates/admin/repos_groups/repos_group_edit_perms.html:67
 
msgid "Add another member"
 
msgstr "添加成员"
 

	
 
#: rhodecode/templates/admin/repos/repo_edit_perms.html:97
 
#: rhodecode/templates/admin/repos_groups/repos_group_edit_perms.html:81
 
msgid "Failed to remove user"
 
msgstr "删除用户失败"
 

	
 
#: rhodecode/templates/admin/repos/repo_edit_perms.html:112
 
#: rhodecode/templates/admin/repos_groups/repos_group_edit_perms.html:96
 
msgid "Failed to remove users group"
 
msgstr "删除用户组失败"
 

	
 
#: rhodecode/templates/admin/repos/repos.html:5
 
msgid "Repositories administration"
 
msgstr "版本库管理员"
 

	
 
#: rhodecode/templates/admin/repos_groups/repos_groups.html:8
 
msgid "Groups"
 
msgstr "组"
 

	
 
#: rhodecode/templates/admin/repos_groups/repos_groups.html:12
 
msgid "with"
 
msgstr ""
 
msgstr ""
 

	
 
#: rhodecode/templates/admin/repos_groups/repos_groups_add.html:5
 
msgid "Add repos group"
 
msgstr "添加版本库组"
 

	
 
#: rhodecode/templates/admin/repos_groups/repos_groups_add.html:10
 
#: rhodecode/templates/admin/repos_groups/repos_groups_edit.html:10
 
msgid "Repos groups"
 
msgstr "版本库组"
 

	
 
#: rhodecode/templates/admin/repos_groups/repos_groups_add.html:12
 
msgid "add new repos group"
 
msgstr "添加新版本库组"
 

	
 
#: rhodecode/templates/admin/repos_groups/repos_groups_add.html:50
 
#: rhodecode/templates/admin/repos_groups/repos_groups_edit.html:50
 
msgid "Group parent"
 
msgstr "上级组"
 

	
 
#: rhodecode/templates/admin/repos_groups/repos_groups_add.html:58
 
#: rhodecode/templates/admin/users/user_add.html:94
 
#: rhodecode/templates/admin/users_groups/users_group_add.html:49
 
#: rhodecode/templates/admin/users_groups/users_group_edit.html:90
 
#: rhodecode/templates/pullrequests/pullrequest_show.html:113
 
msgid "save"
 
msgstr "保存"
 

	
 
#: rhodecode/templates/admin/repos_groups/repos_groups_edit.html:5
 
msgid "Edit repos group"
 
msgstr "编辑版本库组"
 

	
 
#: rhodecode/templates/admin/repos_groups/repos_groups_edit.html:12
 
msgid "edit repos group"
 
msgstr "编辑版本库组"
 

	
 
#: rhodecode/templates/admin/repos_groups/repos_groups_edit.html:70
 
msgid ""
 
"Enable lock-by-pulling on group. This option will be applied to all other"
 
" groups and repositories inside"
 
msgstr ""
 
"Enable lock-by-pulling on group. This option will be applied to all other "
 
"groups and repositories inside"
 
msgstr "启用组的拉取锁定。这个选项将应用到组内的其他组和版本库"
 

	
 
#: rhodecode/templates/admin/repos_groups/repos_groups_show.html:5
 
msgid "Repositories groups administration"
 
msgstr "版本库管理员"
 

	
 
#: rhodecode/templates/admin/repos_groups/repos_groups_show.html:22
 
msgid "ADD NEW GROUP"
 
msgstr "添加组"
 

	
 
#: rhodecode/templates/admin/repos_groups/repos_groups_show.html:35
 
#, fuzzy
 
msgid "Number of toplevel repositories"
 
msgstr "版本库数量"
 
msgstr "顶层版本库数量"
 

	
 
#: rhodecode/templates/admin/repos_groups/repos_groups_show.html:36
 
#: rhodecode/templates/admin/users/users.html:87
 
#: rhodecode/templates/admin/users_groups/users_groups.html:35
 
msgid "action"
 
msgstr "操作"
 

	
 
#: rhodecode/templates/admin/repos_groups/repos_groups_show.html:54
 
#: rhodecode/templates/admin/users/user_edit.html:255
 
#: rhodecode/templates/admin/users_groups/users_groups.html:44
 
#: rhodecode/templates/data_table/_dt_elements.html:7
 
#: rhodecode/templates/data_table/_dt_elements.html:103
 
msgid "delete"
 
msgstr "删除"
 

	
 
#: rhodecode/templates/admin/repos_groups/repos_groups_show.html:54
 
#, fuzzy, python-format
 
#, python-format
 
msgid "Confirm to delete this group: %s"
 
msgstr "确认删除该组"
 
msgstr "确认删除该版本库组: %s"
 

	
 
#: rhodecode/templates/admin/repos_groups/repos_groups_show.html:62
 
msgid "There are no repositories groups yet"
 
msgstr "没有版本库组"
 

	
 
#: rhodecode/templates/admin/settings/hooks.html:5
 
#: rhodecode/templates/admin/settings/settings.html:5
 
msgid "Settings administration"
 
msgstr "设置管理员"
 

	
 
#: rhodecode/templates/admin/settings/hooks.html:9
 
#: rhodecode/templates/admin/settings/settings.html:9
 
#: rhodecode/templates/settings/repo_settings.html:13
 
msgid "Settings"
 
msgstr "设置"
 

	
 
#: rhodecode/templates/admin/settings/hooks.html:24
 
msgid "Built in hooks - read only"
 
msgstr "内建钩子 - 只读"
 

	
 
#: rhodecode/templates/admin/settings/hooks.html:40
 
msgid "Custom hooks"
 
msgstr "自定义钩子"
 

	
 
#: rhodecode/templates/admin/settings/hooks.html:56
 
msgid "remove"
 
msgstr "删除"
 

	
 
#: rhodecode/templates/admin/settings/hooks.html:88
 
msgid "Failed to remove hook"
 
msgstr "移除钩子失败"
 

	
 
#: rhodecode/templates/admin/settings/settings.html:24
 
msgid "Remap and rescan repositories"
 
msgstr "重新扫描并映射版本库"
 

	
 
#: rhodecode/templates/admin/settings/settings.html:32
 
msgid "rescan option"
 
msgstr "重新扫描选项"
 

	
 
#: rhodecode/templates/admin/settings/settings.html:38
 
msgid ""
 
"In case a repository was deleted from filesystem and there are leftovers "
 
"in the database check this option to scan obsolete data in database and "
 
"remove it."
 
msgstr "如果版本库已经从文件系统删除,但数据库仍然有遗留信息,请勾选该项进行清理"
 
"In case a repository was deleted from filesystem and there are leftovers in "
 
"the database check this option to scan obsolete data in database and remove "
 
"it."
 
msgstr ""
 
"如果版本库已经从文件系统删除,但数据库仍然有遗留信息,请勾选该项进行清理"
 

	
 
#: rhodecode/templates/admin/settings/settings.html:39
 
msgid "destroy old data"
 
msgstr "清理旧数据"
 

	
 
#: rhodecode/templates/admin/settings/settings.html:41
 
msgid ""
 
"Rescan repositories location for new repositories. Also deletes obsolete "
 
"if `destroy` flag is checked "
 
"Rescan repositories location for new repositories. Also deletes obsolete if "
 
"`destroy` flag is checked "
 
msgstr ""
 
"重新扫描版本库路径以发现新版本库。 同时删除过时的,如果设置有 `destroy` 标志"
 

	
 
#: rhodecode/templates/admin/settings/settings.html:46
 
msgid "Rescan repositories"
 
msgstr "重新扫描版本库"
 

	
 
#: rhodecode/templates/admin/settings/settings.html:52
 
msgid "Whoosh indexing"
 
msgstr "Whoosh 索引"
 

	
 
#: rhodecode/templates/admin/settings/settings.html:60
 
msgid "index build option"
 
msgstr "构建索引选项"
 

	
 
#: rhodecode/templates/admin/settings/settings.html:65
 
msgid "build from scratch"
 
msgstr "重新建立"
 

	
 
#: rhodecode/templates/admin/settings/settings.html:71
 
msgid "Reindex"
 
msgstr "重新索引"
 

	
 
#: rhodecode/templates/admin/settings/settings.html:77
 
msgid "Global application settings"
 
msgstr "全局设置"
 

	
 
#: rhodecode/templates/admin/settings/settings.html:86
 
msgid "Application name"
 
msgstr "应用名称"
 

	
 
#: rhodecode/templates/admin/settings/settings.html:95
 
msgid "Realm text"
 
msgstr ""
 
msgstr "Realm text"
 

	
 
#: rhodecode/templates/admin/settings/settings.html:104
 
msgid "GA code"
 
msgstr ""
 
msgstr "GA code"
 

	
 
#: rhodecode/templates/admin/settings/settings.html:112
 
#: rhodecode/templates/admin/settings/settings.html:167
 
#: rhodecode/templates/admin/settings/settings.html:257
 
msgid "Save settings"
 
msgstr "保存设置"
 

	
 
#: rhodecode/templates/admin/settings/settings.html:119
 
#, fuzzy
 
msgid "Visualisation settings"
 
msgstr "全局设置"
 
msgstr "可视化设置"
 

	
 
#: rhodecode/templates/admin/settings/settings.html:128
 
#, fuzzy
 
msgid "Icons"
 
msgstr "选项"
 
msgstr "图标"
 

	
 
#: rhodecode/templates/admin/settings/settings.html:133
 
msgid "Show public repo icon on repositories"
 
msgstr ""
 
msgstr "显示公共版本库图标"
 

	
 
#: rhodecode/templates/admin/settings/settings.html:137
 
#, fuzzy
 
msgid "Show private repo icon on repositories"
 
msgstr "私有版本库"
 
msgstr "显示私有版本库图标"
 

	
 
#: rhodecode/templates/admin/settings/settings.html:144
 
#, fuzzy
 
msgid "Meta-Tagging"
 
msgstr "设置"
 
msgstr "元标记"
 

	
 
#: rhodecode/templates/admin/settings/settings.html:149
 
msgid "Stylify recognised metatags:"
 
msgstr ""
 
msgstr "样式化识别的元标记"
 

	
 
#: rhodecode/templates/admin/settings/settings.html:176
 
#, fuzzy
 
msgid "VCS settings"
 
msgstr "设置"
 
msgstr "版本控制系统设置"
 

	
 
#: rhodecode/templates/admin/settings/settings.html:185
 
msgid "Web"
 
msgstr ""
 
msgstr "网络"
 

	
 
#: rhodecode/templates/admin/settings/settings.html:190
 
#, fuzzy
 
msgid "require ssl for vcs operations"
 
msgstr "使用 SSL 推送"
 
msgstr "要求使用 SSL进行版本控制系统操作"
 

	
 
#: rhodecode/templates/admin/settings/settings.html:192
 
msgid ""
 
"RhodeCode will require SSL for pushing or pulling. If SSL is missing it "
 
"will return HTTP Error 406: Not Acceptable"
 
"RhodeCode will require SSL for pushing or pulling. If SSL is missing it will "
 
"return HTTP Error 406: Not Acceptable"
 
msgstr ""
 
"勾选后 RhodeCode 将要求使用 SSL 进行推送和拉取。如果没有使用 SSL 将返回 HTTP "
 
"406错误:Not Acceptable"
 

	
 
#: rhodecode/templates/admin/settings/settings.html:198
 
msgid "Hooks"
 
msgstr ""
 
msgstr "钩子"
 

	
 
#: rhodecode/templates/admin/settings/settings.html:203
 
msgid "Update repository after push (hg update)"
 
msgstr "推送后更新版本库(hg update)"
 

	
 
#: rhodecode/templates/admin/settings/settings.html:207
 
msgid "Show repository size after push"
 
msgstr "推送后显示版本库大小"
 

	
 
#: rhodecode/templates/admin/settings/settings.html:211
 
msgid "Log user push commands"
 
msgstr "记录用户推送命令"
 

	
 
#: rhodecode/templates/admin/settings/settings.html:215
 
msgid "Log user pull commands"
 
msgstr "记录用户拉取命令"
 

	
 
#: rhodecode/templates/admin/settings/settings.html:219
 
msgid "advanced setup"
 
msgstr "高级设置"
 

	
 
#: rhodecode/templates/admin/settings/settings.html:224
 
#, fuzzy
 
msgid "Mercurial Extensions"
 
msgstr "Mercurial 版本库"
 
msgstr "Mercurial 扩展"
 

	
 
#: rhodecode/templates/admin/settings/settings.html:229
 
msgid "largefiles extensions"
 
msgstr ""
 
msgstr "大文件扩展"
 

	
 
#: rhodecode/templates/admin/settings/settings.html:233
 
msgid "hgsubversion extensions"
 
msgstr ""
 
msgstr "hgsubversion 扩展"
 

	
 
#: rhodecode/templates/admin/settings/settings.html:235
 
msgid ""
 
"Requires hgsubversion library installed. Allows clonning from svn remote "
 
"locations"
 
msgstr ""
 
msgstr " 允许从远程 svn 地址克隆。需要安装 hgsubversion 库"
 

	
 
#: rhodecode/templates/admin/settings/settings.html:245
 
msgid "Repositories location"
 
msgstr "版本库路径"
 

	
 
#: rhodecode/templates/admin/settings/settings.html:250
 
msgid ""
 
"This a crucial application setting. If you are really sure you need to "
 
"change this, you must restart application in order to make this setting "
 
"take effect. Click this label to unlock."
 
"change this, you must restart application in order to make this setting take "
 
"effect. Click this label to unlock."
 
msgstr "这是一个关键设置。如果确认修改该项设置,请重启服务以便设置生效。"
 

	
 
#: rhodecode/templates/admin/settings/settings.html:251
 
msgid "unlock"
 
msgstr "解锁"
 

	
 
#: rhodecode/templates/admin/settings/settings.html:252
 
msgid ""
 
"Location where repositories are stored. After changing this value a "
 
"restart, and rescan is required"
 
msgstr ""
 
"Location where repositories are stored. After changing this value a restart, "
 
"and rescan is required"
 
msgstr "版本库存储路径。 修改后需要重启和重新扫描"
 

	
 
#: rhodecode/templates/admin/settings/settings.html:272
 
msgid "Test Email"
 
msgstr ""
 
msgstr "测试邮件"
 

	
 
#: rhodecode/templates/admin/settings/settings.html:280
 
#, fuzzy
 
msgid "Email to"
 
msgstr "电子邮件"
 
msgstr "发送到"
 

	
 
#: rhodecode/templates/admin/settings/settings.html:288
 
#, fuzzy
 
msgid "Send"
 
msgstr ""
 
msgstr "发送"
 

	
 
#: rhodecode/templates/admin/settings/settings.html:294
 
msgid "System Info and Packages"
 
msgstr ""
 
msgstr "系统和软件包信息"
 

	
 
#: rhodecode/templates/admin/settings/settings.html:297
 
#, fuzzy
 
msgid "show"
 
msgstr "显示"
 

	
 
#: rhodecode/templates/admin/users/user_add.html:5
 
msgid "Add user"
 
msgstr "添加用户"
 

	
 
#: rhodecode/templates/admin/users/user_add.html:10
 
#: rhodecode/templates/admin/users/user_edit.html:11
 
msgid "Users"
 
msgstr "用户"
 

	
 
#: rhodecode/templates/admin/users/user_add.html:12
 
msgid "add new user"
 
msgstr "添加新用户"
 

	
 
#: rhodecode/templates/admin/users/user_add.html:50
 
#, fuzzy
 
msgid "Password confirmation"
 
msgstr "密码不符"
 
msgstr "确认密码"
 

	
 
#: rhodecode/templates/admin/users/user_add.html:86
 
#: rhodecode/templates/admin/users/user_edit.html:113
 
#: rhodecode/templates/admin/users_groups/users_group_add.html:41
 
#: rhodecode/templates/admin/users_groups/users_group_edit.html:42
 
msgid "Active"
 
msgstr "启用"
 

	
 
#: rhodecode/templates/admin/users/user_edit.html:5
 
msgid "Edit user"
 
msgstr "编辑用户"
 

	
 
#: rhodecode/templates/admin/users/user_edit.html:34
 
#: rhodecode/templates/admin/users/user_edit_my_account_form.html:10
 
msgid "Change your avatar at"
 
msgstr "修改你的头像"
 

	
 
#: rhodecode/templates/admin/users/user_edit.html:35
 
#: rhodecode/templates/admin/users/user_edit_my_account_form.html:11
 
msgid "Using"
 
msgstr "使用中"
 

	
 
#: rhodecode/templates/admin/users/user_edit.html:43
 
#: rhodecode/templates/admin/users/user_edit_my_account_form.html:20
 
msgid "API key"
 
msgstr ""
 
msgstr "API 密钥"
 

	
 
#: rhodecode/templates/admin/users/user_edit.html:59
 
msgid "LDAP DN"
 
msgstr ""
 
msgstr "LDAP DN"
 

	
 
#: rhodecode/templates/admin/users/user_edit.html:68
 
#: rhodecode/templates/admin/users/user_edit_my_account_form.html:35
 
msgid "New password"
 
msgstr "新密码"
 

	
 
#: rhodecode/templates/admin/users/user_edit.html:77
 
#: rhodecode/templates/admin/users/user_edit_my_account_form.html:44
 
msgid "New password confirmation"
 
msgstr ""
 
msgstr "确认新密码"
 

	
 
#: rhodecode/templates/admin/users/user_edit.html:147
 
#: rhodecode/templates/admin/users_groups/users_group_edit.html:108
 
#, fuzzy
 
msgid "Inherit default permissions"
 
msgstr "默认权限"
 
msgstr "继承默认权限"
 

	
 
#: rhodecode/templates/admin/users/user_edit.html:152
 
#: rhodecode/templates/admin/users_groups/users_group_edit.html:113
 
#, python-format
 
msgid ""
 
"Select to inherit permissions from %s settings. With this selected below "
 
"options does not have any action"
 
msgstr ""
 
msgstr "勾选以从 %s 继承权限设置。 勾选后下面的选项将不起作用"
 

	
 
#: rhodecode/templates/admin/users/user_edit.html:158
 
#: rhodecode/templates/admin/users_groups/users_group_edit.html:119
 
msgid "Create repositories"
 
msgstr "创建版本库"
 

	
 
#: rhodecode/templates/admin/users/user_edit.html:166
 
#: rhodecode/templates/admin/users_groups/users_group_edit.html:127
 
#, fuzzy
 
msgid "Fork repositories"
 
msgstr "个版本库"
 
msgstr "分支版本库"
 

	
 
#: rhodecode/templates/admin/users/user_edit.html:186
 
#: rhodecode/templates/admin/users/user_edit_my_account_pullrequests.html:22
 
#: rhodecode/templates/admin/users/user_edit_my_account_pullrequests.html:39
 
#, fuzzy
 
msgid "Nothing here yet"
 
msgstr "尚无操作"
 
msgstr "无条目"
 

	
 
#: rhodecode/templates/admin/users/user_edit.html:193
 
#: rhodecode/templates/admin/users/user_edit_my_account.html:60
 
#: rhodecode/templates/admin/users/user_edit_my_account.html:194
 
#, fuzzy
 
msgid "Permission"
 
msgstr "权限"
 

	
 
#: rhodecode/templates/admin/users/user_edit.html:194
 
#, fuzzy
 
msgid "Edit Permission"
 
msgstr "版本库权限"
 
msgstr "编辑权限"
 

	
 
#: rhodecode/templates/admin/users/user_edit.html:243
 
#, fuzzy
 
msgid "Email addresses"
 
msgstr "邮件地址"
 

	
 
#: rhodecode/templates/admin/users/user_edit.html:256
 
#, fuzzy, python-format
 
#, python-format
 
msgid "Confirm to delete this email: %s"
 
msgstr "确认删除该用户"
 
msgstr "确认删除邮件地址: %s"
 

	
 
#: rhodecode/templates/admin/users/user_edit.html:270
 
#, fuzzy
 
msgid "New email address"
 
msgstr "邮件地址"
 
msgstr "增加邮件地址"
 

	
 
#: rhodecode/templates/admin/users/user_edit.html:277
 
#, fuzzy
 
msgid "Add"
 
msgstr "新增"
 
msgstr "增加"
 

	
 
#: rhodecode/templates/admin/users/user_edit_my_account.html:5
 
#: rhodecode/templates/base/base.html:124
 
msgid "My account"
 
msgstr "我的账户"
 

	
 
#: rhodecode/templates/admin/users/user_edit_my_account.html:9
 
msgid "My Account"
 
msgstr "我的账户"
 

	
 
#: rhodecode/templates/admin/users/user_edit_my_account.html:35
 
#, fuzzy
 
msgid "My permissions"
 
msgstr "权限"
 
msgstr "我的权限"
 

	
 
#: rhodecode/templates/admin/users/user_edit_my_account.html:38
 
#: rhodecode/templates/journal/journal.html:41
 
#, fuzzy
 
msgid "My repos"
 
msgstr "空版本库"
 
msgstr "我的版本库"
 

	
 
#: rhodecode/templates/admin/users/user_edit_my_account.html:41
 
#, fuzzy
 
msgid "My pull requests"
 
msgstr "创建用户 %s"
 
msgstr "我的拉取请求"
 

	
 
#: rhodecode/templates/admin/users/user_edit_my_account.html:45
 
#, fuzzy
 
msgid "Add repo"
 
msgstr "新增"
 
msgstr "新建版本库"
 

	
 
#: rhodecode/templates/admin/users/user_edit_my_account_pullrequests.html:2
 
msgid "Opened by me"
 
msgstr ""
 
msgstr "我创建的"
 

	
 
#: rhodecode/templates/admin/users/user_edit_my_account_pullrequests.html:10
 
#, python-format
 
msgid "Pull request #%s opened on %s"
 
msgstr ""
 
msgstr "拉取请求 #%s 创建于 %s"
 

	
 
#: rhodecode/templates/admin/users/user_edit_my_account_pullrequests.html:15
 
#, fuzzy
 
msgid "Confirm to delete this pull request"
 
msgstr "确认删除版本库"
 
msgstr "确认删除拉取请求"
 

	
 
#: rhodecode/templates/admin/users/user_edit_my_account_pullrequests.html:26
 
msgid "I participate in"
 
msgstr ""
 
msgstr "我参与的"
 

	
 
#: rhodecode/templates/admin/users/user_edit_my_account_pullrequests.html:33
 
#: rhodecode/templates/pullrequests/pullrequest_show_all.html:30
 
#, python-format
 
msgid "Pull request #%s opened by %s on %s"
 
msgstr ""
 
msgstr "拉取请求 #%s 由 %s 创建于 %s"
 

	
 
#: rhodecode/templates/admin/users/user_edit_my_account_repos.html:7
 
#: rhodecode/templates/bookmarks/bookmarks.html:40
 
#: rhodecode/templates/bookmarks/bookmarks_data.html:9
 
#: rhodecode/templates/branches/branches.html:55
 
#: rhodecode/templates/journal/journal.html:60
 
#: rhodecode/templates/tags/tags.html:40
 
#: rhodecode/templates/tags/tags_data.html:9
 
msgid "Revision"
 
msgstr "修订"
 

	
 
#: rhodecode/templates/admin/users/user_edit_my_account_repos.html:28
 
#: rhodecode/templates/journal/journal.html:81
 
msgid "private"
 
msgstr "私有"
 

	
 
#: rhodecode/templates/admin/users/user_edit_my_account_repos.html:31
 
#: rhodecode/templates/data_table/_dt_elements.html:7
 
#, fuzzy, python-format
 
#, python-format
 
msgid "Confirm to delete this repository: %s"
 
msgstr "确认删除版本库"
 
msgstr "确认删除版本库: %s"
 

	
 
#: rhodecode/templates/admin/users/user_edit_my_account_repos.html:38
 
#: rhodecode/templates/journal/journal.html:94
 
msgid "No repositories yet"
 
msgstr "没有任何版本库"
 

	
 
#: rhodecode/templates/admin/users/user_edit_my_account_repos.html:40
 
#: rhodecode/templates/journal/journal.html:96
 
msgid "create one now"
 
msgstr ""
 
msgstr "创建一个"
 

	
 
#: rhodecode/templates/admin/users/users.html:5
 
msgid "Users administration"
 
msgstr "用户管理员"
 

	
 
#: rhodecode/templates/admin/users/users.html:9
 
#: rhodecode/templates/base/base.html:223
 
msgid "users"
 
msgstr "用户"
 

	
 
#: rhodecode/templates/admin/users/users.html:23
 
msgid "ADD NEW USER"
 
msgstr "添加用户"
 

	
 
#: rhodecode/templates/admin/users/users.html:77
 
msgid "username"
 
msgstr "用户名"
 

	
 
#: rhodecode/templates/admin/users/users.html:80
 
#, fuzzy
 
msgid "firstname"
 
msgstr "名"
 

	
 
#: rhodecode/templates/admin/users/users.html:81
 
msgid "lastname"
 
msgstr "姓"
 

	
 
#: rhodecode/templates/admin/users/users.html:82
 
msgid "last login"
 
msgstr "最后登录"
 

	
 
#: rhodecode/templates/admin/users/users.html:84
 
#: rhodecode/templates/admin/users_groups/users_groups.html:34
 
msgid "active"
 
msgstr "启用"
 

	
 
#: rhodecode/templates/admin/users/users.html:86
 
#: rhodecode/templates/base/base.html:226
 
msgid "ldap"
 
msgstr ""
 
msgstr "LDAP"
 

	
 
#: rhodecode/templates/admin/users_groups/users_group_add.html:5
 
msgid "Add users group"
 
msgstr "添加用户组"
 

	
 
#: rhodecode/templates/admin/users_groups/users_group_add.html:10
 
#: rhodecode/templates/admin/users_groups/users_groups.html:9
 
msgid "Users groups"
 
msgstr "用户组"
 

	
 
#: rhodecode/templates/admin/users_groups/users_group_add.html:12
 
msgid "add new users group"
 
msgstr "添加新用户组"
 

	
 
#: rhodecode/templates/admin/users_groups/users_group_edit.html:5
 
msgid "Edit users group"
 
msgstr "编辑用户组"
 

	
 
#: rhodecode/templates/admin/users_groups/users_group_edit.html:11
 
msgid "UsersGroups"
 
msgstr "用户组"
 

	
 
#: rhodecode/templates/admin/users_groups/users_group_edit.html:50
 
msgid "Members"
 
msgstr "成员"
 

	
 
#: rhodecode/templates/admin/users_groups/users_group_edit.html:58
 
msgid "Choosen group members"
 
msgstr "选择组成员"
 

	
 
#: rhodecode/templates/admin/users_groups/users_group_edit.html:61
 
msgid "Remove all elements"
 
msgstr "移除全部项目"
 

	
 
#: rhodecode/templates/admin/users_groups/users_group_edit.html:75
 
msgid "Available members"
 
msgstr "启用成员"
 

	
 
#: rhodecode/templates/admin/users_groups/users_group_edit.html:79
 
msgid "Add all elements"
 
msgstr "添加全部项目"
 

	
 
#: rhodecode/templates/admin/users_groups/users_group_edit.html:146
 
#, fuzzy
 
msgid "Group members"
 
msgstr "选择组成员"
 
msgstr "拥护者成员"
 

	
 
#: rhodecode/templates/admin/users_groups/users_groups.html:5
 
msgid "Users groups administration"
 
msgstr "用户组管理"
 

	
 
#: rhodecode/templates/admin/users_groups/users_groups.html:23
 
msgid "ADD NEW USER GROUP"
 
msgstr "添加新用户组"
 

	
 
#: rhodecode/templates/admin/users_groups/users_groups.html:32
 
msgid "group name"
 
msgstr "组名"
 

	
 
#: rhodecode/templates/admin/users_groups/users_groups.html:33
 
#: rhodecode/templates/base/root.html:46
 
msgid "members"
 
msgstr "成员"
 

	
 
#: rhodecode/templates/admin/users_groups/users_groups.html:45
 
#, fuzzy, python-format
 
#, python-format
 
msgid "Confirm to delete this users group: %s"
 
msgstr "确认删除该组"
 
msgstr "确认删除该组: %s"
 

	
 
#: rhodecode/templates/base/base.html:41
 
msgid "Submit a bug"
 
msgstr "提交 bug"
 

	
 
#: rhodecode/templates/base/base.html:77
 
msgid "Login to your account"
 
msgstr ""
 
msgstr "登录"
 

	
 
#: rhodecode/templates/base/base.html:100
 
msgid "Forgot password ?"
 
msgstr "忘记密码?"
 

	
 
#: rhodecode/templates/base/base.html:107
 
#, fuzzy
 
msgid "Log In"
 
msgstr "登录"
 

	
 
#: rhodecode/templates/base/base.html:118
 
msgid "Inbox"
 
msgstr ""
 
msgstr "收件箱"
 

	
 
#: rhodecode/templates/base/base.html:122
 
#: rhodecode/templates/base/base.html:300
 
#: rhodecode/templates/base/base.html:302
 
#: rhodecode/templates/base/base.html:304
 
#: rhodecode/templates/bookmarks/bookmarks.html:11
 
#: rhodecode/templates/branches/branches.html:10
 
#: rhodecode/templates/changelog/changelog.html:10
 
#: rhodecode/templates/changeset/changeset.html:10
 
#: rhodecode/templates/changeset/changeset_range.html:9
 
#: rhodecode/templates/compare/compare_diff.html:9
 
#: rhodecode/templates/files/file_diff.html:8
 
#: rhodecode/templates/files/files.html:8
 
#: rhodecode/templates/files/files_add.html:15
 
#: rhodecode/templates/files/files_edit.html:15
 
#: rhodecode/templates/followers/followers.html:9
 
#: rhodecode/templates/forks/fork.html:9 rhodecode/templates/forks/forks.html:9
 
#: rhodecode/templates/forks/fork.html:9
 
#: rhodecode/templates/forks/forks.html:9
 
#: rhodecode/templates/pullrequests/pullrequest.html:8
 
#: rhodecode/templates/pullrequests/pullrequest_show.html:8
 
#: rhodecode/templates/pullrequests/pullrequest_show_all.html:8
 
#: rhodecode/templates/settings/repo_settings.html:9
 
#: rhodecode/templates/shortlog/shortlog.html:10
 
#: rhodecode/templates/summary/summary.html:8
 
#: rhodecode/templates/tags/tags.html:11
 
msgid "Home"
 
msgstr "首页"
 

	
 
#: rhodecode/templates/base/base.html:123
 
#: rhodecode/templates/base/base.html:309
 
#: rhodecode/templates/base/base.html:311
 
#: rhodecode/templates/base/base.html:313
 
#: rhodecode/templates/journal/journal.html:4
 
#: rhodecode/templates/journal/journal.html:21
 
#: rhodecode/templates/journal/public_journal.html:4
 
msgid "Journal"
 
msgstr "日志"
 

	
 
#: rhodecode/templates/base/base.html:125
 
msgid "Log Out"
 
msgstr "退出"
 

	
 
#: rhodecode/templates/base/base.html:144
 
msgid "Switch repository"
 
msgstr "切换版本库"
 

	
 
#: rhodecode/templates/base/base.html:146
 
msgid "Products"
 
msgstr ""
 
msgstr "产品"
 

	
 
#: rhodecode/templates/base/base.html:152
 
#: rhodecode/templates/base/base.html:182
 
msgid "loading..."
 
msgstr ""
 
msgstr "载入中..."
 

	
 
#: rhodecode/templates/base/base.html:158
 
#: rhodecode/templates/base/base.html:160
 
#: rhodecode/templates/base/base.html:162
 
#: rhodecode/templates/data_table/_dt_elements.html:15
 
#: rhodecode/templates/data_table/_dt_elements.html:17
 
#: rhodecode/templates/data_table/_dt_elements.html:19
 
msgid "Summary"
 
msgstr "概况"
 

	
 
#: rhodecode/templates/base/base.html:166
 
#: rhodecode/templates/base/base.html:168
 
#: rhodecode/templates/base/base.html:170
 
#: rhodecode/templates/changelog/changelog.html:15
 
#: rhodecode/templates/data_table/_dt_elements.html:23
 
#: rhodecode/templates/data_table/_dt_elements.html:25
 
#: rhodecode/templates/data_table/_dt_elements.html:27
 
msgid "Changelog"
 
msgstr "修改记录"
 
msgstr "修订记录"
 

	
 
#: rhodecode/templates/base/base.html:175
 
#: rhodecode/templates/base/base.html:177
 
#: rhodecode/templates/base/base.html:179
 
msgid "Switch to"
 
msgstr "切换到"
 

	
 
#: rhodecode/templates/base/base.html:186
 
#: rhodecode/templates/base/base.html:188
 
#: rhodecode/templates/base/base.html:190
 
#: rhodecode/templates/data_table/_dt_elements.html:31
 
#: rhodecode/templates/data_table/_dt_elements.html:33
 
#: rhodecode/templates/data_table/_dt_elements.html:35
 
msgid "Files"
 
msgstr "档案"
 
msgstr "浏览"
 

	
 
#: rhodecode/templates/base/base.html:195
 
#: rhodecode/templates/base/base.html:199
 
msgid "Options"
 
msgstr "选项"
 

	
 
#: rhodecode/templates/base/base.html:204
 
#: rhodecode/templates/base/base.html:206
 
#: rhodecode/templates/base/base.html:227
 
msgid "settings"
 
msgstr "设置"
 

	
 
#: rhodecode/templates/base/base.html:209
 
#: rhodecode/templates/data_table/_dt_elements.html:80
 
#: rhodecode/templates/forks/fork.html:13
 
msgid "fork"
 
msgstr ""
 
msgstr "分支"
 

	
 
#: rhodecode/templates/base/base.html:211
 
#: rhodecode/templates/changelog/changelog.html:40
 
msgid "Open new pull request"
 
msgstr ""
 
msgstr "新建拉取请求"
 

	
 
#: rhodecode/templates/base/base.html:213
 
msgid "search"
 
msgstr "搜索"
 

	
 
#: rhodecode/templates/base/base.html:222
 
msgid "repositories groups"
 
msgstr "版本库组"
 

	
 
#: rhodecode/templates/base/base.html:224
 
msgid "users groups"
 
msgstr "用户组"
 

	
 
#: rhodecode/templates/base/base.html:225
 
msgid "permissions"
 
msgstr "权限"
 

	
 
#: rhodecode/templates/base/base.html:238
 
#: rhodecode/templates/base/base.html:240
 
msgid "Followers"
 
msgstr "跟随者"
 
msgstr "关注者"
 

	
 
#: rhodecode/templates/base/base.html:246
 
#: rhodecode/templates/base/base.html:248
 
msgid "Forks"
 
msgstr ""
 
msgstr "分支"
 

	
 
#: rhodecode/templates/base/base.html:327
 
#: rhodecode/templates/base/base.html:329
 
#: rhodecode/templates/base/base.html:331
 
#: rhodecode/templates/search/search.html:52
 
msgid "Search"
 
msgstr "搜索"
 

	
 
#: rhodecode/templates/base/root.html:42
 
#, fuzzy
 
msgid "add another comment"
 
msgstr "添加成员"
 
msgstr "添加新的评论"
 

	
 
#: rhodecode/templates/base/root.html:43
 
#: rhodecode/templates/journal/journal.html:120
 
#: rhodecode/templates/summary/summary.html:57
 
msgid "Stop following this repository"
 
msgstr "停止跟随该版本库"
 
msgstr "停止关注该版本库"
 

	
 
#: rhodecode/templates/base/root.html:44
 
#: rhodecode/templates/summary/summary.html:61
 
msgid "Start following this repository"
 
msgstr "开始跟随该版本库"
 
msgstr "开始关注该版本库"
 

	
 
#: rhodecode/templates/base/root.html:45
 
msgid "Group"
 
msgstr "组"
 

	
 
#: rhodecode/templates/base/root.html:47
 
msgid "search truncated"
 
msgstr ""
 
msgstr "搜索被截断"
 

	
 
#: rhodecode/templates/base/root.html:48
 
msgid "no matching files"
 
msgstr "没有符合的文件"
 

	
 
#: rhodecode/templates/bookmarks/bookmarks.html:5
 
#, python-format
 
msgid "%s Bookmarks"
 
msgstr ""
 
msgstr "%s 书签"
 

	
 
#: rhodecode/templates/bookmarks/bookmarks.html:39
 
#: rhodecode/templates/bookmarks/bookmarks_data.html:8
 
#: rhodecode/templates/branches/branches.html:54
 
#: rhodecode/templates/tags/tags.html:39
 
#: rhodecode/templates/tags/tags_data.html:8
 
#, fuzzy
 
msgid "Author"
 
msgstr "作者"
 

	
 
#: rhodecode/templates/branches/branches.html:5
 
#, fuzzy, python-format
 
#, python-format
 
msgid "%s Branches"
 
msgstr "分支"
 
msgstr "%s 分支"
 

	
 
#: rhodecode/templates/branches/branches.html:29
 
#, fuzzy
 
msgid "Compare branches"
 
msgstr "分支"
 
msgstr "比较分支"
 

	
 
#: rhodecode/templates/branches/branches.html:57
 
#: rhodecode/templates/compare/compare_diff.html:5
 
#: rhodecode/templates/compare/compare_diff.html:13
 
#, fuzzy
 
msgid "Compare"
 
msgstr "比较显示"
 

	
 
#: rhodecode/templates/branches/branches_data.html:6
 
msgid "name"
 
msgstr "名称"
 

	
 
#: rhodecode/templates/branches/branches_data.html:7
 
msgid "date"
 
msgstr "日期"
 

	
 
#: rhodecode/templates/branches/branches_data.html:8
 
#: rhodecode/templates/shortlog/shortlog_data.html:8
 
msgid "author"
 
msgstr "作者"
 

	
 
#: rhodecode/templates/branches/branches_data.html:9
 
#: rhodecode/templates/shortlog/shortlog_data.html:5
 
msgid "revision"
 
msgstr "修订"
 

	
 
#: rhodecode/templates/branches/branches_data.html:10
 
#, fuzzy
 
msgid "compare"
 
msgstr "比较显示"
 

	
 
#: rhodecode/templates/changelog/changelog.html:6
 
#, fuzzy, python-format
 
#, python-format
 
msgid "%s Changelog"
 
msgstr "修改记录"
 
msgstr "%s 修订记录"
 

	
 
#: rhodecode/templates/changelog/changelog.html:15
 
#, python-format
 
msgid "showing %d out of %d revision"
 
msgid_plural "showing %d out of %d revisions"
 
msgstr[0] ""
 
msgstr[0] "显示 %2d 中的 %1d 个版本"
 

	
 
#: rhodecode/templates/changelog/changelog.html:37
 
#: rhodecode/templates/forks/forks_data.html:19
 
#, python-format
 
msgid "compare fork with %s"
 
msgstr ""
 
msgstr " %s 比较"
 

	
 
#: rhodecode/templates/changelog/changelog.html:37
 
#: rhodecode/templates/forks/forks_data.html:21
 
msgid "Compare fork"
 
msgstr ""
 
msgstr "比较分支"
 

	
 
#: rhodecode/templates/changelog/changelog.html:46
 
msgid "Show"
 
msgstr "显示"
 

	
 
#: rhodecode/templates/changelog/changelog.html:72
 
#: rhodecode/templates/summary/summary.html:364
 
msgid "show more"
 
msgstr ""
 
msgstr "显示更多"
 

	
 
#: rhodecode/templates/changelog/changelog.html:76
 
msgid "Affected number of files, click to show more details"
 
msgstr ""
 
msgstr "影响的文件数,点击显示详细信息"
 

	
 
#: rhodecode/templates/changelog/changelog.html:89
 
#: rhodecode/templates/changeset/changeset.html:38
 
#: rhodecode/templates/changeset/changeset_file_comment.html:20
 
#: rhodecode/templates/changeset/changeset_range.html:46
 
#, fuzzy
 
msgid "Changeset status"
 
msgstr "变更集"
 
msgstr "修订集状态"
 

	
 
#: rhodecode/templates/changelog/changelog.html:92
 
msgid "Click to open associated pull request"
 
msgstr ""
 
msgstr "点击建立相关的拉取请求"
 

	
 
#: rhodecode/templates/changelog/changelog.html:102
 
#: rhodecode/templates/changeset/changeset.html:78
 
msgid "Parent"
 
msgstr ""
 
msgstr "父版本"
 

	
 
#: rhodecode/templates/changelog/changelog.html:108
 
#: rhodecode/templates/changeset/changeset.html:84
 
msgid "No parents"
 
msgstr ""
 
msgstr "无父版本"
 

	
 
#: rhodecode/templates/changelog/changelog.html:113
 
#: rhodecode/templates/changeset/changeset.html:88
 
msgid "merge"
 
msgstr "合并"
 

	
 
#: rhodecode/templates/changelog/changelog.html:116
 
#: rhodecode/templates/changeset/changeset.html:91
 
#: rhodecode/templates/files/files.html:29
 
#: rhodecode/templates/files/files_add.html:33
 
#: rhodecode/templates/files/files_edit.html:33
 
#: rhodecode/templates/shortlog/shortlog_data.html:9
 
msgid "branch"
 
msgstr "分支"
 

	
 
#: rhodecode/templates/changelog/changelog.html:122
 
msgid "bookmark"
 
msgstr ""
 
msgstr "书签"
 

	
 
#: rhodecode/templates/changelog/changelog.html:128
 
#: rhodecode/templates/changeset/changeset.html:96
 
msgid "tag"
 
msgstr "标签"
 

	
 
#: rhodecode/templates/changelog/changelog.html:164
 
msgid "Show selected changes __S -> __E"
 
msgstr ""
 
msgstr "显示选定的修订集 __S -> __E"
 

	
 
#: rhodecode/templates/changelog/changelog.html:255
 
msgid "There are no changes yet"
 
msgstr "没有任何变更"
 

	
 
#: rhodecode/templates/changelog/changelog_details.html:4
 
#: rhodecode/templates/changeset/changeset.html:66
 
msgid "removed"
 
msgstr "移除"
 

	
 
#: rhodecode/templates/changelog/changelog_details.html:5
 
#: rhodecode/templates/changeset/changeset.html:67
 
msgid "changed"
 
msgstr "修改"
 

	
 
#: rhodecode/templates/changelog/changelog_details.html:6
 
#: rhodecode/templates/changeset/changeset.html:68
 
msgid "added"
 
msgstr "添加"
 

	
 
#: rhodecode/templates/changelog/changelog_details.html:8
 
#: rhodecode/templates/changelog/changelog_details.html:9
 
#: rhodecode/templates/changelog/changelog_details.html:10
 
#: rhodecode/templates/changeset/changeset.html:70
 
#: rhodecode/templates/changeset/changeset.html:71
 
#: rhodecode/templates/changeset/changeset.html:72
 
#, python-format
 
msgid "affected %s files"
 
msgstr ""
 
msgstr "影响 %s 文件"
 

	
 
#: rhodecode/templates/changeset/changeset.html:6
 
#, fuzzy, python-format
 
#, python-format
 
msgid "%s Changeset"
 
msgstr "无变更"
 
msgstr "%s 修订集"
 

	
 
#: rhodecode/templates/changeset/changeset.html:14
 
msgid "Changeset"
 
msgstr ""
 
msgstr "修订集"
 

	
 
#: rhodecode/templates/changeset/changeset.html:43
 
#: rhodecode/templates/changeset/diff_block.html:20
 
msgid "raw diff"
 
msgstr "原始 diff"
 

	
 
#: rhodecode/templates/changeset/changeset.html:44
 
#: rhodecode/templates/changeset/diff_block.html:21
 
msgid "download diff"
 
msgstr "下载 diff"
 

	
 
#: rhodecode/templates/changeset/changeset.html:48
 
#: rhodecode/templates/changeset/changeset_file_comment.html:82
 
#, fuzzy, python-format
 
#, python-format
 
msgid "%d comment"
 
msgid_plural "%d comments"
 
msgstr[0] "提交"
 
msgstr[0] "%d 条评论"
 

	
 
#: rhodecode/templates/changeset/changeset.html:48
 
#: rhodecode/templates/changeset/changeset_file_comment.html:82
 
#, python-format
 
msgid "(%d inline)"
 
msgid_plural "(%d inline)"
 
msgstr[0] ""
 
msgstr[0] "(%d 内嵌)"
 

	
 
#: rhodecode/templates/changeset/changeset.html:103
 
#, python-format
 
msgid "%s files affected with %s insertions and %s deletions:"
 
msgstr ""
 
msgstr "%s 个文件受影响包括 %s 行插入和 %s 行删除:"
 

	
 
#: rhodecode/templates/changeset/changeset.html:119
 
msgid "Changeset was too big and was cut off..."
 
msgstr ""
 
msgstr "修订集太大已被截断......"
 

	
 
#: rhodecode/templates/changeset/changeset_file_comment.html:42
 
msgid "Submitting..."
 
msgstr ""
 
msgstr "提交中……"
 

	
 
#: rhodecode/templates/changeset/changeset_file_comment.html:45
 
msgid "Commenting on line {1}."
 
msgstr ""
 
msgstr " {1} 行上评论"
 

	
 
#: rhodecode/templates/changeset/changeset_file_comment.html:46
 
#: rhodecode/templates/changeset/changeset_file_comment.html:121
 
#, python-format
 
msgid "Comments parsed using %s syntax with %s support."
 
msgstr ""
 
msgstr "评论使用 %s 语法并支持 %s"
 

	
 
#: rhodecode/templates/changeset/changeset_file_comment.html:48
 
#: rhodecode/templates/changeset/changeset_file_comment.html:123
 
msgid "Use @username inside this text to send notification to this RhodeCode user"
 
msgstr ""
 
msgid ""
 
"Use @username inside this text to send notification to this RhodeCode user"
 
msgstr "在文本中使用 @用户名 以发送通知到该 RhodeCode 用户"
 

	
 
#: rhodecode/templates/changeset/changeset_file_comment.html:59
 
#: rhodecode/templates/changeset/changeset_file_comment.html:138
 
#, fuzzy
 
msgid "Comment"
 
msgstr "提交"
 
msgstr "评论"
 

	
 
#: rhodecode/templates/changeset/changeset_file_comment.html:60
 
#: rhodecode/templates/changeset/changeset_file_comment.html:71
 
msgid "Hide"
 
msgstr ""
 
msgstr "影藏"
 

	
 
#: rhodecode/templates/changeset/changeset_file_comment.html:67
 
#, fuzzy
 
msgid "You need to be logged in to comment."
 
msgstr "必须登录才能访问该页面"
 
msgstr "必须登录才能评论"
 

	
 
#: rhodecode/templates/changeset/changeset_file_comment.html:67
 
msgid "Login now"
 
msgstr ""
 
msgstr "现在登陆"
 

	
 
#: rhodecode/templates/changeset/changeset_file_comment.html:118
 
msgid "Leave a comment"
 
msgstr ""
 
msgstr "发表评论"
 

	
 
#: rhodecode/templates/changeset/changeset_file_comment.html:124
 
msgid "Check this to change current status of code-review for this changeset"
 
msgstr ""
 
msgstr "勾选以改变这个修订集的代码审查状态"
 

	
 
#: rhodecode/templates/changeset/changeset_file_comment.html:124
 
#, fuzzy
 
msgid "change status"
 
msgstr "变更集"
 
msgstr "改变状态"
 

	
 
#: rhodecode/templates/changeset/changeset_file_comment.html:140
 
msgid "Comment and close"
 
msgstr ""
 
msgstr "评论并关闭"
 

	
 
#: rhodecode/templates/changeset/changeset_range.html:5
 
#, fuzzy, python-format
 
#, python-format
 
msgid "%s Changesets"
 
msgstr "变更集"
 
msgstr "%s 修订集"
 

	
 
#: rhodecode/templates/changeset/changeset_range.html:29
 
#: rhodecode/templates/compare/compare_diff.html:29
 
msgid "Compare View"
 
msgstr "比较显示"
 

	
 
#: rhodecode/templates/changeset/changeset_range.html:54
 
#: rhodecode/templates/compare/compare_diff.html:41
 
#: rhodecode/templates/pullrequests/pullrequest_show.html:69
 
msgid "Files affected"
 
msgstr ""
 
msgstr "影响文件"
 

	
 
#: rhodecode/templates/changeset/diff_block.html:19
 
msgid "diff"
 
msgstr ""
 
msgstr "差别"
 

	
 
#: rhodecode/templates/changeset/diff_block.html:27
 
#, fuzzy
 
msgid "show inline comments"
 
msgstr "文件内容"
 
msgstr "显示内嵌评论"
 

	
 
#: rhodecode/templates/compare/compare_cs.html:5
 
#, fuzzy
 
msgid "No changesets"
 
msgstr "尚无修订"
 
msgstr "无修订"
 

	
 
#: rhodecode/templates/compare/compare_diff.html:37
 
#, fuzzy
 
msgid "Outgoing changesets"
 
msgstr "尚无修订"
 
msgstr "传出修订集"
 

	
 
#: rhodecode/templates/data_table/_dt_elements.html:39
 
#: rhodecode/templates/data_table/_dt_elements.html:41
 
#: rhodecode/templates/data_table/_dt_elements.html:43
 
msgid "Fork"
 
msgstr "分支"
 

	
 
#: rhodecode/templates/data_table/_dt_elements.html:60
 
#: rhodecode/templates/journal/journal.html:126
 
#: rhodecode/templates/summary/summary.html:68
 
msgid "Mercurial repository"
 
msgstr "Mercurial 版本库"
 

	
 
#: rhodecode/templates/data_table/_dt_elements.html:62
 
#: rhodecode/templates/journal/journal.html:128
 
#: rhodecode/templates/summary/summary.html:71
 
msgid "Git repository"
 
msgstr "Git 版本库"
 

	
 
#: rhodecode/templates/data_table/_dt_elements.html:69
 
#: rhodecode/templates/journal/journal.html:134
 
#: rhodecode/templates/summary/summary.html:78
 
msgid "public repository"
 
msgstr "公共版本库"
 

	
 
#: rhodecode/templates/data_table/_dt_elements.html:80
 
#: rhodecode/templates/summary/summary.html:87
 
#: rhodecode/templates/summary/summary.html:88
 
msgid "Fork of"
 
msgstr ""
 
msgstr "分支自"
 

	
 
#: rhodecode/templates/data_table/_dt_elements.html:92
 
msgid "No changesets yet"
 
msgstr "尚无修订"
 
msgstr "无修订"
 

	
 
#: rhodecode/templates/data_table/_dt_elements.html:104
 
#, fuzzy, python-format
 
#, python-format
 
msgid "Confirm to delete this user: %s"
 
msgstr "确认删除该用户"
 
msgstr "确认删除用户: %s"
 

	
 
#: rhodecode/templates/email_templates/main.html:8
 
msgid "This is an notification from RhodeCode."
 
msgstr ""
 
msgstr "这是 RhodeCode 发送的一个通知。"
 

	
 
#: rhodecode/templates/errors/error_document.html:46
 
#, python-format
 
msgid "You will be redirected to %s in %s seconds"
 
msgstr ""
 
msgstr "%1s 秒后你将重定向到 %2s"
 

	
 
#: rhodecode/templates/files/file_diff.html:4
 
#, fuzzy, python-format
 
#, python-format
 
msgid "%s File diff"
 
msgstr "文件 diff"
 
msgstr "%s 文件差异"
 

	
 
#: rhodecode/templates/files/file_diff.html:12
 
msgid "File diff"
 
msgstr "文件 diff"
 
msgstr "文件差异"
 

	
 
#: rhodecode/templates/files/files.html:4
 
#: rhodecode/templates/files/files.html:72
 
#, fuzzy, python-format
 
#, python-format
 
msgid "%s files"
 
msgstr "文件"
 
msgstr "%s 文件"
 

	
 
#: rhodecode/templates/files/files.html:12
 
#: rhodecode/templates/summary/summary.html:340
 
msgid "files"
 
msgstr "文件"
 

	
 
#: rhodecode/templates/files/files_add.html:4
 
#: rhodecode/templates/files/files_edit.html:4
 
#, fuzzy, python-format
 
#, python-format
 
msgid "%s Edit file"
 
msgstr "编辑文件"
 
msgstr "%s 编辑文件"
 

	
 
#: rhodecode/templates/files/files_add.html:19
 
#, fuzzy
 
msgid "add file"
 
msgstr "编辑文件"
 
msgstr "新建文件"
 

	
 
#: rhodecode/templates/files/files_add.html:40
 
#, fuzzy
 
msgid "Add new file"
 
msgstr "添加新用户"
 
msgstr "新建文件"
 

	
 
#: rhodecode/templates/files/files_add.html:45
 
#, fuzzy
 
msgid "File Name"
 
msgstr "文件名"
 

	
 
#: rhodecode/templates/files/files_add.html:49
 
#: rhodecode/templates/files/files_add.html:58
 
#, fuzzy
 
msgid "or"
 
msgstr ""
 
msgstr "或者"
 

	
 
#: rhodecode/templates/files/files_add.html:49
 
#: rhodecode/templates/files/files_add.html:54
 
#, fuzzy
 
msgid "Upload file"
 
msgstr "编辑文件"
 
msgstr "上传文件"
 

	
 
#: rhodecode/templates/files/files_add.html:58
 
#, fuzzy
 
msgid "Create new file"
 
msgstr "创建用户 %s"
 
msgstr "创建新文件"
 

	
 
#: rhodecode/templates/files/files_add.html:63
 
#: rhodecode/templates/files/files_edit.html:39
 
#: rhodecode/templates/files/files_ypjax.html:3
 
msgid "Location"
 
msgstr "位置"
 

	
 
#: rhodecode/templates/files/files_add.html:67
 
msgid "use / to separate directories"
 
msgstr ""
 
msgstr "使用 / 目录分隔符"
 

	
 
#: rhodecode/templates/files/files_add.html:77
 
#: rhodecode/templates/files/files_edit.html:63
 
#: rhodecode/templates/shortlog/shortlog_data.html:6
 
msgid "commit message"
 
msgstr "提交信息"
 

	
 
#: rhodecode/templates/files/files_add.html:81
 
#: rhodecode/templates/files/files_edit.html:67
 
msgid "Commit changes"
 
msgstr "提交修改"
 

	
 
#: rhodecode/templates/files/files_browser.html:13
 
msgid "view"
 
msgstr "显示"
 

	
 
#: rhodecode/templates/files/files_browser.html:14
 
msgid "previous revision"
 
msgstr "上一个修订"
 

	
 
#: rhodecode/templates/files/files_browser.html:16
 
msgid "next revision"
 
msgstr "下一个修订"
 

	
 
#: rhodecode/templates/files/files_browser.html:23
 
msgid "follow current branch"
 
msgstr ""
 
msgstr "沿着当前分支"
 

	
 
#: rhodecode/templates/files/files_browser.html:27
 
msgid "search file list"
 
msgstr "搜索文件列表"
 

	
 
#: rhodecode/templates/files/files_browser.html:31
 
#: rhodecode/templates/shortlog/shortlog_data.html:65
 
#, fuzzy
 
msgid "add new file"
 
msgstr "添加新用户"
 
msgstr "新建文件"
 

	
 
#: rhodecode/templates/files/files_browser.html:35
 
msgid "Loading file list..."
 
msgstr "加载文件列表..."
 

	
 
#: rhodecode/templates/files/files_browser.html:48
 
msgid "Size"
 
msgstr "大小"
 

	
 
#: rhodecode/templates/files/files_browser.html:49
 
msgid "Mimetype"
 
msgstr ""
 
msgstr "MIME 类型"
 

	
 
#: rhodecode/templates/files/files_browser.html:50
 
#, fuzzy
 
msgid "Last Revision"
 
msgstr "下一个修订"
 
msgstr "最后修订号"
 

	
 
#: rhodecode/templates/files/files_browser.html:51
 
msgid "Last modified"
 
msgstr "最后修改"
 
msgstr "最后修改于"
 

	
 
#: rhodecode/templates/files/files_browser.html:52
 
msgid "Last commiter"
 
msgstr "最后提交"
 
msgstr "最后提交者"
 

	
 
#: rhodecode/templates/files/files_edit.html:19
 
msgid "edit file"
 
msgstr "编辑文件"
 

	
 
#: rhodecode/templates/files/files_edit.html:49
 
#: rhodecode/templates/files/files_source.html:38
 
msgid "show annotation"
 
msgstr "显示注释"
 

	
 
#: rhodecode/templates/files/files_edit.html:50
 
#: rhodecode/templates/files/files_source.html:40
 
#: rhodecode/templates/files/files_source.html:68
 
msgid "show as raw"
 
msgstr "显示原始文件"
 

	
 
#: rhodecode/templates/files/files_edit.html:51
 
#: rhodecode/templates/files/files_source.html:41
 
msgid "download as raw"
 
msgstr "下载原始文件"
 

	
 
#: rhodecode/templates/files/files_edit.html:54
 
#, fuzzy
 
msgid "source"
 
msgstr "显示代码"
 
msgstr "显示源文件"
 

	
 
#: rhodecode/templates/files/files_edit.html:59
 
#, fuzzy
 
msgid "Editing file"
 
msgstr "编辑文件"
 

	
 
#: rhodecode/templates/files/files_source.html:2
 
msgid "History"
 
msgstr "历史"
 

	
 
#: rhodecode/templates/files/files_source.html:9
 
#, fuzzy
 
msgid "diff to revision"
 
msgstr "下一个修订"
 
msgstr "比较差异"
 

	
 
#: rhodecode/templates/files/files_source.html:10
 
#, fuzzy
 
msgid "show at revision"
 
msgstr "下一个修订"
 
msgstr "显示修订"
 

	
 
#: rhodecode/templates/files/files_source.html:14
 
#, fuzzy, python-format
 
#, python-format
 
msgid "%s author"
 
msgid_plural "%s authors"
 
msgstr[0] "作者"
 
msgstr[0] "%s 个作者"
 

	
 
#: rhodecode/templates/files/files_source.html:36
 
msgid "show source"
 
msgstr "显示代码"
 

	
 
#: rhodecode/templates/files/files_source.html:59
 
#, python-format
 
msgid "Binary file (%s)"
 
msgstr "二进制文件(%s)"
 

	
 
#: rhodecode/templates/files/files_source.html:68
 
msgid "File is too big to display"
 
msgstr "文件过大,不能显示"
 

	
 
#: rhodecode/templates/files/files_source.html:124
 
msgid "Selection link"
 
msgstr ""
 
msgstr "选择链接"
 

	
 
#: rhodecode/templates/files/files_ypjax.html:5
 
#, fuzzy
 
msgid "annotation"
 
msgstr "显示注释"
 

	
 
#: rhodecode/templates/files/files_ypjax.html:15
 
msgid "Go back"
 
msgstr ""
 
msgstr "返回"
 

	
 
#: rhodecode/templates/files/files_ypjax.html:16
 
msgid "No files at given path"
 
msgstr ""
 
msgstr "指定的路径中没有文件"
 

	
 
#: rhodecode/templates/followers/followers.html:5
 
#, fuzzy, python-format
 
#, python-format
 
msgid "%s Followers"
 
msgstr "跟随者"
 
msgstr "%s 个关注者"
 

	
 
#: rhodecode/templates/followers/followers.html:13
 
msgid "followers"
 
msgstr "跟随者"
 
msgstr "关注者"
 

	
 
#: rhodecode/templates/followers/followers_data.html:12
 
#, fuzzy
 
msgid "Started following -"
 
msgstr "开始跟随"
 
msgstr "开始关注 - "
 

	
 
#: rhodecode/templates/forks/fork.html:5
 
#, fuzzy, python-format
 
#, python-format
 
msgid "%s Fork"
 
msgstr "分支"
 
msgstr "%s 的分支"
 

	
 
#: rhodecode/templates/forks/fork.html:31
 
msgid "Fork name"
 
msgstr "分支名"
 

	
 
#: rhodecode/templates/forks/fork.html:68
 
msgid "Private"
 
msgstr "私有"
 

	
 
#: rhodecode/templates/forks/fork.html:77
 
#, fuzzy
 
msgid "Copy permissions"
 
msgstr "权限"
 
msgstr "拷贝权限"
 

	
 
#: rhodecode/templates/forks/fork.html:81
 
msgid "Copy permissions from forked repository"
 
msgstr ""
 
msgstr "从被分支版本库拷贝权限"
 

	
 
#: rhodecode/templates/forks/fork.html:86
 
msgid "Update after clone"
 
msgstr ""
 
msgstr "克隆后更新"
 

	
 
#: rhodecode/templates/forks/fork.html:90
 
msgid "Checkout source after making a clone"
 
msgstr ""
 
msgstr "完成克隆后检出源代码"
 

	
 
#: rhodecode/templates/forks/fork.html:94
 
msgid "fork this repository"
 
msgstr "对该版本库建立分支"
 

	
 
#: rhodecode/templates/forks/forks.html:5
 
#, fuzzy, python-format
 
#, python-format
 
msgid "%s Forks"
 
msgstr "分支"
 
msgstr "%s 的分支"
 

	
 
#: rhodecode/templates/forks/forks.html:13
 
msgid "forks"
 
msgstr "分支"
 

	
 
#: rhodecode/templates/forks/forks_data.html:17
 
msgid "forked"
 
msgstr "已有分支"
 

	
 
#: rhodecode/templates/forks/forks_data.html:38
 
msgid "There are no forks yet"
 
msgstr "尚未有任何分支"
 
msgstr "无分支"
 

	
 
#: rhodecode/templates/journal/journal.html:13
 
#, fuzzy
 
msgid "ATOM journal feed"
 
msgstr "公共日志 %s %s 订阅"
 
msgstr "订阅日志 ATOM"
 

	
 
#: rhodecode/templates/journal/journal.html:14
 
#, fuzzy
 
msgid "RSS journal feed"
 
msgstr "公共日志 %s %s 订阅"
 
msgstr "订阅日志 RSS"
 

	
 
#: rhodecode/templates/journal/journal.html:24
 
#: rhodecode/templates/pullrequests/pullrequest.html:27
 
msgid "Refresh"
 
msgstr ""
 
msgstr "刷新"
 

	
 
#: rhodecode/templates/journal/journal.html:27
 
#: rhodecode/templates/journal/public_journal.html:24
 
#, fuzzy
 
msgid "RSS feed"
 
msgstr "%s %s 订阅"
 
msgstr "订阅 RSS"
 

	
 
#: rhodecode/templates/journal/journal.html:30
 
#: rhodecode/templates/journal/public_journal.html:27
 
msgid "ATOM feed"
 
msgstr ""
 
msgstr "订阅 ATOM"
 

	
 
#: rhodecode/templates/journal/journal.html:41
 
#, fuzzy
 
msgid "Watched"
 
msgstr "缓存"
 
msgstr "关注的"
 

	
 
#: rhodecode/templates/journal/journal.html:46
 
#, fuzzy
 
msgid "ADD"
 
msgstr "新增"
 
msgstr "新建版本库"
 

	
 
#: rhodecode/templates/journal/journal.html:114
 
msgid "following user"
 
msgstr "跟随中用户"
 
msgstr "关注用户"
 

	
 
#: rhodecode/templates/journal/journal.html:114
 
msgid "user"
 
msgstr "用户"
 

	
 
#: rhodecode/templates/journal/journal.html:147
 
msgid "You are not following any users or repositories"
 
msgstr "尚未跟随任何用户或版本库"
 
msgstr "未关注任何用户或版本库"
 

	
 
#: rhodecode/templates/journal/journal_data.html:47
 
msgid "No entries yet"
 
msgstr ""
 
msgstr "没有条目"
 

	
 
#: rhodecode/templates/journal/public_journal.html:13
 
#, fuzzy
 
msgid "ATOM public journal feed"
 
msgstr "公共日志 %s %s 订阅"
 
msgstr "订阅公共日志 ATOM"
 

	
 
#: rhodecode/templates/journal/public_journal.html:14
 
#, fuzzy
 
msgid "RSS public journal feed"
 
msgstr "公共日志 %s %s 订阅"
 
msgstr "订阅公共日志 RSS"
 

	
 
#: rhodecode/templates/journal/public_journal.html:21
 
msgid "Public Journal"
 
msgstr "公共日志"
 

	
 
#: rhodecode/templates/pullrequests/pullrequest.html:4
 
#: rhodecode/templates/pullrequests/pullrequest.html:12
 
msgid "New pull request"
 
msgstr ""
 
msgstr "新建拉取请求"
 

	
 
#: rhodecode/templates/pullrequests/pullrequest.html:28
 
msgid "refresh overview"
 
msgstr ""
 
msgstr "刷新概览"
 

	
 
#: rhodecode/templates/pullrequests/pullrequest.html:66
 
#, fuzzy
 
msgid "Detailed compare view"
 
msgstr "比较显示"
 
msgstr "详细比较显示"
 

	
 
#: rhodecode/templates/pullrequests/pullrequest.html:70
 
#: rhodecode/templates/pullrequests/pullrequest_show.html:82
 
msgid "Pull request reviewers"
 
msgstr ""
 
msgstr "拉取请求检视人员"
 

	
 
#: rhodecode/templates/pullrequests/pullrequest.html:79
 
#: rhodecode/templates/pullrequests/pullrequest_show.html:94
 
#, fuzzy
 
msgid "owner"
 
msgstr "所有者"
 

	
 
#: rhodecode/templates/pullrequests/pullrequest.html:91
 
#: rhodecode/templates/pullrequests/pullrequest_show.html:109
 
msgid "Add reviewer to this pull request."
 
msgstr ""
 
msgstr "为这个拉取请求增加检视人员"
 

	
 
#: rhodecode/templates/pullrequests/pullrequest.html:97
 
#, fuzzy
 
msgid "Create new pull request"
 
msgstr "创建用户 %s"
 
msgstr "创建新的拉取请求"
 

	
 
#: rhodecode/templates/pullrequests/pullrequest.html:106
 
#: rhodecode/templates/pullrequests/pullrequest_show.html:25
 
#: rhodecode/templates/pullrequests/pullrequest_show_all.html:33
 
#, fuzzy
 
msgid "Title"
 
msgstr ""
 
msgstr "标题"
 

	
 
#: rhodecode/templates/pullrequests/pullrequest.html:115
 
#, fuzzy
 
msgid "description"
 
msgstr "描述"
 

	
 
#: rhodecode/templates/pullrequests/pullrequest.html:123
 
msgid "Send pull request"
 
msgstr ""
 
msgstr "发送拉取请求"
 

	
 
#: rhodecode/templates/pullrequests/pullrequest_show.html:23
 
#, python-format
 
msgid "Closed %s"
 
msgstr ""
 
msgstr "关闭于 %s"
 

	
 
#: rhodecode/templates/pullrequests/pullrequest_show.html:31
 
#, fuzzy
 
msgid "Status"
 
msgstr "变更集"
 
msgstr "状态"
 

	
 
#: rhodecode/templates/pullrequests/pullrequest_show.html:36
 
msgid "Pull request status"
 
msgstr ""
 
msgstr "拉取请求状态"
 

	
 
#: rhodecode/templates/pullrequests/pullrequest_show.html:44
 
msgid "Still not reviewed by"
 
msgstr ""
 
msgstr "还未检视的检视人员"
 

	
 
#: rhodecode/templates/pullrequests/pullrequest_show.html:47
 
#, python-format
 
msgid "%d reviewer"
 
msgid_plural "%d reviewers"
 
msgstr[0] ""
 
msgstr[0] "%d 个检视者"
 

	
 
#: rhodecode/templates/pullrequests/pullrequest_show.html:54
 
#, fuzzy
 
msgid "Created on"
 
msgstr "创建用户 %s"
 
msgstr "创建于 %s"
 

	
 
#: rhodecode/templates/pullrequests/pullrequest_show.html:61
 
#, fuzzy
 
msgid "Compare view"
 
msgstr "比较显示"
 

	
 
#: rhodecode/templates/pullrequests/pullrequest_show.html:65
 
#, fuzzy
 
msgid "Incoming changesets"
 
msgstr "尚无修订"
 
msgstr "传入修订集"
 

	
 
#: rhodecode/templates/pullrequests/pullrequest_show_all.html:4
 
#, fuzzy
 
msgid "all pull requests"
 
msgstr "创建用户 %s"
 
msgstr "所有拉取请求"
 

	
 
#: rhodecode/templates/pullrequests/pullrequest_show_all.html:12
 
msgid "All pull requests"
 
msgstr ""
 
msgstr "所有拉取请求"
 

	
 
#: rhodecode/templates/pullrequests/pullrequest_show_all.html:27
 
msgid "Closed"
 
msgstr ""
 

	
 
msgstr "已关闭"
 

	
 
# 中文中 repo name 在前面 serch term在后面
 
#: rhodecode/templates/search/search.html:6
 
#, fuzzy, python-format
 
#, python-format
 
msgid "Search \"%s\" in repository: %s"
 
msgstr "在版本库"
 
msgstr "在版本库 %2s 中搜索 \"%1s\""
 

	
 
#: rhodecode/templates/search/search.html:8
 
#, fuzzy, python-format
 
#, python-format
 
msgid "Search \"%s\" in all repositories"
 
msgstr "在所有的版本库"
 
msgstr "在所有的版本库中搜索  \"%s\""
 

	
 
#: rhodecode/templates/search/search.html:12
 
#: rhodecode/templates/search/search.html:32
 
#, fuzzy, python-format
 
#, python-format
 
msgid "Search in repository: %s"
 
msgstr "在版本库"
 
msgstr "在版本库 %s 中搜索"
 

	
 
#: rhodecode/templates/search/search.html:14
 
#: rhodecode/templates/search/search.html:34
 
#, fuzzy
 
msgid "Search in all repositories"
 
msgstr "在所有的版本库"
 
msgstr "在所有的版本库中搜索"
 

	
 
#: rhodecode/templates/search/search.html:48
 
msgid "Search term"
 
msgstr "搜索短语"
 

	
 
#: rhodecode/templates/search/search.html:60
 
msgid "Search in"
 
msgstr "搜索范围"
 

	
 
#: rhodecode/templates/search/search.html:63
 
msgid "File contents"
 
msgstr "文件内容"
 

	
 
#: rhodecode/templates/search/search.html:64
 
#, fuzzy
 
msgid "Commit messages"
 
msgstr "提交信息"
 

	
 
#: rhodecode/templates/search/search.html:65
 
msgid "File names"
 
msgstr "文件名"
 

	
 
#: rhodecode/templates/search/search_commit.html:35
 
#: rhodecode/templates/search/search_content.html:21
 
#: rhodecode/templates/search/search_path.html:15
 
msgid "Permission denied"
 
msgstr "权限不足"
 

	
 
#: rhodecode/templates/settings/repo_settings.html:5
 
#, fuzzy, python-format
 
#, python-format
 
msgid "%s Settings"
 
msgstr "设置"
 
msgstr "%s 设置"
 

	
 
#: rhodecode/templates/shortlog/shortlog.html:5
 
#, fuzzy, python-format
 
#, python-format
 
msgid "%s Shortlog"
 
msgstr "简短日志"
 
msgstr "%s 简短日志"
 

	
 
#: rhodecode/templates/shortlog/shortlog.html:14
 
msgid "shortlog"
 
msgstr "简短日志"
 

	
 
#: rhodecode/templates/shortlog/shortlog_data.html:7
 
msgid "age"
 
msgstr ""
 
msgstr "时间"
 

	
 
#: rhodecode/templates/shortlog/shortlog_data.html:18
 
#, fuzzy
 
msgid "No commit message"
 
msgstr "提交信息"
 
msgstr "没有提交信息"
 

	
 
#: rhodecode/templates/shortlog/shortlog_data.html:62
 
msgid "Add or upload files directly via RhodeCode"
 
msgstr ""
 
msgstr "通过 RhodeCode 直接添加或者上传文件"
 

	
 
#: rhodecode/templates/shortlog/shortlog_data.html:71
 
msgid "Push new repo"
 
msgstr ""
 
msgstr "Push 新版本库"
 

	
 
#: rhodecode/templates/shortlog/shortlog_data.html:79
 
#, fuzzy
 
msgid "Existing repository?"
 
msgstr "Git 版本库"
 
msgstr "现有版本库"
 

	
 
#: rhodecode/templates/summary/summary.html:4
 
#, fuzzy, python-format
 
#, python-format
 
msgid "%s Summary"
 
msgstr "概要"
 
msgstr "%s 概要"
 

	
 
#: rhodecode/templates/summary/summary.html:12
 
msgid "summary"
 
msgstr "概要"
 

	
 
#: rhodecode/templates/summary/summary.html:20
 
#, fuzzy, python-format
 
#, python-format
 
msgid "repo %s ATOM feed"
 
msgstr "订阅 atom %s"
 
msgstr "订阅 ATOM %s"
 

	
 
#: rhodecode/templates/summary/summary.html:21
 
#, fuzzy, python-format
 
#, python-format
 
msgid "repo %s RSS feed"
 
msgstr "订阅 rss %s"
 
msgstr "订阅 RSS %s"
 

	
 
#: rhodecode/templates/summary/summary.html:49
 
#: rhodecode/templates/summary/summary.html:52
 
#, fuzzy
 
msgid "ATOM"
 
msgstr "作者"
 
msgstr "ATOM"
 

	
 
#: rhodecode/templates/summary/summary.html:82
 
#, fuzzy, python-format
 
#, python-format
 
msgid "Non changable ID %s"
 
msgstr "无变更"
 
msgstr "不可变 ID %s"
 

	
 
#: rhodecode/templates/summary/summary.html:87
 
msgid "public"
 
msgstr "公共"
 

	
 
#: rhodecode/templates/summary/summary.html:95
 
msgid "remote clone"
 
msgstr "远程 clone"
 
msgstr "远程克隆"
 

	
 
#: rhodecode/templates/summary/summary.html:116
 
msgid "Contact"
 
msgstr "联系方式"
 

	
 
#: rhodecode/templates/summary/summary.html:130
 
msgid "Clone url"
 
msgstr "clone 地址"
 
msgstr "克隆地址"
 

	
 
#: rhodecode/templates/summary/summary.html:133
 
msgid "Show by Name"
 
msgstr ""
 
msgstr "以名字显示"
 

	
 
#: rhodecode/templates/summary/summary.html:134
 
msgid "Show by ID"
 
msgstr ""
 
msgstr " ID 显示"
 

	
 
#: rhodecode/templates/summary/summary.html:142
 
#, fuzzy
 
msgid "Trending files"
 
msgstr "编辑文件"
 
msgstr "文件趋势图"
 

	
 
#: rhodecode/templates/summary/summary.html:150
 
#: rhodecode/templates/summary/summary.html:166
 
#: rhodecode/templates/summary/summary.html:194
 
msgid "enable"
 
msgstr "启用"
 

	
 
#: rhodecode/templates/summary/summary.html:158
 
msgid "Download"
 
msgstr "下载"
 

	
 
#: rhodecode/templates/summary/summary.html:162
 
msgid "There are no downloads yet"
 
msgstr "尚无任何下载"
 
msgstr "无下载"
 

	
 
#: rhodecode/templates/summary/summary.html:164
 
msgid "Downloads are disabled for this repository"
 
msgstr "这个版本库的下载已经禁用"
 

	
 
#: rhodecode/templates/summary/summary.html:170
 
#, fuzzy
 
msgid "Download as zip"
 
msgstr "下载原始文件"
 
msgstr "下载 zip 包"
 

	
 
#: rhodecode/templates/summary/summary.html:173
 
msgid "Check this to download archive with subrepos"
 
msgstr ""
 
msgstr "勾选以下载包含子版本库的压缩包"
 

	
 
#: rhodecode/templates/summary/summary.html:173
 
msgid "with subrepos"
 
msgstr ""
 
msgstr "包括子版本库"
 

	
 
#: rhodecode/templates/summary/summary.html:186
 
msgid "Commit activity by day / author"
 
msgstr ""
 
msgstr "按日期或作者的提交活动"
 

	
 
#: rhodecode/templates/summary/summary.html:197
 
msgid "Stats gathered: "
 
msgstr ""
 
msgstr "已收集的统计: "
 

	
 
#: rhodecode/templates/summary/summary.html:218
 
msgid "Shortlog"
 
msgstr "简短日志"
 

	
 
#: rhodecode/templates/summary/summary.html:220
 
#, fuzzy
 
msgid "Quick start"
 
msgstr "快速过滤..."
 
msgstr "快速入门"
 

	
 
#: rhodecode/templates/summary/summary.html:233
 
#, python-format
 
msgid "Readme file at revision '%s'"
 
msgstr ""
 
msgstr "修订 '%s' 中的README"
 

	
 
#: rhodecode/templates/summary/summary.html:236
 
msgid "Permalink to this readme"
 
msgstr ""
 
msgstr "这个 README 的固定链接"
 

	
 
#: rhodecode/templates/summary/summary.html:293
 
#, python-format
 
msgid "Download %s as %s"
 
msgstr "下载 %s 作为 %s"
 

	
 
#: rhodecode/templates/summary/summary.html:650
 
msgid "commits"
 
msgstr "提交"
 

	
 
#: rhodecode/templates/summary/summary.html:651
 
msgid "files added"
 
msgstr "文件已添加"
 

	
 
#: rhodecode/templates/summary/summary.html:652
 
msgid "files changed"
 
msgstr "文件已更改"
 

	
 
#: rhodecode/templates/summary/summary.html:653
 
msgid "files removed"
 
msgstr "文件已删除"
 

	
 
#: rhodecode/templates/summary/summary.html:656
 
msgid "commit"
 
msgstr "提交"
 

	
 
#: rhodecode/templates/summary/summary.html:657
 
msgid "file added"
 
msgstr "文件已添加"
 

	
 
#: rhodecode/templates/summary/summary.html:658
 
msgid "file changed"
 
msgstr "文件已更改"
 

	
 
#: rhodecode/templates/summary/summary.html:659
 
msgid "file removed"
 
msgstr "文件已删除"
 

	
 
#: rhodecode/templates/tags/tags.html:5
 
#, fuzzy, python-format
 
#, python-format
 
msgid "%s Tags"
 
msgstr "之前"
 

	
 
msgstr "%s 标签"
rhodecode/lib/diffs.py
Show inline comments
 
# -*- coding: utf-8 -*-
 
"""
 
    rhodecode.lib.diffs
 
    ~~~~~~~~~~~~~~~~~~~
 

	
 
    Set of diffing helpers, previously part of vcs
 

	
 

	
 
    :created_on: Dec 4, 2011
 
    :author: marcink
 
    :copyright: (C) 2010-2012 Marcin Kuzminski <marcin@python-works.com>
 
    :original copyright: 2007-2008 by Armin Ronacher
 
    :license: GPLv3, see COPYING for more details.
 
"""
 
# This program is free software: you can redistribute it and/or modify
 
# it under the terms of the GNU General Public License as published by
 
# the Free Software Foundation, either version 3 of the License, or
 
# (at your option) any later version.
 
#
 
# This program is distributed in the hope that it will be useful,
 
# but WITHOUT ANY WARRANTY; without even the implied warranty of
 
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 
# GNU General Public License for more details.
 
#
 
# You should have received a copy of the GNU General Public License
 
# along with this program.  If not, see <http://www.gnu.org/licenses/>.
 

	
 
import re
 
import difflib
 
import markupsafe
 

	
 
from itertools import tee, imap
 

	
 
from mercurial import patch
 
from mercurial.mdiff import diffopts
 
from mercurial.bundlerepo import bundlerepository
 

	
 
from pylons.i18n.translation import _
 

	
 
from rhodecode.lib.compat import BytesIO
 
from rhodecode.lib.vcs.utils.hgcompat import localrepo
 
from rhodecode.lib.vcs.exceptions import VCSError
 
from rhodecode.lib.vcs.nodes import FileNode, SubModuleNode
 
from rhodecode.lib.vcs.backends.base import EmptyChangeset
 
from rhodecode.lib.helpers import escape
 
from rhodecode.lib.utils import make_ui
 
from rhodecode.lib.utils2 import safe_unicode
 

	
 

	
 
def wrap_to_table(str_):
 
    return '''<table class="code-difftable">
 
                <tr class="line no-comment">
 
                <td class="lineno new"></td>
 
                <td class="code no-comment"><pre>%s</pre></td>
 
                </tr>
 
              </table>''' % str_
 

	
 

	
 
def wrapped_diff(filenode_old, filenode_new, cut_off_limit=None,
 
                ignore_whitespace=True, line_context=3,
 
                enable_comments=False):
 
    """
 
    returns a wrapped diff into a table, checks for cut_off_limit and presents
 
    proper message
 
    """
 

	
 
    if filenode_old is None:
 
        filenode_old = FileNode(filenode_new.path, '', EmptyChangeset())
 

	
 
    if filenode_old.is_binary or filenode_new.is_binary:
 
        diff = wrap_to_table(_('binary file'))
 
        stats = (0, 0)
 
        size = 0
 

	
 
    elif cut_off_limit != -1 and (cut_off_limit is None or
 
    (filenode_old.size < cut_off_limit and filenode_new.size < cut_off_limit)):
 

	
 
        f_gitdiff = get_gitdiff(filenode_old, filenode_new,
 
                                ignore_whitespace=ignore_whitespace,
 
                                context=line_context)
 
        diff_processor = DiffProcessor(f_gitdiff, format='gitdiff')
 

	
 
        diff = diff_processor.as_html(enable_comments=enable_comments)
 
        stats = diff_processor.stat()
 
        size = len(diff or '')
 
    else:
 
        diff = wrap_to_table(_('Changeset was too big and was cut off, use '
 
                               'diff menu to display this diff'))
 
        stats = (0, 0)
 
        size = 0
 
    if not diff:
 
        submodules = filter(lambda o: isinstance(o, SubModuleNode),
 
                            [filenode_new, filenode_old])
 
        if submodules:
 
            diff = wrap_to_table(escape('Submodule %r' % submodules[0]))
 
        else:
 
            diff = wrap_to_table(_('No changes detected'))
 

	
 
    cs1 = filenode_old.changeset.raw_id
 
    cs2 = filenode_new.changeset.raw_id
 

	
 
    return size, cs1, cs2, diff, stats
 

	
 

	
 
def get_gitdiff(filenode_old, filenode_new, ignore_whitespace=True, context=3):
 
    """
 
    Returns git style diff between given ``filenode_old`` and ``filenode_new``.
 

	
 
    :param ignore_whitespace: ignore whitespaces in diff
 
    """
 
    # make sure we pass in default context
 
    context = context or 3
 
    submodules = filter(lambda o: isinstance(o, SubModuleNode),
 
                        [filenode_new, filenode_old])
 
    if submodules:
 
        return ''
 

	
 
    for filenode in (filenode_old, filenode_new):
 
        if not isinstance(filenode, FileNode):
 
            raise VCSError("Given object should be FileNode object, not %s"
 
                % filenode.__class__)
 

	
 
    repo = filenode_new.changeset.repository
 
    old_raw_id = getattr(filenode_old.changeset, 'raw_id', repo.EMPTY_CHANGESET)
 
    new_raw_id = getattr(filenode_new.changeset, 'raw_id', repo.EMPTY_CHANGESET)
 

	
 
    vcs_gitdiff = repo.get_diff(old_raw_id, new_raw_id, filenode_new.path,
 
                                 ignore_whitespace, context)
 
    return vcs_gitdiff
 

	
 

	
 
class DiffProcessor(object):
 
    """
 
    Give it a unified diff and it returns a list of the files that were
 
    mentioned in the diff together with a dict of meta information that
 
    can be used to render it in a HTML template.
 
    """
 
    _chunk_re = re.compile(r'@@ -(\d+)(?:,(\d+))? \+(\d+)(?:,(\d+))? @@(.*)')
 
    _newline_marker = '\\ No newline at end of file\n'
 

	
 
    def __init__(self, diff, differ='diff', format='gitdiff'):
 
        """
 
        :param diff:   a text in diff format or generator
 
        :param format: format of diff passed, `udiff` or `gitdiff`
 
        """
 
        if isinstance(diff, basestring):
 
            diff = [diff]
 

	
 
        self.__udiff = diff
 
        self.__format = format
 
        self.adds = 0
 
        self.removes = 0
 

	
 
        if isinstance(self.__udiff, basestring):
 
            self.lines = iter(self.__udiff.splitlines(1))
 

	
 
        elif self.__format == 'gitdiff':
 
            udiff_copy = self.copy_iterator()
 
            self.lines = imap(self.escaper, self._parse_gitdiff(udiff_copy))
 
        else:
 
            udiff_copy = self.copy_iterator()
 
            self.lines = imap(self.escaper, udiff_copy)
 

	
 
        # Select a differ.
 
        if differ == 'difflib':
 
            self.differ = self._highlight_line_difflib
 
        else:
 
            self.differ = self._highlight_line_udiff
 

	
 
    def escaper(self, string):
 
        return markupsafe.escape(string)
 

	
 
    def copy_iterator(self):
 
        """
 
        make a fresh copy of generator, we should not iterate thru
 
        an original as it's needed for repeating operations on
 
        this instance of DiffProcessor
 
        """
 
        self.__udiff, iterator_copy = tee(self.__udiff)
 
        return iterator_copy
 

	
 
    def _extract_rev(self, line1, line2):
 
        """
 
        Extract the operation (A/M/D), filename and revision hint from a line.
 
        """
 

	
 
        try:
 
            if line1.startswith('--- ') and line2.startswith('+++ '):
 
                l1 = line1[4:].split(None, 1)
 
                old_filename = (l1[0].replace('a/', '', 1)
 
                                if len(l1) >= 1 else None)
 
                old_rev = l1[1] if len(l1) == 2 else 'old'
 

	
 
                l2 = line2[4:].split(None, 1)
 
                new_filename = (l2[0].replace('b/', '', 1)
 
                                if len(l1) >= 1 else None)
 
                new_rev = l2[1] if len(l2) == 2 else 'new'
 

	
 
                filename = (old_filename
 
                            if old_filename != '/dev/null' else new_filename)
 

	
 
                operation = 'D' if new_filename == '/dev/null' else None
 
                if not operation:
 
                    operation = 'M' if old_filename != '/dev/null' else 'A'
 

	
 
                return operation, filename, new_rev, old_rev
 
        except (ValueError, IndexError):
 
            pass
 

	
 
        return None, None, None, None
 

	
 
    def _parse_gitdiff(self, diffiterator):
 
        def line_decoder(l):
 
            if l.startswith('+') and not l.startswith('+++'):
 
                self.adds += 1
 
            elif l.startswith('-') and not l.startswith('---'):
 
                self.removes += 1
 
            return l.decode('utf8', 'replace')
 
            return safe_unicode(l)
 

	
 
        output = list(diffiterator)
 
        size = len(output)
 

	
 
        if size == 2:
 
            l = []
 
            l.extend([output[0]])
 
            l.extend(output[1].splitlines(1))
 
            return map(line_decoder, l)
 
        elif size == 1:
 
            return  map(line_decoder, output[0].splitlines(1))
 
        elif size == 0:
 
            return []
 

	
 
        raise Exception('wrong size of diff %s' % size)
 

	
 
    def _highlight_line_difflib(self, line, next_):
 
        """
 
        Highlight inline changes in both lines.
 
        """
 

	
 
        if line['action'] == 'del':
 
            old, new = line, next_
 
        else:
 
            old, new = next_, line
 

	
 
        oldwords = re.split(r'(\W)', old['line'])
 
        newwords = re.split(r'(\W)', new['line'])
 

	
 
        sequence = difflib.SequenceMatcher(None, oldwords, newwords)
 

	
 
        oldfragments, newfragments = [], []
 
        for tag, i1, i2, j1, j2 in sequence.get_opcodes():
 
            oldfrag = ''.join(oldwords[i1:i2])
 
            newfrag = ''.join(newwords[j1:j2])
 
            if tag != 'equal':
 
                if oldfrag:
 
                    oldfrag = '<del>%s</del>' % oldfrag
 
                if newfrag:
 
                    newfrag = '<ins>%s</ins>' % newfrag
 
            oldfragments.append(oldfrag)
 
            newfragments.append(newfrag)
 

	
 
        old['line'] = "".join(oldfragments)
 
        new['line'] = "".join(newfragments)
 

	
 
    def _highlight_line_udiff(self, line, next_):
 
        """
 
        Highlight inline changes in both lines.
 
        """
 
        start = 0
 
        limit = min(len(line['line']), len(next_['line']))
 
        while start < limit and line['line'][start] == next_['line'][start]:
 
            start += 1
 
        end = -1
 
        limit -= start
 
        while -end <= limit and line['line'][end] == next_['line'][end]:
 
            end -= 1
 
        end += 1
 
        if start or end:
 
            def do(l):
 
                last = end + len(l['line'])
 
                if l['action'] == 'add':
 
                    tag = 'ins'
 
                else:
 
                    tag = 'del'
 
                l['line'] = '%s<%s>%s</%s>%s' % (
 
                    l['line'][:start],
 
                    tag,
 
                    l['line'][start:last],
 
                    tag,
 
                    l['line'][last:]
 
                )
 
            do(line)
 
            do(next_)
 

	
 
    def _parse_udiff(self, inline_diff=True):
 
        """
 
        Parse the diff an return data for the template.
 
        """
 
        lineiter = self.lines
 
        files = []
 
        try:
 
            line = lineiter.next()
 
            while 1:
 
                # continue until we found the old file
 
                if not line.startswith('--- '):
 
                    line = lineiter.next()
 
                    continue
 

	
 
                chunks = []
 
                stats = [0, 0]
 
                operation, filename, old_rev, new_rev = \
 
                    self._extract_rev(line, lineiter.next())
 
                files.append({
 
                    'filename':         filename,
rhodecode/lib/helpers.py
Show inline comments
 
"""Helper functions
 

	
 
Consists of functions to typically be used within templates, but also
 
available to Controllers. This module is available to both as 'h'.
 
"""
 
import random
 
import hashlib
 
import StringIO
 
import urllib
 
import math
 
import logging
 
import re
 
import urlparse
 

	
 
from datetime import datetime
 
from pygments.formatters.html import HtmlFormatter
 
from pygments import highlight as code_highlight
 
from pylons import url, request, config
 
from pylons.i18n.translation import _, ungettext
 
from hashlib import md5
 

	
 
from webhelpers.html import literal, HTML, escape
 
from webhelpers.html.tools import *
 
from webhelpers.html.builder import make_tag
 
from webhelpers.html.tags import auto_discovery_link, checkbox, css_classes, \
 
    end_form, file, form, hidden, image, javascript_link, link_to, \
 
    link_to_if, link_to_unless, ol, required_legend, select, stylesheet_link, \
 
    submit, text, password, textarea, title, ul, xml_declaration, radio
 
from webhelpers.html.tools import auto_link, button_to, highlight, \
 
    js_obfuscate, mail_to, strip_links, strip_tags, tag_re
 
from webhelpers.number import format_byte_size, format_bit_size
 
from webhelpers.pylonslib import Flash as _Flash
 
from webhelpers.pylonslib.secure_form import secure_form
 
from webhelpers.text import chop_at, collapse, convert_accented_entities, \
 
    convert_misc_entities, lchop, plural, rchop, remove_formatting, \
 
    replace_whitespace, urlify, truncate, wrap_paragraphs
 
from webhelpers.date import time_ago_in_words
 
from webhelpers.paginate import Page
 
from webhelpers.html.tags import _set_input_attrs, _set_id_attr, \
 
    convert_boolean_attrs, NotGiven, _make_safe_id_component
 

	
 
from rhodecode.lib.annotate import annotate_highlight
 
from rhodecode.lib.utils import repo_name_slug
 
from rhodecode.lib.utils2 import str2bool, safe_unicode, safe_str, \
 
    get_changeset_safe, datetime_to_time, time_to_datetime
 
from rhodecode.lib.markup_renderer import MarkupRenderer
 
from rhodecode.lib.vcs.exceptions import ChangesetDoesNotExistError
 
from rhodecode.lib.vcs.backends.base import BaseChangeset
 
from rhodecode.config.conf import DATE_FORMAT, DATETIME_FORMAT
 
from rhodecode.model.changeset_status import ChangesetStatusModel
 
from rhodecode.model.db import URL_SEP, Permission
 

	
 
log = logging.getLogger(__name__)
 

	
 

	
 
html_escape_table = {
 
    "&": "&amp;",
 
    '"': "&quot;",
 
    "'": "&apos;",
 
    ">": "&gt;",
 
    "<": "&lt;",
 
}
 

	
 

	
 
def html_escape(text):
 
    """Produce entities within text."""
 
    return "".join(html_escape_table.get(c,c) for c in text)
 

	
 

	
 
def shorter(text, size=20):
 
    postfix = '...'
 
    if len(text) > size:
 
        return text[:size - len(postfix)] + postfix
 
    return text
 

	
 

	
 
def _reset(name, value=None, id=NotGiven, type="reset", **attrs):
 
    """
 
    Reset button
 
    """
 
    _set_input_attrs(attrs, type, name, value)
 
    _set_id_attr(attrs, id, name)
 
    convert_boolean_attrs(attrs, ["disabled"])
 
    return HTML.input(**attrs)
 

	
 
reset = _reset
 
safeid = _make_safe_id_component
 

	
 

	
 
def FID(raw_id, path):
 
    """
 
    Creates a uniqe ID for filenode based on it's hash of path and revision
 
    it's safe to use in urls
 

	
 
    :param raw_id:
 
    :param path:
 
    """
 

	
 
    return 'C-%s-%s' % (short_id(raw_id), md5(safe_str(path)).hexdigest()[:12])
 

	
 

	
 
def get_token():
 
    """Return the current authentication token, creating one if one doesn't
 
    already exist.
 
    """
 
    token_key = "_authentication_token"
 
    from pylons import session
 
    if not token_key in session:
 
        try:
 
@@ -618,197 +619,201 @@ def action_parser(user_log, feed=False):
 
        pull_request_id = action_params
 
        repo_name = user_log.repository.repo_name
 
        return link_to(_('Pull request #%s') % pull_request_id,
 
                    url('pullrequest_show', repo_name=repo_name,
 
                    pull_request_id=pull_request_id))
 

	
 
    # action : translated str, callback(extractor), icon
 
    action_map = {
 
    'user_deleted_repo':           (_('[deleted] repository'),
 
                                    None, 'database_delete.png'),
 
    'user_created_repo':           (_('[created] repository'),
 
                                    None, 'database_add.png'),
 
    'user_created_fork':           (_('[created] repository as fork'),
 
                                    None, 'arrow_divide.png'),
 
    'user_forked_repo':            (_('[forked] repository'),
 
                                    get_fork_name, 'arrow_divide.png'),
 
    'user_updated_repo':           (_('[updated] repository'),
 
                                    None, 'database_edit.png'),
 
    'admin_deleted_repo':          (_('[delete] repository'),
 
                                    None, 'database_delete.png'),
 
    'admin_created_repo':          (_('[created] repository'),
 
                                    None, 'database_add.png'),
 
    'admin_forked_repo':           (_('[forked] repository'),
 
                                    None, 'arrow_divide.png'),
 
    'admin_updated_repo':          (_('[updated] repository'),
 
                                    None, 'database_edit.png'),
 
    'admin_created_user':          (_('[created] user'),
 
                                    get_user_name, 'user_add.png'),
 
    'admin_updated_user':          (_('[updated] user'),
 
                                    get_user_name, 'user_edit.png'),
 
    'admin_created_users_group':   (_('[created] users group'),
 
                                    get_users_group, 'group_add.png'),
 
    'admin_updated_users_group':   (_('[updated] users group'),
 
                                    get_users_group, 'group_edit.png'),
 
    'user_commented_revision':     (_('[commented] on revision in repository'),
 
                                    get_cs_links, 'comment_add.png'),
 
    'user_commented_pull_request': (_('[commented] on pull request for'),
 
                                    get_pull_request, 'comment_add.png'),
 
    'user_closed_pull_request':    (_('[closed] pull request for'),
 
                                    get_pull_request, 'tick.png'),
 
    'push':                        (_('[pushed] into'),
 
                                    get_cs_links, 'script_add.png'),
 
    'push_local':                  (_('[committed via RhodeCode] into repository'),
 
                                    get_cs_links, 'script_edit.png'),
 
    'push_remote':                 (_('[pulled from remote] into repository'),
 
                                    get_cs_links, 'connect.png'),
 
    'pull':                        (_('[pulled] from'),
 
                                    None, 'down_16.png'),
 
    'started_following_repo':      (_('[started following] repository'),
 
                                    None, 'heart_add.png'),
 
    'stopped_following_repo':      (_('[stopped following] repository'),
 
                                    None, 'heart_delete.png'),
 
    }
 

	
 
    action_str = action_map.get(action, action)
 
    if feed:
 
        action = action_str[0].replace('[', '').replace(']', '')
 
    else:
 
        action = action_str[0]\
 
            .replace('[', '<span class="journal_highlight">')\
 
            .replace(']', '</span>')
 

	
 
    action_params_func = lambda: ""
 

	
 
    if callable(action_str[1]):
 
        action_params_func = action_str[1]
 

	
 
    def action_parser_icon():
 
        action = user_log.action
 
        action_params = None
 
        x = action.split(':')
 

	
 
        if len(x) > 1:
 
            action, action_params = x
 

	
 
        tmpl = """<img src="%s%s" alt="%s"/>"""
 
        ico = action_map.get(action, ['', '', ''])[2]
 
        return literal(tmpl % ((url('/images/icons/')), ico, action))
 

	
 
    # returned callbacks we need to call to get
 
    return [lambda: literal(action), action_params_func, action_parser_icon]
 

	
 

	
 

	
 
#==============================================================================
 
# PERMS
 
#==============================================================================
 
from rhodecode.lib.auth import HasPermissionAny, HasPermissionAll, \
 
HasRepoPermissionAny, HasRepoPermissionAll
 

	
 

	
 
#==============================================================================
 
# GRAVATAR URL
 
#==============================================================================
 

	
 
def gravatar_url(email_address, size=30):
 
    from pylons import url  ## doh, we need to re-import url to mock it later
 
    if(str2bool(config['app_conf'].get('use_gravatar')) and
 
       config['app_conf'].get('alternative_gravatar_url')):
 
        tmpl = config['app_conf'].get('alternative_gravatar_url', '')
 
        parsed_url = urlparse.urlparse(url.current(qualified=True))
 
        tmpl = tmpl.replace('{email}', email_address)\
 
                   .replace('{md5email}', hashlib.md5(email_address.lower()).hexdigest())\
 
                   .replace('{md5email}', hashlib.md5(email_address.lower()).hexdigest()) \
 
                   .replace('{netloc}', parsed_url.netloc)\
 
                   .replace('{scheme}', parsed_url.scheme)\
 
                   .replace('{size}', str(size))
 
        return tmpl
 

	
 
    if (not str2bool(config['app_conf'].get('use_gravatar')) or
 
        not email_address or email_address == 'anonymous@rhodecode.org'):
 
        f = lambda a, l: min(l, key=lambda x: abs(x - a))
 
        return url("/images/user%s.png" % f(size, [14, 16, 20, 24, 30]))
 

	
 
    ssl_enabled = 'https' == request.environ.get('wsgi.url_scheme')
 
    default = 'identicon'
 
    baseurl_nossl = "http://www.gravatar.com/avatar/"
 
    baseurl_ssl = "https://secure.gravatar.com/avatar/"
 
    baseurl = baseurl_ssl if ssl_enabled else baseurl_nossl
 

	
 
    if isinstance(email_address, unicode):
 
        #hashlib crashes on unicode items
 
        email_address = safe_str(email_address)
 
    # construct the url
 
    gravatar_url = baseurl + hashlib.md5(email_address.lower()).hexdigest() + "?"
 
    gravatar_url += urllib.urlencode({'d': default, 's': str(size)})
 

	
 
    return gravatar_url
 

	
 

	
 
#==============================================================================
 
# REPO PAGER, PAGER FOR REPOSITORY
 
#==============================================================================
 
class RepoPage(Page):
 

	
 
    def __init__(self, collection, page=1, items_per_page=20,
 
                 item_count=None, url=None, **kwargs):
 

	
 
        """Create a "RepoPage" instance. special pager for paging
 
        repository
 
        """
 
        self._url_generator = url
 

	
 
        # Safe the kwargs class-wide so they can be used in the pager() method
 
        self.kwargs = kwargs
 

	
 
        # Save a reference to the collection
 
        self.original_collection = collection
 

	
 
        self.collection = collection
 

	
 
        # The self.page is the number of the current page.
 
        # The first page has the number 1!
 
        try:
 
            self.page = int(page)  # make it int() if we get it as a string
 
        except (ValueError, TypeError):
 
            self.page = 1
 

	
 
        self.items_per_page = items_per_page
 

	
 
        # Unless the user tells us how many items the collections has
 
        # we calculate that ourselves.
 
        if item_count is not None:
 
            self.item_count = item_count
 
        else:
 
            self.item_count = len(self.collection)
 

	
 
        # Compute the number of the first and last available page
 
        if self.item_count > 0:
 
            self.first_page = 1
 
            self.page_count = int(math.ceil(float(self.item_count) /
 
                                            self.items_per_page))
 
            self.last_page = self.first_page + self.page_count - 1
 

	
 
            # Make sure that the requested page number is the range of
 
            # valid pages
 
            if self.page > self.last_page:
 
                self.page = self.last_page
 
            elif self.page < self.first_page:
 
                self.page = self.first_page
 

	
 
            # Note: the number of items on this page can be less than
 
            #       items_per_page if the last page is not full
 
            self.first_item = max(0, (self.item_count) - (self.page *
 
                                                          items_per_page))
 
            self.last_item = ((self.item_count - 1) - items_per_page *
 
                              (self.page - 1))
 

	
 
            self.items = list(self.collection[self.first_item:self.last_item + 1])
 

	
 
            # Links to previous and next page
 
            if self.page > self.first_page:
 
                self.previous_page = self.page - 1
 
            else:
 
                self.previous_page = None
 

	
 
            if self.page < self.last_page:
 
                self.next_page = self.page + 1
 
            else:
 
                self.next_page = None
 

	
 
        # No items available
rhodecode/lib/indexers/daemon.py
Show inline comments
 
# -*- coding: utf-8 -*-
 
"""
 
    rhodecode.lib.indexers.daemon
 
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 

	
 
    A daemon will read from task table and run tasks
 

	
 
    :created_on: Jan 26, 2010
 
    :author: marcink
 
    :copyright: (C) 2010-2012 Marcin Kuzminski <marcin@python-works.com>
 
    :license: GPLv3, see COPYING for more details.
 
"""
 
# This program is free software: you can redistribute it and/or modify
 
# it under the terms of the GNU General Public License as published by
 
# the Free Software Foundation, either version 3 of the License, or
 
# (at your option) any later version.
 
#
 
# This program is distributed in the hope that it will be useful,
 
# but WITHOUT ANY WARRANTY; without even the implied warranty of
 
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 
# GNU General Public License for more details.
 
#
 
# You should have received a copy of the GNU General Public License
 
# along with this program.  If not, see <http://www.gnu.org/licenses/>.
 
from __future__ import with_statement
 

	
 
import os
 
import sys
 
import logging
 
import traceback
 

	
 
from shutil import rmtree
 
from time import mktime
 

	
 
from os.path import dirname as dn
 
from os.path import join as jn
 

	
 
#to get the rhodecode import
 
project_path = dn(dn(dn(dn(os.path.realpath(__file__)))))
 
sys.path.append(project_path)
 

	
 
from rhodecode.config.conf import INDEX_EXTENSIONS
 
from rhodecode.model.scm import ScmModel
 
from rhodecode.lib.utils2 import safe_unicode
 
from rhodecode.lib.indexers import SCHEMA, IDX_NAME, CHGSETS_SCHEMA, \
 
    CHGSET_IDX_NAME
 

	
 
from rhodecode.lib.vcs.exceptions import ChangesetError, RepositoryError, \
 
    NodeDoesNotExistError
 

	
 
from whoosh.index import create_in, open_dir, exists_in
 
from whoosh.query import *
 
from whoosh.qparser import QueryParser
 

	
 
log = logging.getLogger('whoosh_indexer')
 

	
 

	
 
class WhooshIndexingDaemon(object):
 
    """
 
    Daemon for atomic indexing jobs
 
    """
 

	
 
    def __init__(self, indexname=IDX_NAME, index_location=None,
 
                 repo_location=None, sa=None, repo_list=None,
 
                 repo_update_list=None):
 
        self.indexname = indexname
 

	
 
        self.index_location = index_location
 
        if not index_location:
 
            raise Exception('You have to provide index location')
 

	
 
        self.repo_location = repo_location
 
        if not repo_location:
 
            raise Exception('You have to provide repositories location')
 

	
 
        self.repo_paths = ScmModel(sa).repo_scan(self.repo_location)
 

	
 
        #filter repo list
 
        if repo_list:
 
            #Fix non-ascii repo names to unicode
 
            repo_list = map(safe_unicode, repo_list)
 
            self.filtered_repo_paths = {}
 
            for repo_name, repo in self.repo_paths.items():
 
                if repo_name in repo_list:
 
                    self.filtered_repo_paths[repo_name] = repo
 

	
 
            self.repo_paths = self.filtered_repo_paths
 

	
 
        #filter update repo list
 
        self.filtered_repo_update_paths = {}
 
        if repo_update_list:
 
            self.filtered_repo_update_paths = {}
 
            for repo_name, repo in self.repo_paths.items():
 
                if repo_name in repo_update_list:
 
                    self.filtered_repo_update_paths[repo_name] = repo
 
            self.repo_paths = self.filtered_repo_update_paths
 

	
 
        self.initial = True
 
        if not os.path.isdir(self.index_location):
 
            os.makedirs(self.index_location)
 
            log.info('Cannot run incremental index since it does not'
 
                     ' yet exist running full build')
 
        elif not exists_in(self.index_location, IDX_NAME):
 
            log.info('Running full index build as the file content'
 
                     ' index does not exist')
 
        elif not exists_in(self.index_location, CHGSET_IDX_NAME):
 
            log.info('Running full index build as the changeset'
 
                     ' index does not exist')
 
        else:
 
            self.initial = False
 

	
 
    def get_paths(self, repo):
 
        """
 
        recursive walk in root dir and return a set of all path in that dir
 
        based on repository walk function
 
        """
 
        index_paths_ = set()
 
        try:
 
            tip = repo.get_changeset('tip')
 
            for _topnode, _dirs, files in tip.walk('/'):
 
                for f in files:
 
                    index_paths_.add(jn(repo.path, f.path))
 

	
 
        except RepositoryError:
 
            log.debug(traceback.format_exc())
 
            pass
 
        return index_paths_
 

	
 
    def get_node(self, repo, path):
 
        n_path = path[len(repo.path) + 1:]
 
        node = repo.get_changeset().get_node(n_path)
 
        return node
 

	
 
    def get_node_mtime(self, node):
 
        return mktime(node.last_changeset.date.timetuple())
 

	
 
    def add_doc(self, writer, path, repo, repo_name):
 
        """
 
        Adding doc to writer this function itself fetches data from
 
        the instance of vcs backend
 
        """
 

	
 
        node = self.get_node(repo, path)
 
        indexed = indexed_w_content = 0
 
        # we just index the content of chosen files, and skip binary files
 
        if node.extension in INDEX_EXTENSIONS and not node.is_binary:
 
            u_content = node.content
 
            if not isinstance(u_content, unicode):
 
                log.warning('  >> %s Could not get this content as unicode '
 
                            'replacing with empty content' % path)
 
                u_content = u''
 
            else:
 
                log.debug('    >> %s [WITH CONTENT]' % path)
 
                indexed_w_content += 1
 

	
 
        else:
 
            log.debug('    >> %s' % path)
 
            # just index file name without it's content
 
            u_content = u''
 
            indexed += 1
 

	
 
        p = safe_unicode(path)
 
        writer.add_document(
 
            fileid=p,
 
            owner=unicode(repo.contact),
 
            repository=safe_unicode(repo_name),
 
            path=p,
 
            content=u_content,
 
            modtime=self.get_node_mtime(node),
 
            extension=node.extension
 
        )
 
        return indexed, indexed_w_content
 

	
 
    def index_changesets(self, writer, repo_name, repo, start_rev=None):
 
        """
 
        Add all changeset in the vcs repo starting at start_rev
 
        to the index writer
 

	
 
        :param writer: the whoosh index writer to add to
 
        :param repo_name: name of the repository from whence the
 
          changeset originates including the repository group
 
        :param repo: the vcs repository instance to index changesets for,
 
          the presumption is the repo has changesets to index
 
        :param start_rev=None: the full sha id to start indexing from
 
          if start_rev is None then index from the first changeset in
 
          the repo
 
        """
 

	
 
        if start_rev is None:
 
            start_rev = repo[0].raw_id
 

	
 
        log.debug('indexing changesets in %s starting at rev: %s' %
 
                  (repo_name, start_rev))
 

	
 
        indexed = 0
 
        for cs in repo.get_changesets(start=start_rev):
 
            log.debug('    >> %s' % cs)
 
            writer.add_document(
 
                raw_id=unicode(cs.raw_id),
 
                owner=unicode(repo.contact),
 
                date=cs._timestamp,
 
                repository=safe_unicode(repo_name),
 
                author=cs.author,
 
                message=cs.message,
 
                last=cs.last,
 
                added=u' '.join([safe_unicode(node.path) for node in cs.added]).lower(),
 
                removed=u' '.join([safe_unicode(node.path) for node in cs.removed]).lower(),
 
                changed=u' '.join([safe_unicode(node.path) for node in cs.changed]).lower(),
 
                parents=u' '.join([cs.raw_id for cs in cs.parents]),
 
            )
 
            indexed += 1
 

	
 
        log.debug('indexed %d changesets for repo %s' % (indexed, repo_name))
 
        return indexed
 

	
 
    def index_files(self, file_idx_writer, repo_name, repo):
 
        """
 
        Index files for given repo_name
 

	
 
        :param file_idx_writer: the whoosh index writer to add to
 
        :param repo_name: name of the repository we're indexing
 
        :param repo: instance of vcs repo
 
        """
 
        i_cnt = iwc_cnt = 0
 
        log.debug('building index for [%s]' % repo.path)
 
        for idx_path in self.get_paths(repo):
 
            i, iwc = self.add_doc(file_idx_writer, idx_path, repo, repo_name)
 
            i_cnt += i
 
            iwc_cnt += iwc
 

	
 
        log.debug('added %s files %s with content for repo %s' %
 
                  (i_cnt + iwc_cnt, iwc_cnt, repo.path))
 
        return i_cnt, iwc_cnt
 

	
 
    def update_changeset_index(self):
 
        idx = open_dir(self.index_location, indexname=CHGSET_IDX_NAME)
 

	
 
        with idx.searcher() as searcher:
 
            writer = idx.writer()
 
            writer_is_dirty = False
 
            try:
 
                indexed_total = 0
 
                repo_name = None
 
                for repo_name, repo in self.repo_paths.items():
 
                    # skip indexing if there aren't any revs in the repo
 
                    num_of_revs = len(repo)
 
                    if num_of_revs < 1:
 
                        continue
 

	
 
                    qp = QueryParser('repository', schema=CHGSETS_SCHEMA)
 
                    q = qp.parse(u"last:t AND %s" % repo_name)
 

	
 
                    results = searcher.search(q)
 

	
 
                    # default to scanning the entire repo
 
                    last_rev = 0
 
                    start_id = None
 

	
 
                    if len(results) > 0:
 
                        # assuming that there is only one result, if not this
 
                        # may require a full re-index.
 
                        start_id = results[0]['raw_id']
 
                        last_rev = repo.get_changeset(revision=start_id).revision
 

	
 
                    # there are new changesets to index or a new repo to index
 
                    if last_rev == 0 or num_of_revs > last_rev + 1:
 
                        # delete the docs in the index for the previous
 
                        # last changeset(s)
 
                        for hit in results:
 
                            q = qp.parse(u"last:t AND %s AND raw_id:%s" %
 
                                            (repo_name, hit['raw_id']))
 
                            writer.delete_by_query(q)
 

	
 
                        # index from the previous last changeset + all new ones
 
                        indexed_total += self.index_changesets(writer,
 
                                                repo_name, repo, start_id)
 
                        writer_is_dirty = True
 
                log.debug('indexed %s changesets for repo %s' % (
 
                             indexed_total, repo_name)
 
                )
 
            finally:
 
                if writer_is_dirty:
 
                    log.debug('>> COMMITING CHANGES TO CHANGESET INDEX<<')
 
                    writer.commit(merge=True)
 
                    log.debug('>> COMMITTED CHANGES TO CHANGESET INDEX<<')
 
                    log.debug('>>> FINISHED REBUILDING CHANGESET INDEX <<<')
 
                else:
 
                    writer.cancel
 
                    log.debug('>> NOTHING TO COMMIT<<')
 
                    log.debug('>> NOTHING TO COMMIT TO CHANGESET INDEX<<')
 

	
 
    def update_file_index(self):
 
        log.debug((u'STARTING INCREMENTAL INDEXING UPDATE FOR EXTENSIONS %s '
 
                   'AND REPOS %s') % (INDEX_EXTENSIONS, self.repo_paths.keys()))
 

	
 
        idx = open_dir(self.index_location, indexname=self.indexname)
 
        # The set of all paths in the index
 
        indexed_paths = set()
 
        # The set of all paths we need to re-index
 
        to_index = set()
 

	
 
        writer = idx.writer()
 
        writer_is_dirty = False
 
        try:
 
            with idx.reader() as reader:
 

	
 
                # Loop over the stored fields in the index
 
                for fields in reader.all_stored_fields():
 
                    indexed_path = fields['path']
 
                    indexed_repo_path = fields['repository']
 
                    indexed_paths.add(indexed_path)
 

	
 
                    if not indexed_repo_path in self.filtered_repo_update_paths:
 
                        continue
 

	
 
                    repo = self.repo_paths[indexed_repo_path]
 

	
 
                    try:
 
                        node = self.get_node(repo, indexed_path)
 
                        # Check if this file was changed since it was indexed
 
                        indexed_time = fields['modtime']
 
                        mtime = self.get_node_mtime(node)
 
                        if mtime > indexed_time:
 
                            # The file has changed, delete it and add it to
 
                            # the list of files to reindex
 
                            log.debug(
 
                                'adding to reindex list %s mtime: %s vs %s' % (
 
                                    indexed_path, mtime, indexed_time)
 
                            )
 
                            writer.delete_by_term('fileid', indexed_path)
 
                            writer_is_dirty = True
 

	
 
                            to_index.add(indexed_path)
 
                    except (ChangesetError, NodeDoesNotExistError):
 
                        # This file was deleted since it was indexed
 
                        log.debug('removing from index %s' % indexed_path)
 
                        writer.delete_by_term('path', indexed_path)
 
                        writer_is_dirty = True
 

	
 
            # Loop over the files in the filesystem
 
            # Assume we have a function that gathers the filenames of the
 
            # documents to be indexed
 
            ri_cnt_total = 0  # indexed
 
            riwc_cnt_total = 0  # indexed with content
 
            for repo_name, repo in self.repo_paths.items():
 
                # skip indexing if there aren't any revisions
 
                if len(repo) < 1:
 
                    continue
 
                ri_cnt = 0   # indexed
 
                riwc_cnt = 0  # indexed with content
 
                for path in self.get_paths(repo):
 
                    path = safe_unicode(path)
 
                    if path in to_index or path not in indexed_paths:
 

	
 
                        # This is either a file that's changed, or a new file
 
                        # that wasn't indexed before. So index it!
 
                        i, iwc = self.add_doc(writer, path, repo, repo_name)
 
                        writer_is_dirty = True
 
                        log.debug('re indexing %s' % path)
 
                        ri_cnt += i
 
                        ri_cnt_total += 1
 
                        riwc_cnt += iwc
 
                        riwc_cnt_total += iwc
 
                log.debug('added %s files %s with content for repo %s' % (
 
                             ri_cnt + riwc_cnt, riwc_cnt, repo.path)
 
                )
 
            log.debug('indexed %s files in total and %s with content' % (
 
                        ri_cnt_total, riwc_cnt_total)
 
            )
 
        finally:
 
            if writer_is_dirty:
 
                log.debug('>> COMMITING CHANGES <<')
 
                log.debug('>> COMMITING CHANGES TO FILE INDEX <<')
 
                writer.commit(merge=True)
 
                log.debug('>>> FINISHED REBUILDING INDEX <<<')
 
                log.debug('>>> FINISHED REBUILDING FILE INDEX <<<')
 
            else:
 
                log.debug('>> NOTHING TO COMMIT<<')
 
                log.debug('>> NOTHING TO COMMIT TO FILE INDEX <<')
 
                writer.cancel()
 

	
 
    def build_indexes(self):
 
        if os.path.exists(self.index_location):
 
            log.debug('removing previous index')
 
            rmtree(self.index_location)
 

	
 
        if not os.path.exists(self.index_location):
 
            os.mkdir(self.index_location)
 

	
 
        chgset_idx = create_in(self.index_location, CHGSETS_SCHEMA,
 
                               indexname=CHGSET_IDX_NAME)
 
        chgset_idx_writer = chgset_idx.writer()
 

	
 
        file_idx = create_in(self.index_location, SCHEMA, indexname=IDX_NAME)
 
        file_idx_writer = file_idx.writer()
 
        log.debug('BUILDING INDEX FOR EXTENSIONS %s '
 
                  'AND REPOS %s' % (INDEX_EXTENSIONS, self.repo_paths.keys()))
 

	
 
        for repo_name, repo in self.repo_paths.items():
 
            # skip indexing if there aren't any revisions
 
            if len(repo) < 1:
 
                continue
 

	
 
            self.index_files(file_idx_writer, repo_name, repo)
 
            self.index_changesets(chgset_idx_writer, repo_name, repo)
 

	
 
        log.debug('>> COMMITING CHANGES <<')
 
        file_idx_writer.commit(merge=True)
 
        chgset_idx_writer.commit(merge=True)
 
        log.debug('>>> FINISHED BUILDING INDEX <<<')
 

	
 
    def update_indexes(self):
 
        self.update_file_index()
 
        self.update_changeset_index()
 

	
 
    def run(self, full_index=False):
 
        """Run daemon"""
 
        if full_index or self.initial:
 
            self.build_indexes()
 
        else:
 
            self.update_indexes()
rhodecode/lib/utils2.py
Show inline comments
 
@@ -54,192 +54,209 @@ def __get_lem():
 
        else:
 
            return map(lower, [s])
 

	
 
    for lx, t in sorted(lexers.LEXERS.items()):
 
        m = map(__clean, t[-2])
 
        if m:
 
            m = reduce(lambda x, y: x + y, m)
 
            for ext in m:
 
                desc = lx.replace('Lexer', '')
 
                d[ext].append(desc)
 

	
 
    return dict(d)
 

	
 
def str2bool(_str):
 
    """
 
    returs True/False value from given string, it tries to translate the
 
    string into boolean
 

	
 
    :param _str: string value to translate into boolean
 
    :rtype: boolean
 
    :returns: boolean from given string
 
    """
 
    if _str is None:
 
        return False
 
    if _str in (True, False):
 
        return _str
 
    _str = str(_str).strip().lower()
 
    return _str in ('t', 'true', 'y', 'yes', 'on', '1')
 

	
 

	
 
def convert_line_endings(line, mode):
 
    """
 
    Converts a given line  "line end" accordingly to given mode
 

	
 
    Available modes are::
 
        0 - Unix
 
        1 - Mac
 
        2 - DOS
 

	
 
    :param line: given line to convert
 
    :param mode: mode to convert to
 
    :rtype: str
 
    :return: converted line according to mode
 
    """
 
    from string import replace
 

	
 
    if mode == 0:
 
            line = replace(line, '\r\n', '\n')
 
            line = replace(line, '\r', '\n')
 
    elif mode == 1:
 
            line = replace(line, '\r\n', '\r')
 
            line = replace(line, '\n', '\r')
 
    elif mode == 2:
 
            line = re.sub("\r(?!\n)|(?<!\r)\n", "\r\n", line)
 
    return line
 

	
 

	
 
def detect_mode(line, default):
 
    """
 
    Detects line break for given line, if line break couldn't be found
 
    given default value is returned
 

	
 
    :param line: str line
 
    :param default: default
 
    :rtype: int
 
    :return: value of line end on of 0 - Unix, 1 - Mac, 2 - DOS
 
    """
 
    if line.endswith('\r\n'):
 
        return 2
 
    elif line.endswith('\n'):
 
        return 0
 
    elif line.endswith('\r'):
 
        return 1
 
    else:
 
        return default
 

	
 

	
 
def generate_api_key(username, salt=None):
 
    """
 
    Generates unique API key for given username, if salt is not given
 
    it'll be generated from some random string
 

	
 
    :param username: username as string
 
    :param salt: salt to hash generate KEY
 
    :rtype: str
 
    :returns: sha1 hash from username+salt
 
    """
 
    from tempfile import _RandomNameSequence
 
    import hashlib
 

	
 
    if salt is None:
 
        salt = _RandomNameSequence().next()
 

	
 
    return hashlib.sha1(username + salt).hexdigest()
 

	
 

	
 
def safe_int(val, default=None):
 
    """
 
    Returns int() of val if val is not convertable to int use default
 
    instead
 

	
 
    :param val:
 
    :param default:
 
    """
 

	
 
    try:
 
        val = int(val)
 
    except ValueError:
 
        val = default
 

	
 
    return val
 

	
 

	
 
def safe_unicode(str_, from_encoding=None):
 
    """
 
    safe unicode function. Does few trick to turn str_ into unicode
 

	
 
    In case of UnicodeDecode error we try to return it with encoding detected
 
    by chardet library if it fails fallback to unicode with errors replaced
 

	
 
    :param str_: string to decode
 
    :rtype: unicode
 
    :returns: unicode object
 
    """
 
    if isinstance(str_, unicode):
 
        return str_
 

	
 
    if not from_encoding:
 
        import rhodecode
 
        DEFAULT_ENCODING = rhodecode.CONFIG.get('default_encoding','utf8')
 
        from_encoding = DEFAULT_ENCODING
 

	
 
    try:
 
        return unicode(str_)
 
    except UnicodeDecodeError:
 
        pass
 

	
 
    try:
 
        return unicode(str_, from_encoding)
 
    except UnicodeDecodeError:
 
        pass
 

	
 
    try:
 
        import chardet
 
        encoding = chardet.detect(str_)['encoding']
 
        if encoding is None:
 
            raise Exception()
 
        return str_.decode(encoding)
 
    except (ImportError, UnicodeDecodeError, Exception):
 
        return unicode(str_, from_encoding, 'replace')
 

	
 

	
 
def safe_str(unicode_, to_encoding=None):
 
    """
 
    safe str function. Does few trick to turn unicode_ into string
 

	
 
    In case of UnicodeEncodeError we try to return it with encoding detected
 
    by chardet library if it fails fallback to string with errors replaced
 

	
 
    :param unicode_: unicode to encode
 
    :rtype: str
 
    :returns: str object
 
    """
 

	
 
    # if it's not basestr cast to str
 
    if not isinstance(unicode_, basestring):
 
        return str(unicode_)
 

	
 
    if isinstance(unicode_, str):
 
        return unicode_
 

	
 
    if not to_encoding:
 
        import rhodecode
 
        DEFAULT_ENCODING = rhodecode.CONFIG.get('default_encoding','utf8')
 
        to_encoding = DEFAULT_ENCODING
 

	
 
    try:
 
        return unicode_.encode(to_encoding)
 
    except UnicodeEncodeError:
 
        pass
 

	
 
    try:
 
        import chardet
 
        encoding = chardet.detect(unicode_)['encoding']
 
        if encoding is None:
 
            raise UnicodeEncodeError()
 

	
 
        return unicode_.encode(encoding)
 
    except (ImportError, UnicodeEncodeError):
 
        return unicode_.encode(to_encoding, 'replace')
 

	
 
    return safe_str
 

	
 

	
 
def engine_from_config(configuration, prefix='sqlalchemy.', **kwargs):
 
    """
 
    Custom engine_from_config functions that makes sure we use NullPool for
 
    file based sqlite databases. This prevents errors on sqlite. This only
 
    applies to sqlalchemy versions < 0.7.0
 

	
 
    """
 
    import sqlalchemy
 
    from sqlalchemy import engine_from_config as efc
 
    import logging
 

	
 
    if int(sqlalchemy.__version__.split('.')[1]) < 7:
 

	
 
        # This solution should work for sqlalchemy < 0.7.0, and should use
 
        # proxy=TimerProxy() for execution time profiling
rhodecode/lib/vcs/utils/diffs.py
Show inline comments
 
# -*- coding: utf-8 -*-
 
# original copyright: 2007-2008 by Armin Ronacher
 
# licensed under the BSD license.
 

	
 
import re
 
import difflib
 
import logging
 

	
 
from difflib import unified_diff
 
from itertools import tee, imap
 

	
 
from mercurial.match import match
 

	
 
from rhodecode.lib.vcs.exceptions import VCSError
 
from rhodecode.lib.vcs.nodes import FileNode, NodeError
 
from rhodecode.lib.vcs.utils import safe_unicode
 

	
 

	
 
def get_udiff(filenode_old, filenode_new, show_whitespace=True):
 
    """
 
    Returns unified diff between given ``filenode_old`` and ``filenode_new``.
 
    """
 
    try:
 
        filenode_old_date = filenode_old.changeset.date
 
    except NodeError:
 
        filenode_old_date = None
 

	
 
    try:
 
        filenode_new_date = filenode_new.changeset.date
 
    except NodeError:
 
        filenode_new_date = None
 

	
 
    for filenode in (filenode_old, filenode_new):
 
        if not isinstance(filenode, FileNode):
 
            raise VCSError("Given object should be FileNode object, not %s"
 
                % filenode.__class__)
 

	
 
    if filenode_old_date and filenode_new_date:
 
        if not filenode_old_date < filenode_new_date:
 
            logging.debug("Generating udiff for filenodes with not increasing "
 
                "dates")
 

	
 
    vcs_udiff = unified_diff(filenode_old.content.splitlines(True),
 
                               filenode_new.content.splitlines(True),
 
                               filenode_old.name,
 
                               filenode_new.name,
 
                               filenode_old_date,
 
                               filenode_old_date)
 
    return vcs_udiff
 

	
 

	
 
def get_gitdiff(filenode_old, filenode_new, ignore_whitespace=True):
 
    """
 
    Returns git style diff between given ``filenode_old`` and ``filenode_new``.
 

	
 
    :param ignore_whitespace: ignore whitespaces in diff
 
    """
 

	
 
    for filenode in (filenode_old, filenode_new):
 
        if not isinstance(filenode, FileNode):
 
            raise VCSError("Given object should be FileNode object, not %s"
 
                % filenode.__class__)
 

	
 
    old_raw_id = getattr(filenode_old.changeset, 'raw_id', '0' * 40)
 
    new_raw_id = getattr(filenode_new.changeset, 'raw_id', '0' * 40)
 

	
 
    repo = filenode_new.changeset.repository
 
    vcs_gitdiff = repo._get_diff(old_raw_id, new_raw_id, filenode_new.path,
 
                                 ignore_whitespace)
 

	
 
    return vcs_gitdiff
 

	
 

	
 
class DiffProcessor(object):
 
    """
 
    Give it a unified diff and it returns a list of the files that were
 
    mentioned in the diff together with a dict of meta information that
 
    can be used to render it in a HTML template.
 
    """
 
    _chunk_re = re.compile(r'@@ -(\d+)(?:,(\d+))? \+(\d+)(?:,(\d+))? @@(.*)')
 

	
 
    def __init__(self, diff, differ='diff', format='udiff'):
 
        """
 
        :param diff:   a text in diff format or generator
 
        :param format: format of diff passed, `udiff` or `gitdiff`
 
        """
 
        if isinstance(diff, basestring):
 
            diff = [diff]
 

	
 
        self.__udiff = diff
 
        self.__format = format
 
        self.adds = 0
 
        self.removes = 0
 

	
 
        if isinstance(self.__udiff, basestring):
 
            self.lines = iter(self.__udiff.splitlines(1))
 

	
 
        elif self.__format == 'gitdiff':
 
            udiff_copy = self.copy_iterator()
 
            self.lines = imap(self.escaper, self._parse_gitdiff(udiff_copy))
 
        else:
 
            udiff_copy = self.copy_iterator()
 
            self.lines = imap(self.escaper, udiff_copy)
 

	
 
        # Select a differ.
 
        if differ == 'difflib':
 
            self.differ = self._highlight_line_difflib
 
        else:
 
            self.differ = self._highlight_line_udiff
 

	
 
    def escaper(self, string):
 
        return string.replace('<', '&lt;').replace('>', '&gt;')
 

	
 
    def copy_iterator(self):
 
        """
 
        make a fresh copy of generator, we should not iterate thru
 
        an original as it's needed for repeating operations on
 
        this instance of DiffProcessor
 
        """
 
        self.__udiff, iterator_copy = tee(self.__udiff)
 
        return iterator_copy
 

	
 
    def _extract_rev(self, line1, line2):
 
        """
 
        Extract the filename and revision hint from a line.
 
        """
 

	
 
        try:
 
            if line1.startswith('--- ') and line2.startswith('+++ '):
 
                l1 = line1[4:].split(None, 1)
 
                old_filename = l1[0].lstrip('a/') if len(l1) >= 1 else None
 
                old_rev = l1[1] if len(l1) == 2 else 'old'
 

	
 
                l2 = line2[4:].split(None, 1)
 
                new_filename = l2[0].lstrip('b/') if len(l1) >= 1 else None
 
                new_rev = l2[1] if len(l2) == 2 else 'new'
 

	
 
                filename = old_filename if (old_filename !=
 
                                            'dev/null') else new_filename
 

	
 
                return filename, new_rev, old_rev
 
        except (ValueError, IndexError):
 
            pass
 

	
 
        return None, None, None
 

	
 
    def _parse_gitdiff(self, diffiterator):
 
        def line_decoder(l):
 
            if l.startswith('+') and not l.startswith('+++'):
 
                self.adds += 1
 
            elif l.startswith('-') and not l.startswith('---'):
 
                self.removes += 1
 
            return l.decode('utf8', 'replace')
 
            return safe_unicode(l)
 

	
 
        output = list(diffiterator)
 
        size = len(output)
 

	
 
        if size == 2:
 
            l = []
 
            l.extend([output[0]])
 
            l.extend(output[1].splitlines(1))
 
            return map(line_decoder, l)
 
        elif size == 1:
 
            return  map(line_decoder, output[0].splitlines(1))
 
        elif size == 0:
 
            return []
 

	
 
        raise Exception('wrong size of diff %s' % size)
 

	
 
    def _highlight_line_difflib(self, line, next):
 
        """
 
        Highlight inline changes in both lines.
 
        """
 

	
 
        if line['action'] == 'del':
 
            old, new = line, next
 
        else:
 
            old, new = next, line
 

	
 
        oldwords = re.split(r'(\W)', old['line'])
 
        newwords = re.split(r'(\W)', new['line'])
 

	
 
        sequence = difflib.SequenceMatcher(None, oldwords, newwords)
 

	
 
        oldfragments, newfragments = [], []
 
        for tag, i1, i2, j1, j2 in sequence.get_opcodes():
 
            oldfrag = ''.join(oldwords[i1:i2])
 
            newfrag = ''.join(newwords[j1:j2])
 
            if tag != 'equal':
 
                if oldfrag:
 
                    oldfrag = '<del>%s</del>' % oldfrag
 
                if newfrag:
 
                    newfrag = '<ins>%s</ins>' % newfrag
 
            oldfragments.append(oldfrag)
 
            newfragments.append(newfrag)
 

	
 
        old['line'] = "".join(oldfragments)
 
        new['line'] = "".join(newfragments)
 

	
 
    def _highlight_line_udiff(self, line, next):
 
        """
 
        Highlight inline changes in both lines.
 
        """
 
        start = 0
 
        limit = min(len(line['line']), len(next['line']))
 
        while start < limit and line['line'][start] == next['line'][start]:
 
            start += 1
 
        end = -1
 
        limit -= start
 
        while -end <= limit and line['line'][end] == next['line'][end]:
 
            end -= 1
 
        end += 1
 
        if start or end:
 
            def do(l):
 
                last = end + len(l['line'])
 
                if l['action'] == 'add':
 
                    tag = 'ins'
 
                else:
 
                    tag = 'del'
 
                l['line'] = '%s<%s>%s</%s>%s' % (
 
                    l['line'][:start],
 
                    tag,
 
                    l['line'][start:last],
 
                    tag,
 
                    l['line'][last:]
 
                )
 
            do(line)
 
            do(next)
 

	
 
    def _parse_udiff(self):
 
        """
 
        Parse the diff an return data for the template.
 
        """
 
        lineiter = self.lines
 
        files = []
 
        try:
 
            line = lineiter.next()
 
            # skip first context
 
            skipfirst = True
 
            while 1:
 
                # continue until we found the old file
 
                if not line.startswith('--- '):
 
                    line = lineiter.next()
 
                    continue
 

	
 
                chunks = []
 
                filename, old_rev, new_rev = \
 
                    self._extract_rev(line, lineiter.next())
 
                files.append({
rhodecode/model/db.py
Show inline comments
 
@@ -934,200 +934,206 @@ class Repository(Base, BaseModel):
 
    # SCM CACHE INSTANCE
 
    #==========================================================================
 

	
 
    @property
 
    def invalidate(self):
 
        return CacheInvalidation.invalidate(self.repo_name)
 

	
 
    def set_invalidate(self):
 
        """
 
        set a cache for invalidation for this instance
 
        """
 
        CacheInvalidation.set_invalidate(self.repo_name)
 

	
 
    @LazyProperty
 
    def scm_instance(self):
 
        return self.__get_instance()
 

	
 
    def scm_instance_cached(self, cache_map=None):
 
        @cache_region('long_term')
 
        def _c(repo_name):
 
            return self.__get_instance()
 
        rn = self.repo_name
 
        log.debug('Getting cached instance of repo')
 

	
 
        if cache_map:
 
            # get using prefilled cache_map
 
            invalidate_repo = cache_map[self.repo_name]
 
            if invalidate_repo:
 
                invalidate_repo = (None if invalidate_repo.cache_active
 
                                   else invalidate_repo)
 
        else:
 
            # get from invalidate
 
            invalidate_repo = self.invalidate
 

	
 
        if invalidate_repo is not None:
 
            region_invalidate(_c, None, rn)
 
            # update our cache
 
            CacheInvalidation.set_valid(invalidate_repo.cache_key)
 
        return _c(rn)
 

	
 
    def __get_instance(self):
 
        repo_full_path = self.repo_full_path
 
        try:
 
            alias = get_scm(repo_full_path)[0]
 
            log.debug('Creating instance of %s repository' % alias)
 
            backend = get_backend(alias)
 
        except VCSError:
 
            log.error(traceback.format_exc())
 
            log.error('Perhaps this repository is in db and not in '
 
                      'filesystem run rescan repositories with '
 
                      '"destroy old data " option from admin panel')
 
            return
 

	
 
        if alias == 'hg':
 

	
 
            repo = backend(safe_str(repo_full_path), create=False,
 
                           baseui=self._ui)
 
            # skip hidden web repository
 
            if repo._get_hidden():
 
                return
 
        else:
 
            repo = backend(repo_full_path, create=False)
 

	
 
        return repo
 

	
 

	
 
class RepoGroup(Base, BaseModel):
 
    __tablename__ = 'groups'
 
    __table_args__ = (
 
        UniqueConstraint('group_name', 'group_parent_id'),
 
        CheckConstraint('group_id != group_parent_id'),
 
        {'extend_existing': True, 'mysql_engine': 'InnoDB',
 
         'mysql_charset': 'utf8'},
 
    )
 
    __mapper_args__ = {'order_by': 'group_name'}
 

	
 
    group_id = Column("group_id", Integer(), nullable=False, unique=True, default=None, primary_key=True)
 
    group_name = Column("group_name", String(255, convert_unicode=False, assert_unicode=None), nullable=False, unique=True, default=None)
 
    group_parent_id = Column("group_parent_id", Integer(), ForeignKey('groups.group_id'), nullable=True, unique=None, default=None)
 
    group_description = Column("group_description", String(10000, convert_unicode=False, assert_unicode=None), nullable=True, unique=None, default=None)
 
    enable_locking = Column("enable_locking", Boolean(), nullable=False, unique=None, default=False)
 

	
 
    repo_group_to_perm = relationship('UserRepoGroupToPerm', cascade='all', order_by='UserRepoGroupToPerm.group_to_perm_id')
 
    users_group_to_perm = relationship('UsersGroupRepoGroupToPerm', cascade='all')
 

	
 
    parent_group = relationship('RepoGroup', remote_side=group_id)
 

	
 
    def __init__(self, group_name='', parent_group=None):
 
        self.group_name = group_name
 
        self.parent_group = parent_group
 

	
 
    def __unicode__(self):
 
        return u"<%s('%s:%s')>" % (self.__class__.__name__, self.group_id,
 
                                  self.group_name)
 

	
 
    @classmethod
 
    def groups_choices(cls):
 
    def groups_choices(cls, check_perms=False):
 
        from webhelpers.html import literal as _literal
 
        from rhodecode.model.scm import ScmModel
 
        groups = cls.query().all()
 
        if check_perms:
 
            #filter group user have access to, it's done
 
            #magically inside ScmModel based on current user
 
            groups = ScmModel().get_repos_groups(groups)
 
        repo_groups = [('', '')]
 
        sep = ' &raquo; '
 
        _name = lambda k: _literal(sep.join(k))
 

	
 
        repo_groups.extend([(x.group_id, _name(x.full_path_splitted))
 
                              for x in cls.query().all()])
 
                              for x in groups])
 

	
 
        repo_groups = sorted(repo_groups, key=lambda t: t[1].split(sep)[0])
 
        return repo_groups
 

	
 
    @classmethod
 
    def url_sep(cls):
 
        return URL_SEP
 

	
 
    @classmethod
 
    def get_by_group_name(cls, group_name, cache=False, case_insensitive=False):
 
        if case_insensitive:
 
            gr = cls.query()\
 
                .filter(cls.group_name.ilike(group_name))
 
        else:
 
            gr = cls.query()\
 
                .filter(cls.group_name == group_name)
 
        if cache:
 
            gr = gr.options(FromCache(
 
                            "sql_cache_short",
 
                            "get_group_%s" % _hash_key(group_name)
 
                            )
 
            )
 
        return gr.scalar()
 

	
 
    @property
 
    def parents(self):
 
        parents_recursion_limit = 5
 
        groups = []
 
        if self.parent_group is None:
 
            return groups
 
        cur_gr = self.parent_group
 
        groups.insert(0, cur_gr)
 
        cnt = 0
 
        while 1:
 
            cnt += 1
 
            gr = getattr(cur_gr, 'parent_group', None)
 
            cur_gr = cur_gr.parent_group
 
            if gr is None:
 
                break
 
            if cnt == parents_recursion_limit:
 
                # this will prevent accidental infinit loops
 
                log.error('group nested more than %s' %
 
                          parents_recursion_limit)
 
                break
 

	
 
            groups.insert(0, gr)
 
        return groups
 

	
 
    @property
 
    def children(self):
 
        return RepoGroup.query().filter(RepoGroup.parent_group == self)
 

	
 
    @property
 
    def name(self):
 
        return self.group_name.split(RepoGroup.url_sep())[-1]
 

	
 
    @property
 
    def full_path(self):
 
        return self.group_name
 

	
 
    @property
 
    def full_path_splitted(self):
 
        return self.group_name.split(RepoGroup.url_sep())
 

	
 
    @property
 
    def repositories(self):
 
        return Repository.query()\
 
                .filter(Repository.group == self)\
 
                .order_by(Repository.repo_name)
 

	
 
    @property
 
    def repositories_recursive_count(self):
 
        cnt = self.repositories.count()
 

	
 
        def children_count(group):
 
            cnt = 0
 
            for child in group.children:
 
                cnt += child.repositories.count()
 
                cnt += children_count(child)
 
            return cnt
 

	
 
        return cnt + children_count(self)
 

	
 
    def recursive_groups_and_repos(self):
 
        """
 
        Recursive return all groups, with repositories in those groups
 
        """
 
        all_ = []
 

	
 
        def _get_members(root_gr):
 
            for r in root_gr.repositories:
 
                all_.append(r)
 
            childs = root_gr.children.all()
 
            if childs:
 
                for gr in childs:
 
                    all_.append(gr)
rhodecode/model/forms.py
Show inline comments
 
@@ -84,219 +84,221 @@ def UserForm(edit=False, old_data={}):
 
                v.UnicodeString(strip=False, min=6, not_empty=False)
 
            )
 

	
 
        active = v.StringBoolean(if_missing=False)
 
        firstname = v.UnicodeString(strip=True, min=1, not_empty=False)
 
        lastname = v.UnicodeString(strip=True, min=1, not_empty=False)
 
        email = All(v.Email(not_empty=True), v.UniqSystemEmail(old_data))
 

	
 
        chained_validators = [v.ValidPasswordsMatch()]
 

	
 
    return _UserForm
 

	
 

	
 
def UsersGroupForm(edit=False, old_data={}, available_members=[]):
 
    class _UsersGroupForm(formencode.Schema):
 
        allow_extra_fields = True
 
        filter_extra_fields = True
 

	
 
        users_group_name = All(
 
            v.UnicodeString(strip=True, min=1, not_empty=True),
 
            v.ValidUsersGroup(edit, old_data)
 
        )
 

	
 
        users_group_active = v.StringBoolean(if_missing=False)
 

	
 
        if edit:
 
            users_group_members = v.OneOf(
 
                available_members, hideList=False, testValueList=True,
 
                if_missing=None, not_empty=False
 
            )
 

	
 
    return _UsersGroupForm
 

	
 

	
 
def ReposGroupForm(edit=False, old_data={}, available_groups=[]):
 
    class _ReposGroupForm(formencode.Schema):
 
        allow_extra_fields = True
 
        filter_extra_fields = False
 

	
 
        group_name = All(v.UnicodeString(strip=True, min=1, not_empty=True),
 
                               v.SlugifyName())
 
        group_description = v.UnicodeString(strip=True, min=1,
 
                                                not_empty=True)
 
        group_parent_id = v.OneOf(available_groups, hideList=False,
 
                                        testValueList=True,
 
                                        if_missing=None, not_empty=False)
 
        enable_locking = v.StringBoolean(if_missing=False)
 
        recursive = v.StringBoolean(if_missing=False)
 
        chained_validators = [v.ValidReposGroup(edit, old_data),
 
                              v.ValidPerms('group')]
 

	
 
    return _ReposGroupForm
 

	
 

	
 
def RegisterForm(edit=False, old_data={}):
 
    class _RegisterForm(formencode.Schema):
 
        allow_extra_fields = True
 
        filter_extra_fields = True
 
        username = All(
 
            v.ValidUsername(edit, old_data),
 
            v.UnicodeString(strip=True, min=1, not_empty=True)
 
        )
 
        password = All(
 
            v.ValidPassword(),
 
            v.UnicodeString(strip=False, min=6, not_empty=True)
 
        )
 
        password_confirmation = All(
 
            v.ValidPassword(),
 
            v.UnicodeString(strip=False, min=6, not_empty=True)
 
        )
 
        active = v.StringBoolean(if_missing=False)
 
        firstname = v.UnicodeString(strip=True, min=1, not_empty=False)
 
        lastname = v.UnicodeString(strip=True, min=1, not_empty=False)
 
        email = All(v.Email(not_empty=True), v.UniqSystemEmail(old_data))
 

	
 
        chained_validators = [v.ValidPasswordsMatch()]
 

	
 
    return _RegisterForm
 

	
 

	
 
def PasswordResetForm():
 
    class _PasswordResetForm(formencode.Schema):
 
        allow_extra_fields = True
 
        filter_extra_fields = True
 
        email = All(v.ValidSystemEmail(), v.Email(not_empty=True))
 
    return _PasswordResetForm
 

	
 

	
 
def RepoForm(edit=False, old_data={}, supported_backends=BACKENDS.keys(),
 
             repo_groups=[], landing_revs=[]):
 
    class _RepoForm(formencode.Schema):
 
        allow_extra_fields = True
 
        filter_extra_fields = False
 
        repo_name = All(v.UnicodeString(strip=True, min=1, not_empty=True),
 
                        v.SlugifyName())
 
        clone_uri = All(v.UnicodeString(strip=True, min=1, not_empty=False))
 
        repo_group = v.OneOf(repo_groups, hideList=True)
 
        repo_group = All(v.CanWriteGroup(),
 
                         v.OneOf(repo_groups, hideList=True))
 
        repo_type = v.OneOf(supported_backends)
 
        description = v.UnicodeString(strip=True, min=1, not_empty=False)
 
        private = v.StringBoolean(if_missing=False)
 
        enable_statistics = v.StringBoolean(if_missing=False)
 
        enable_downloads = v.StringBoolean(if_missing=False)
 
        enable_locking = v.StringBoolean(if_missing=False)
 
        landing_rev = v.OneOf(landing_revs, hideList=True)
 

	
 
        if edit:
 
            #this is repo owner
 
            user = All(v.UnicodeString(not_empty=True), v.ValidRepoUser())
 

	
 
        chained_validators = [v.ValidCloneUri(),
 
                              v.ValidRepoName(edit, old_data),
 
                              v.ValidPerms()]
 
    return _RepoForm
 

	
 

	
 
def RepoForkForm(edit=False, old_data={}, supported_backends=BACKENDS.keys(),
 
                 repo_groups=[], landing_revs=[]):
 
    class _RepoForkForm(formencode.Schema):
 
        allow_extra_fields = True
 
        filter_extra_fields = False
 
        repo_name = All(v.UnicodeString(strip=True, min=1, not_empty=True),
 
                        v.SlugifyName())
 
        repo_group = v.OneOf(repo_groups, hideList=True)
 
        repo_group = All(v.CanWriteGroup(),
 
                         v.OneOf(repo_groups, hideList=True))
 
        repo_type = All(v.ValidForkType(old_data), v.OneOf(supported_backends))
 
        description = v.UnicodeString(strip=True, min=1, not_empty=True)
 
        private = v.StringBoolean(if_missing=False)
 
        copy_permissions = v.StringBoolean(if_missing=False)
 
        update_after_clone = v.StringBoolean(if_missing=False)
 
        fork_parent_id = v.UnicodeString()
 
        chained_validators = [v.ValidForkName(edit, old_data)]
 
        landing_rev = v.OneOf(landing_revs, hideList=True)
 

	
 
    return _RepoForkForm
 

	
 

	
 
def RepoSettingsForm(edit=False, old_data={},
 
                     supported_backends=BACKENDS.keys(), repo_groups=[],
 
                     landing_revs=[]):
 
    class _RepoForm(formencode.Schema):
 
        allow_extra_fields = True
 
        filter_extra_fields = False
 
        repo_name = All(v.UnicodeString(strip=True, min=1, not_empty=True),
 
                        v.SlugifyName())
 
        description = v.UnicodeString(strip=True, min=1, not_empty=True)
 
        repo_group = v.OneOf(repo_groups, hideList=True)
 
        private = v.StringBoolean(if_missing=False)
 
        landing_rev = v.OneOf(landing_revs, hideList=True)
 
        chained_validators = [v.ValidRepoName(edit, old_data), v.ValidPerms(),
 
                              v.ValidSettings()]
 
    return _RepoForm
 

	
 

	
 
def ApplicationSettingsForm():
 
    class _ApplicationSettingsForm(formencode.Schema):
 
        allow_extra_fields = True
 
        filter_extra_fields = False
 
        rhodecode_title = v.UnicodeString(strip=True, min=1, not_empty=True)
 
        rhodecode_realm = v.UnicodeString(strip=True, min=1, not_empty=True)
 
        rhodecode_ga_code = v.UnicodeString(strip=True, min=1, not_empty=False)
 

	
 
    return _ApplicationSettingsForm
 

	
 

	
 
def ApplicationVisualisationForm():
 
    class _ApplicationVisualisationForm(formencode.Schema):
 
        allow_extra_fields = True
 
        filter_extra_fields = False
 
        rhodecode_show_public_icon = v.StringBoolean(if_missing=False)
 
        rhodecode_show_private_icon = v.StringBoolean(if_missing=False)
 
        rhodecode_stylify_metatags = v.StringBoolean(if_missing=False)
 

	
 
    return _ApplicationVisualisationForm
 

	
 

	
 
def ApplicationUiSettingsForm():
 
    class _ApplicationUiSettingsForm(formencode.Schema):
 
        allow_extra_fields = True
 
        filter_extra_fields = False
 
        web_push_ssl = v.StringBoolean(if_missing=False)
 
        paths_root_path = All(
 
            v.ValidPath(),
 
            v.UnicodeString(strip=True, min=1, not_empty=True)
 
        )
 
        hooks_changegroup_update = v.StringBoolean(if_missing=False)
 
        hooks_changegroup_repo_size = v.StringBoolean(if_missing=False)
 
        hooks_changegroup_push_logger = v.StringBoolean(if_missing=False)
 
        hooks_outgoing_pull_logger = v.StringBoolean(if_missing=False)
 

	
 
        extensions_largefiles = v.StringBoolean(if_missing=False)
 
        extensions_hgsubversion = v.StringBoolean(if_missing=False)
 
        extensions_hggit = v.StringBoolean(if_missing=False)
 

	
 
    return _ApplicationUiSettingsForm
 

	
 

	
 
def DefaultPermissionsForm(perms_choices, register_choices, create_choices,
 
                           fork_choices):
 
    class _DefaultPermissionsForm(formencode.Schema):
 
        allow_extra_fields = True
 
        filter_extra_fields = True
 
        overwrite_default = v.StringBoolean(if_missing=False)
 
        anonymous = v.StringBoolean(if_missing=False)
 
        default_perm = v.OneOf(perms_choices)
 
        default_register = v.OneOf(register_choices)
 
        default_create = v.OneOf(create_choices)
 
        default_fork = v.OneOf(fork_choices)
 

	
 
    return _DefaultPermissionsForm
 

	
 

	
 
def LdapSettingsForm(tls_reqcert_choices, search_scope_choices,
 
                     tls_kind_choices):
 
    class _LdapSettingsForm(formencode.Schema):
 
        allow_extra_fields = True
 
        filter_extra_fields = True
 
        #pre_validators = [LdapLibValidator]
 
        ldap_active = v.StringBoolean(if_missing=False)
 
        ldap_host = v.UnicodeString(strip=True,)
 
        ldap_port = v.Number(strip=True,)
rhodecode/model/validators.py
Show inline comments
 
"""
 
Set of generic validators
 
"""
 
import os
 
import re
 
import formencode
 
import logging
 
from collections import defaultdict
 
from pylons.i18n.translation import _
 
from webhelpers.pylonslib.secure_form import authentication_token
 

	
 
from formencode.validators import (
 
    UnicodeString, OneOf, Int, Number, Regex, Email, Bool, StringBoolean, Set,
 
    NotEmpty
 
)
 
from rhodecode.lib.compat import OrderedSet
 
from rhodecode.lib.utils import repo_name_slug
 
from rhodecode.model.db import RepoGroup, Repository, UsersGroup, User,\
 
    ChangesetStatus
 
from rhodecode.lib.exceptions import LdapImportError
 
from rhodecode.config.routing import ADMIN_PREFIX
 
from rhodecode.lib.auth import HasReposGroupPermissionAny
 

	
 
# silence warnings and pylint
 
UnicodeString, OneOf, Int, Number, Regex, Email, Bool, StringBoolean, Set, \
 
    NotEmpty
 

	
 
log = logging.getLogger(__name__)
 

	
 

	
 
class UniqueList(formencode.FancyValidator):
 
    """
 
    Unique List !
 
    """
 
    messages = dict(
 
        empty=_('Value cannot be an empty list'),
 
        missing_value=_('Value cannot be an empty list'),
 
    )
 

	
 
    def _to_python(self, value, state):
 
        if isinstance(value, list):
 
            return value
 
        elif isinstance(value, set):
 
            return list(value)
 
        elif isinstance(value, tuple):
 
            return list(value)
 
        elif value is None:
 
            return []
 
        else:
 
            return [value]
 

	
 
    def empty_value(self, value):
 
        return []
 

	
 

	
 
class StateObj(object):
 
    """
 
    this is needed to translate the messages using _() in validators
 
    """
 
    _ = staticmethod(_)
 

	
 

	
 
def M(self, key, state=None, **kwargs):
 
    """
 
    returns string from self.message based on given key,
 
    passed kw params are used to substitute %(named)s params inside
 
    translated strings
 

	
 
    :param msg:
 
    :param state:
 
    """
 
    if state is None:
 
        state = StateObj()
 
    else:
 
        state._ = staticmethod(_)
 
    #inject validator into state object
 
    return self.message(key, state, **kwargs)
 

	
 

	
 
def ValidUsername(edit=False, old_data={}):
 
    class _validator(formencode.validators.FancyValidator):
 
        messages = {
 
            'username_exists': _(u'Username "%(username)s" already exists'),
 
            'system_invalid_username':
 
                _(u'Username "%(username)s" is forbidden'),
 
            'invalid_username':
 
                _(u'Username may only contain alphanumeric characters '
 
                  'underscores, periods or dashes and must begin with '
 
                  'alphanumeric character')
 
        }
 

	
 
        def validate_python(self, value, state):
 
            if value in ['default', 'new_user']:
 
                msg = M(self, 'system_invalid_username', state, username=value)
 
                raise formencode.Invalid(msg, value, state)
 
            #check if user is unique
 
            old_un = None
 
            if edit:
 
                old_un = User.get(old_data.get('user_id')).username
 

	
 
            if old_un != value or not edit:
 
                if User.get_by_username(value, case_insensitive=True):
 
                    msg = M(self, 'username_exists', state, username=value)
 
                    raise formencode.Invalid(msg, value, state)
 

	
 
            if re.match(r'^[a-zA-Z0-9]{1}[a-zA-Z0-9\-\_\.]+$', value) is None:
 
                msg = M(self, 'invalid_username', state)
 
                raise formencode.Invalid(msg, value, state)
 
    return _validator
 

	
 

	
 
def ValidRepoUser():
 
    class _validator(formencode.validators.FancyValidator):
 
        messages = {
 
            'invalid_username': _(u'Username %(username)s is not valid')
 
        }
 

	
 
        def validate_python(self, value, state):
 
@@ -373,192 +374,211 @@ def ValidRepoName(edit=False, old_data={
 

	
 
                elif Repository.get_by_repo_name(repo_name_full):
 
                        msg = M(self, 'repository_exists', state,
 
                                repo=repo_name)
 
                        raise formencode.Invalid(msg, value, state,
 
                            error_dict=dict(repo_name=msg)
 
                        )
 
            return value
 
    return _validator
 

	
 

	
 
def ValidForkName(*args, **kwargs):
 
    return ValidRepoName(*args, **kwargs)
 

	
 

	
 
def SlugifyName():
 
    class _validator(formencode.validators.FancyValidator):
 

	
 
        def _to_python(self, value, state):
 
            return repo_name_slug(value)
 

	
 
        def validate_python(self, value, state):
 
            pass
 

	
 
    return _validator
 

	
 

	
 
def ValidCloneUri():
 
    from rhodecode.lib.utils import make_ui
 

	
 
    def url_handler(repo_type, url, ui=None):
 
        if repo_type == 'hg':
 
            from rhodecode.lib.vcs.backends.hg.repository import MercurialRepository
 
            from mercurial.httppeer import httppeer
 
            if url.startswith('http'):
 
                ## initially check if it's at least the proper URL
 
                ## or does it pass basic auth
 
                MercurialRepository._check_url(url)
 
                httppeer(ui, url)._capabilities()
 
            elif url.startswith('svn+http'):
 
                from hgsubversion.svnrepo import svnremoterepo
 
                svnremoterepo(ui, url).capabilities
 
            elif url.startswith('git+http'):
 
                raise NotImplementedError()
 

	
 
        elif repo_type == 'git':
 
            from rhodecode.lib.vcs.backends.git.repository import GitRepository
 
            if url.startswith('http'):
 
                ## initially check if it's at least the proper URL
 
                ## or does it pass basic auth
 
                GitRepository._check_url(url)
 
            elif url.startswith('svn+http'):
 
                raise NotImplementedError()
 
            elif url.startswith('hg+http'):
 
                raise NotImplementedError()
 

	
 
    class _validator(formencode.validators.FancyValidator):
 
        messages = {
 
            'clone_uri': _(u'invalid clone url'),
 
            'invalid_clone_uri': _(u'Invalid clone url, provide a '
 
                                    'valid clone http(s)/svn+http(s) url')
 
        }
 

	
 
        def validate_python(self, value, state):
 
            repo_type = value.get('repo_type')
 
            url = value.get('clone_uri')
 

	
 
            if not url:
 
                pass
 
            else:
 
                try:
 
                    url_handler(repo_type, url, make_ui('db', clear_session=False))
 
                except Exception:
 
                    log.exception('Url validation failed')
 
                    msg = M(self, 'clone_uri')
 
                    raise formencode.Invalid(msg, value, state,
 
                        error_dict=dict(clone_uri=msg)
 
                    )
 
    return _validator
 

	
 

	
 
def ValidForkType(old_data={}):
 
    class _validator(formencode.validators.FancyValidator):
 
        messages = {
 
            'invalid_fork_type': _(u'Fork have to be the same type as parent')
 
        }
 

	
 
        def validate_python(self, value, state):
 
            if old_data['repo_type'] != value:
 
                msg = M(self, 'invalid_fork_type', state)
 
                raise formencode.Invalid(msg, value, state,
 
                    error_dict=dict(repo_type=msg)
 
                )
 
    return _validator
 

	
 

	
 
def CanWriteGroup():
 
    class _validator(formencode.validators.FancyValidator):
 
        messages = {
 
            'permission_denied': _(u"You don't have permissions "
 
                                   "to create repository in this group")
 
        }
 

	
 
        def validate_python(self, value, state):
 
            gr = RepoGroup.get(value)
 
            if not HasReposGroupPermissionAny(
 
                'group.write', 'group.admin'
 
            )(gr.group_name, 'get group of repo form'):
 
                msg = M(self, 'permission_denied', state)
 
                raise formencode.Invalid(msg, value, state,
 
                    error_dict=dict(repo_type=msg)
 
                )
 
    return _validator
 

	
 

	
 
def ValidPerms(type_='repo'):
 
    if type_ == 'group':
 
        EMPTY_PERM = 'group.none'
 
    elif type_ == 'repo':
 
        EMPTY_PERM = 'repository.none'
 

	
 
    class _validator(formencode.validators.FancyValidator):
 
        messages = {
 
            'perm_new_member_name':
 
                _(u'This username or users group name is not valid')
 
        }
 

	
 
        def to_python(self, value, state):
 
            perms_update = OrderedSet()
 
            perms_new = OrderedSet()
 
            # build a list of permission to update and new permission to create
 

	
 
            #CLEAN OUT ORG VALUE FROM NEW MEMBERS, and group them using
 
            new_perms_group = defaultdict(dict)
 
            for k, v in value.copy().iteritems():
 
                if k.startswith('perm_new_member'):
 
                    del value[k]
 
                    _type, part = k.split('perm_new_member_')
 
                    args = part.split('_')
 
                    if len(args) == 1:
 
                        new_perms_group[args[0]]['perm'] = v
 
                    elif len(args) == 2:
 
                        _key, pos = args
 
                        new_perms_group[pos][_key] = v
 

	
 
            # fill new permissions in order of how they were added
 
            for k in sorted(map(int, new_perms_group.keys())):
 
                perm_dict = new_perms_group[str(k)]
 
                new_member = perm_dict.get('name')
 
                new_perm = perm_dict.get('perm')
 
                new_type = perm_dict.get('type')
 
                if new_member and new_perm and new_type:
 
                    perms_new.add((new_member, new_perm, new_type))
 

	
 
            for k, v in value.iteritems():
 
                if k.startswith('u_perm_') or k.startswith('g_perm_'):
 
                    member = k[7:]
 
                    t = {'u': 'user',
 
                         'g': 'users_group'
 
                    }[k[0]]
 
                    if member == 'default':
 
                        if value.get('private'):
 
                            # set none for default when updating to
 
                            # private repo
 
                            v = EMPTY_PERM
 
                    perms_update.add((member, v, t))
 

	
 
            value['perms_updates'] = list(perms_update)
 
            value['perms_new'] = list(perms_new)
 

	
 
            # update permissions
 
            for k, v, t in perms_new:
 
                try:
 
                    if t is 'user':
 
                        self.user_db = User.query()\
 
                            .filter(User.active == True)\
 
                            .filter(User.username == k).one()
 
                    if t is 'users_group':
 
                        self.user_db = UsersGroup.query()\
 
                            .filter(UsersGroup.users_group_active == True)\
 
                            .filter(UsersGroup.users_group_name == k).one()
 

	
 
                except Exception:
 
                    log.exception('Updated permission failed')
 
                    msg = M(self, 'perm_new_member_type', state)
 
                    raise formencode.Invalid(msg, value, state,
 
                        error_dict=dict(perm_new_member_name=msg)
 
                    )
 
            return value
 
    return _validator
 

	
 

	
 
def ValidSettings():
 
    class _validator(formencode.validators.FancyValidator):
 
        def _to_python(self, value, state):
 
            # settings  form can't edit user
 
            if 'user' in value:
 
                del value['user']
 
            return value
 

	
 
        def validate_python(self, value, state):
 
            pass
 
    return _validator
 

	
 

	
 
def ValidPath():
 
    class _validator(formencode.validators.FancyValidator):
 
        messages = {
 
            'invalid_path': _(u'This is not a valid path')
 
        }
 

	
rhodecode/public/css/style.css
Show inline comments
 
@@ -565,192 +565,210 @@ div:hover > a.permalink {
 
}
 
 
#header #header-inner #quick li ul li a.public_repo,#header #header-inner #quick li ul li a.public_repo:hover
 
	{
 
	background: url("../images/icons/lock_open.png") no-repeat scroll 4px
 
		9px #FFF;
 
	min-width: 167px;
 
	margin: 0;
 
	padding: 12px 9px 7px 24px;
 
}
 
 
#header #header-inner #quick li ul li a.hg,#header #header-inner #quick li ul li a.hg:hover
 
	{
 
	background: url("../images/icons/hgicon.png") no-repeat scroll 4px 9px
 
		#FFF;
 
	min-width: 167px;
 
	margin: 0 0 0 14px;
 
	padding: 12px 9px 7px 24px;
 
}
 
 
#header #header-inner #quick li ul li a.git,#header #header-inner #quick li ul li a.git:hover
 
	{
 
	background: url("../images/icons/giticon.png") no-repeat scroll 4px 9px
 
		#FFF;
 
	min-width: 167px;
 
	margin: 0 0 0 14px;
 
	padding: 12px 9px 7px 24px;
 
}
 
 
#header #header-inner #quick li ul li a.repos,#header #header-inner #quick li ul li a.repos:hover
 
	{
 
	background: url("../images/icons/database_edit.png") no-repeat scroll
 
		4px 9px #FFF;
 
	width: 167px;
 
	margin: 0;
 
	padding: 12px 9px 7px 24px;
 
}
 
 
#header #header-inner #quick li ul li a.repos_groups,#header #header-inner #quick li ul li a.repos_groups:hover
 
	{
 
	background: url("../images/icons/database_link.png") no-repeat scroll
 
		4px 9px #FFF;
 
	width: 167px;
 
	margin: 0;
 
	padding: 12px 9px 7px 24px;
 
}
 
 
#header #header-inner #quick li ul li a.users,#header #header-inner #quick li ul li a.users:hover
 
	{
 
	background: #FFF url("../images/icons/user_edit.png") no-repeat 4px 9px;
 
	width: 167px;
 
	margin: 0;
 
	padding: 12px 9px 7px 24px;
 
}
 
 
#header #header-inner #quick li ul li a.groups,#header #header-inner #quick li ul li a.groups:hover
 
	{
 
	background: #FFF url("../images/icons/group_edit.png") no-repeat 4px 9px;
 
	width: 167px;
 
	margin: 0;
 
	padding: 12px 9px 7px 24px;
 
}
 
 
#header #header-inner #quick li ul li a.settings,#header #header-inner #quick li ul li a.settings:hover
 
	{
 
	background: #FFF url("../images/icons/cog.png") no-repeat 4px 9px;
 
	width: 167px;
 
	margin: 0;
 
	padding: 12px 9px 7px 24px;
 
}
 
 
#header #header-inner #quick li ul li a.permissions,#header #header-inner #quick li ul li a.permissions:hover
 
	{
 
	background: #FFF url("../images/icons/key.png") no-repeat 4px 9px;
 
	width: 167px;
 
	margin: 0;
 
	padding: 12px 9px 7px 24px;
 
}
 
 
#header #header-inner #quick li ul li a.ldap,#header #header-inner #quick li ul li a.ldap:hover
 
	{
 
	background: #FFF url("../images/icons/server_key.png") no-repeat 4px 9px;
 
	width: 167px;
 
	margin: 0;
 
	padding: 12px 9px 7px 24px;
 
}
 
 
#header #header-inner #quick li ul li a.fork,#header #header-inner #quick li ul li a.fork:hover
 
	{
 
	background: #FFF url("../images/icons/arrow_divide.png") no-repeat 4px
 
		9px;
 
	width: 167px;
 
	margin: 0;
 
	padding: 12px 9px 7px 24px;
 
}
 
 
#header #header-inner #quick li ul li a.locking_add,#header #header-inner #quick li ul li a.locking_add:hover
 
    {
 
    background: #FFF url("../images/icons/lock_add.png") no-repeat 4px
 
        9px;
 
    width: 167px;
 
    margin: 0;
 
    padding: 12px 9px 7px 24px;
 
}
 
 
#header #header-inner #quick li ul li a.locking_del,#header #header-inner #quick li ul li a.locking_del:hover
 
    {
 
    background: #FFF url("../images/icons/lock_delete.png") no-repeat 4px
 
        9px;
 
    width: 167px;
 
    margin: 0;
 
    padding: 12px 9px 7px 24px;
 
}
 
 
#header #header-inner #quick li ul li a.pull_request,#header #header-inner #quick li ul li a.pull_request:hover
 
    {
 
    background: #FFF url("../images/icons/arrow_join.png") no-repeat 4px
 
        9px;
 
    width: 167px;
 
    margin: 0;
 
    padding: 12px 9px 7px 24px;
 
}
 
 
#header #header-inner #quick li ul li a.search,#header #header-inner #quick li ul li a.search:hover
 
	{
 
	background: #FFF url("../images/icons/search_16.png") no-repeat 4px 9px;
 
	width: 167px;
 
	margin: 0;
 
	padding: 12px 9px 7px 24px;
 
}
 
 
#header #header-inner #quick li ul li a.delete,#header #header-inner #quick li ul li a.delete:hover
 
	{
 
	background: #FFF url("../images/icons/delete.png") no-repeat 4px 9px;
 
	width: 167px;
 
	margin: 0;
 
	padding: 12px 9px 7px 24px;
 
}
 
 
#header #header-inner #quick li ul li a.branches,#header #header-inner #quick li ul li a.branches:hover
 
	{
 
	background: #FFF url("../images/icons/arrow_branch.png") no-repeat 4px
 
		9px;
 
	width: 167px;
 
	margin: 0;
 
	padding: 12px 9px 7px 24px;
 
}
 
 
#header #header-inner #quick li ul li a.tags,
 
#header #header-inner #quick li ul li a.tags:hover{
 
	background: #FFF url("../images/icons/tag_blue.png") no-repeat 4px 9px;
 
	width: 167px;
 
	margin: 0;
 
	padding: 12px 9px 7px 24px;
 
}
 
 
#header #header-inner #quick li ul li a.bookmarks,
 
#header #header-inner #quick li ul li a.bookmarks:hover{
 
    background: #FFF url("../images/icons/tag_green.png") no-repeat 4px 9px;
 
    width: 167px;
 
    margin: 0;
 
    padding: 12px 9px 7px 24px;
 
}
 
 
#header #header-inner #quick li ul li a.admin,
 
#header #header-inner #quick li ul li a.admin:hover{
 
	background: #FFF url("../images/icons/cog_edit.png") no-repeat 4px 9px;
 
	width: 167px;
 
	margin: 0;
 
	padding: 12px 9px 7px 24px;
 
}
 
 
.groups_breadcrumbs a {
 
	color: #fff;
 
}
 
 
.groups_breadcrumbs a:hover {
 
	color: #bfe3ff;
 
	text-decoration: none;
 
}
 
 
td.quick_repo_menu {
 
	background: #FFF url("../images/vertical-indicator.png") 8px 50% no-repeat !important;
 
	cursor: pointer;
 
	width: 8px;
 
	border: 1px solid transparent;
 
}
 
 
td.quick_repo_menu.active {
 
    background: url("../images/dt-arrow-dn.png") no-repeat scroll 5px 50% #FFFFFF !important;
 
    border: 1px solid #003367;
 
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
 
    cursor: pointer;
 
}
 
 
td.quick_repo_menu .menu_items {
 
	margin-top: 10px;
 
	margin-left:-6px;
 
	width: 150px;
 
	position: absolute;
 
	background-color: #FFF;
 
	background: none repeat scroll 0 0 #FFFFFF;
 
	border-color: #003367 #666666 #666666;
 
	border-right: 1px solid #666666;
 
	border-style: solid;
 
	border-width: 1px;
 
	box-shadow: 2px 8px 4px rgba(0, 0, 0, 0.2);
 
	border-top-style: none;
 
}
 
rhodecode/public/js/rhodecode.js
Show inline comments
 
/**
 
RhodeCode JS Files
 
**/
 

	
 
if (typeof console == "undefined" || typeof console.log == "undefined"){
 
	console = { log: function() {} }
 
}
 

	
 

	
 
var str_repeat = function(i, m) {
 
	for (var o = []; m > 0; o[--m] = i);
 
	return o.join('');
 
};
 

	
 
/**
 
 * INJECT .format function into String
 
 * Usage: "My name is {0} {1}".format("Johny","Bravo")
 
 * Return "My name is Johny Bravo"
 
 * Inspired by https://gist.github.com/1049426
 
 */
 
String.prototype.format = function() {
 
	  
 
	  function format() {
 
	    var str = this;
 
	    var len = arguments.length+1;
 
	    var safe = undefined;
 
	    var arg = undefined;
 
	    
 
	    // For each {0} {1} {n...} replace with the argument in that position.  If 
 
	    // the argument is an object or an array it will be stringified to JSON.
 
	    for (var i=0; i < len; arg = arguments[i++]) {
 
	      safe = typeof arg === 'object' ? JSON.stringify(arg) : arg;
 
	      str = str.replace(RegExp('\\{'+(i-1)+'\\}', 'g'), safe);
 
	    }
 
	    return str;
 
	  }
 

	
 
	  // Save a reference of what may already exist under the property native.  
 
	  // Allows for doing something like: if("".format.native) { /* use native */ }
 
	  format.native = String.prototype.format;
 

	
 
	  // Replace the prototype property
 
	  return format;
 

	
 
}();
 

	
 
String.prototype.strip = function(char) {
 
	if(char === undefined){
 
	    char = '\\s';
 
	}
 
	return this.replace(new RegExp('^'+char+'+|'+char+'+$','g'), '');
 
}
 
String.prototype.lstrip = function(char) {
 
	if(char === undefined){
 
	    char = '\\s';
 
	}
 
	return this.replace(new RegExp('^'+char+'+'),'');
 
}
 
String.prototype.rstrip = function(char) {
 
	if(char === undefined){
 
	    char = '\\s';
 
	}
 
	return this.replace(new RegExp(''+char+'+$'),'');
 
}
 

	
 

	
 
if(!Array.prototype.indexOf) {
 
    Array.prototype.indexOf = function(needle) {
 
        for(var i = 0; i < this.length; i++) {
 
            if(this[i] === needle) {
 
                return i;
 
            }
 
        }
 
        return -1;
 
    };
 
}
 

	
 
// IE(CRAP) doesn't support previousElementSibling
 
var prevElementSibling = function( el ) {
 
    if( el.previousElementSibling ) {
 
        return el.previousElementSibling;
 
    } else {
 
        while( el = el.previousSibling ) {
 
            if( el.nodeType === 1 ) return el;
 
        }
 
    }
 
}
 

	
 

	
 
var setSelectValue = function(select, val){
 
	var selection =  YUD.get(select);
 
	
 
    // select element
 
    for(var i=0;i<selection.options.length;i++){
 
    	console.log(selection.options[i].innerHTML);
 
        if (selection.options[i].innerHTML == val) {
 
            selection.selectedIndex = i;
 
            break;
 
        }
 
    }	
 
}
 

	
 

	
 
/**
 
 * SmartColorGenerator
 
 *
 
 *usage::
 
 *	var CG = new ColorGenerator();
 
 *  var col = CG.getColor(key); //returns array of RGB
 
 *  'rgb({0})'.format(col.join(',')
 
 * 
 
 * @returns {ColorGenerator}
 
 */
 
var ColorGenerator = function(){
 
	this.GOLDEN_RATIO = 0.618033988749895;
 
	this.CURRENT_RATIO = 0.22717784590367374 // this can be random
 
	this.HSV_1 = 0.75;//saturation
 
	this.HSV_2 = 0.95;
 
	this.color;
 
	this.cacheColorMap = {};
 
};
 

	
 
ColorGenerator.prototype = {
 
    getColor:function(key){
 
    	if(this.cacheColorMap[key] !== undefined){
 
    		return this.cacheColorMap[key];
 
    	}
 
    	else{
 
    		this.cacheColorMap[key] = this.generateColor();
 
    		return this.cacheColorMap[key];
 
    	}
 
    },
 
    _hsvToRgb:function(h,s,v){
 
        if (s == 0.0)
 
            return [v, v, v];
 
        i = parseInt(h * 6.0)
 
        f = (h * 6.0) - i
 
        p = v * (1.0 - s)
 
        q = v * (1.0 - s * f)
 
        t = v * (1.0 - s * (1.0 - f))
 
        i = i % 6
 
        if (i == 0) 
 
            return [v, t, p]
 
        if (i == 1) 
 
            return [q, v, p]
 
        if (i == 2) 
 
            return [p, v, t]
 
        if (i == 3)
 
            return [p, q, v]
 
        if (i == 4) 
 
            return [t, p, v]
 
        if (i == 5)
 
            return [v, p, q]            	
 
    },
 
    generateColor:function(){
 
        this.CURRENT_RATIO = this.CURRENT_RATIO+this.GOLDEN_RATIO;
 
        this.CURRENT_RATIO = this.CURRENT_RATIO %= 1;
 
        HSV_tuple = [this.CURRENT_RATIO, this.HSV_1, this.HSV_2]
 
        RGB_tuple = this._hsvToRgb(HSV_tuple[0],HSV_tuple[1],HSV_tuple[2]);
 
        function toRgb(v){
 
        	return ""+parseInt(v*256)
 
        }
 
        return [toRgb(RGB_tuple[0]),toRgb(RGB_tuple[1]),toRgb(RGB_tuple[2])];
 
        
 
    }
 
}
 

	
 

	
 

	
 

	
 

	
 
/**
 
 * GLOBAL YUI Shortcuts
 
 */
 
var YUC = YAHOO.util.Connect;
 
var YUD = YAHOO.util.Dom;
 
var YUE = YAHOO.util.Event;
 
var YUQ = YAHOO.util.Selector.query;
 

	
 
// defines if push state is enabled for this browser ?
 
var push_state_enabled = Boolean(
 
		window.history && window.history.pushState && window.history.replaceState
 
		&& !(   /* disable for versions of iOS before version 4.3 (8F190) */
 
				(/ Mobile\/([1-7][a-z]|(8([abcde]|f(1[0-8]))))/i).test(navigator.userAgent)
 
				/* disable for the mercury iOS browser, or at least older versions of the webkit engine */
 
				|| (/AppleWebKit\/5([0-2]|3[0-2])/i).test(navigator.userAgent)
 
		)
 
);
 

	
 
var _run_callbacks = function(callbacks){
 
	if (callbacks !== undefined){
 
		var _l = callbacks.length;
 
	    for (var i=0;i<_l;i++){
 
	    	var func = callbacks[i];
 
	    	if(typeof(func)=='function'){
 
	            try{
 
	          	    func();
rhodecode/templates/admin/repos_groups/repos_group_edit_perms.html
Show inline comments
 
<table id="permissions_manage" class="noborder">
 
    <tr>
 
        <td>${_('none')}</td>
 
        <td>${_('read')}</td>
 
        <td>${_('write')}</td>
 
        <td>${_('admin')}</td>
 
        <td>${_('member')}</td>
 
        <td></td>
 
    </tr>
 
    ## USERS
 
    %for r2p in c.repos_group.repo_group_to_perm:
 
        <tr id="id${id(r2p.user.username)}">
 
            <td>${h.radio('u_perm_%s' % r2p.user.username,'group.none')}</td>
 
            <td>${h.radio('u_perm_%s' % r2p.user.username,'group.read')}</td>
 
            <td>${h.radio('u_perm_%s' % r2p.user.username,'group.write')}</td>
 
            <td>${h.radio('u_perm_%s' % r2p.user.username,'group.admin')}</td>
 
            <td style="white-space: nowrap;">
 
                <img class="perm-gravatar" src="${h.gravatar_url(r2p.user.email,14)}"/>${r2p.user.username if r2p.user.username != 'default' else _('default')}
 
            </td>
 
            <td>
 
              %if r2p.user.username !='default':
 
                <span class="delete_icon action_button" onclick="ajaxActionUser(${r2p.user.user_id},'${'id%s'%id(r2p.user.username)}')">
 
                ${_('revoke')}
 
                </span>
 
              %endif
 
            </td>
 
        </tr>
 
    %endfor
 

	
 
    ## USERS GROUPS
 
    %for g2p in c.repos_group.users_group_to_perm:
 
        <tr id="id${id(g2p.users_group.users_group_name)}">
 
            <td>${h.radio('g_perm_%s' % g2p.users_group.users_group_name,'group.none')}</td>
 
            <td>${h.radio('g_perm_%s' % g2p.users_group.users_group_name,'group.read')}</td>
 
            <td>${h.radio('g_perm_%s' % g2p.users_group.users_group_name,'group.write')}</td>
 
            <td>${h.radio('g_perm_%s' % g2p.users_group.users_group_name,'group.admin')}</td>
 
            <td style="white-space: nowrap;">
 
                <img class="perm-gravatar" src="${h.url('/images/icons/group.png')}"/>${g2p.users_group.users_group_name}
 
            </td>
 
            <td>
 
                <span class="delete_icon action_button" onclick="ajaxActionUsersGroup(${g2p.users_group.users_group_id},'${'id%s'%id(g2p.users_group.users_group_name)}')">
 
                ${_('revoke')}
 
                </span>
 
            </td>
 
        </tr>
 
    %endfor
 
<%
 
    _tmpl = h.literal("""' \
 
        <td><input type="radio" value="group.none" name="perm_new_member_{0}" id="perm_new_member_{0}"></td> \
 
        <td><input type="radio" value="group.read" name="perm_new_member_{0}" id="perm_new_member_{0}"></td> \
 
        <td><input type="radio" value="group.write" name="perm_new_member_{0}" id="perm_new_member_{0}"></td> \
 
        <td><input type="radio" value="group.admin" name="perm_new_member_{0}" id="perm_new_member_{0}"></td> \
 
        <td class="ac"> \
 
            <div class="perm_ac" id="perm_ac_{0}"> \
 
                <input class="yui-ac-input" id="perm_new_member_name_{0}" name="perm_new_member_name_{0}" value="" type="text"> \
 
                <input id="perm_new_member_type_{0}" name="perm_new_member_type_{0}" value="" type="hidden">  \
 
                <div id="perm_container_{0}"></div> \
 
            </div> \
 
        </td> \
 
        <td></td>'""")
 
    %>
 
    ## ADD HERE DYNAMICALLY NEW INPUTS FROM THE '_tmpl'
 
    <tr class="new_members last_new_member" id="add_perm_input"></tr>
 
    <tr>
 
        <td colspan="6">
 
            <span id="add_perm" class="add_icon" style="cursor: pointer;">
 
            ${_('Add another member')}
 
            </span>
 
        </td>
 
    </tr>
 
    <tr>
 
        <td colspan="6">
 
           ${h.checkbox('recursive',value="True", label=_('apply to parents'))}
 
           ${h.checkbox('recursive',value="True", label=_('apply to children'))}
 
           <span class="help-block">${_('Set or revoke permission to all children of that group, including repositories and other groups')}</span>
 
        </td>
 
    </tr>
 
</table>
 
<script type="text/javascript">
 
function ajaxActionUser(user_id, field_id) {
 
    var sUrl = "${h.url('delete_repos_group_user_perm',group_name=c.repos_group.group_name)}";
 
    var callback = {
 
        success: function (o) {
 
            var tr = YUD.get(String(field_id));
 
            tr.parentNode.removeChild(tr);
 
        },
 
        failure: function (o) {
 
            alert("${_('Failed to remove user')}");
 
        },
 
    };
 
    var recursive = YUD.get('recursive').checked;
 
    var postData = '_method=delete&recursive={0}&user_id={1}'.format(recursive,user_id);
 
    var request = YAHOO.util.Connect.asyncRequest('POST', sUrl, callback, postData);
 
};
 

	
 
function ajaxActionUsersGroup(users_group_id,field_id){
 
    var sUrl = "${h.url('delete_repos_group_users_group_perm',group_name=c.repos_group.group_name)}";
 
    var callback = {
 
        success:function(o){
 
            var tr = YUD.get(String(field_id));
 
            tr.parentNode.removeChild(tr);
 
        },
 
        failure:function(o){
 
            alert("${_('Failed to remove users group')}");
 
        },
 
    };
 
    var recursive = YUD.get('recursive').checked;
 
    var postData = '_method=delete&recursive={0}&users_group_id={1}'.format(recursive,users_group_id);
 
    var request = YAHOO.util.Connect.asyncRequest('POST', sUrl, callback, postData);
 
};
 

	
 
YUE.onDOMReady(function () {
 
    if (!YUD.hasClass('perm_new_member_name', 'error')) {
 
        YUD.setStyle('add_perm_input', 'display', 'none');
 
    }
 
    YAHOO.util.Event.addListener('add_perm', 'click', function () {
 
    	addPermAction(${_tmpl}, ${c.users_array|n}, ${c.users_groups_array|n});
 
    });
 
});
 

	
 
</script>
rhodecode/templates/base/base.html
Show inline comments
 
@@ -108,219 +108,228 @@
 
                        </div>
 
                    </div>
 
                </div>
 
            </div>
 
            ${h.end_form()}
 
        %else:
 
            <div class="links_left">
 
                <div class="full_name">${c.rhodecode_user.full_name_or_username}</div>
 
                <div class="email">${c.rhodecode_user.email}</div>
 
                <div class="big_gravatar"><img alt="gravatar" src="${h.gravatar_url(c.rhodecode_user.email,48)}" /></div>
 
                <div class="inbox"><a href="${h.url('notifications')}">${_('Inbox')}: ${c.unread_notifications}</a></div>
 
            </div>
 
            <div class="links_right">
 
            <ol class="links">
 
              <li>${h.link_to(_(u'Home'),h.url('home'))}</li>
 
              <li>${h.link_to(_(u'Journal'),h.url('journal'))}</li>
 
              <li>${h.link_to(_(u'My account'),h.url('admin_settings_my_account'))}</li>
 
              <li class="logout">${h.link_to(_(u'Log Out'),h.url('logout_home'))}</li>
 
            </ol>
 
            </div>
 
        %endif
 
      </div>
 
 </div>
 
</%def>
 

	
 
<%def name="menu(current=None)">
 
		<%
 
		def is_current(selected):
 
			if selected == current:
 
				return h.literal('class="current"')
 
		%>
 
		%if current not in ['home','admin']:
 
		   ##REGULAR MENU
 
	        <ul id="quick">
 
				<!-- repo switcher -->
 
				<li>
 
					<a class="menu_link" id="repo_switcher" title="${_('Switch repository')}" href="#">
 
                    <span class="icon">
 
                        <img src="${h.url('/images/icons/database.png')}" alt="${_('Products')}" />
 
                    </span>
 
                    <span>&darr;</span>
 
					</a>
 
					<ul id="repo_switcher_list" class="repo_switcher">
 
                        <li>
 
                            <a href="#">${_('loading...')}</a>
 
                        </li>
 
					</ul>
 
				</li>
 

	
 
	            <li ${is_current('summary')}>
 
	               <a class="menu_link" title="${_('Summary')}" href="${h.url('summary_home',repo_name=c.repo_name)}">
 
	               <span class="icon">
 
	                   <img src="${h.url('/images/icons/clipboard_16.png')}" alt="${_('Summary')}" />
 
	               </span>
 
	               <span>${_('Summary')}</span>
 
	               </a>
 
	            </li>
 
                <li ${is_current('changelog')}>
 
                   <a class="menu_link" title="${_('Changelog')}" href="${h.url('changelog_home',repo_name=c.repo_name)}">
 
                   <span class="icon">
 
                       <img src="${h.url('/images/icons/time.png')}" alt="${_('Changelog')}" />
 
                   </span>
 
                   <span>${_('Changelog')}</span>
 
                   </a>
 
                </li>
 

	
 
                <li ${is_current('switch_to')}>
 
                   <a class="menu_link" id="branch_tag_switcher" title="${_('Switch to')}" href="#">
 
                   <span class="icon">
 
                       <img src="${h.url('/images/icons/arrow_switch.png')}" alt="${_('Switch to')}" />
 
                   </span>
 
                   <span>${_('Switch to')}</span>
 
                   </a>
 
                    <ul id="switch_to_list" class="switch_to">
 
                        <li><a href="#">${_('loading...')}</a></li>
 
                    </ul>
 
                </li>
 
                <li ${is_current('files')}>
 
                   <a class="menu_link" title="${_('Files')}" href="${h.url('files_home',repo_name=c.repo_name)}">
 
                   <span class="icon">
 
                       <img src="${h.url('/images/icons/file.png')}" alt="${_('Files')}" />
 
                   </span>
 
                   <span>${_('Files')}</span>
 
                   </a>
 
                </li>
 

	
 
                <li ${is_current('options')}>
 
                   <a class="menu_link" title="${_('Options')}" href="#">
 
                   <span class="icon">
 
                       <img src="${h.url('/images/icons/table_gear.png')}" alt="${_('Admin')}" />
 
                   </span>
 
                   <span>${_('Options')}</span>
 
                   </a>
 
                   <ul>
 
                   %if h.HasRepoPermissionAll('repository.admin')(c.repo_name):
 
                     %if h.HasPermissionAll('hg.admin')('access settings on repository'):
 
                         <li>${h.link_to(_('settings'),h.url('edit_repo',repo_name=c.repo_name),class_='settings')}</li>
 
                         <li>${h.link_to(_('repository settings'),h.url('edit_repo',repo_name=c.repo_name),class_='settings')}</li>
 
                     %else:
 
                         <li>${h.link_to(_('settings'),h.url('repo_settings_home',repo_name=c.repo_name),class_='settings')}</li>
 
                         <li>${h.link_to(_('repository settings'),h.url('repo_settings_home',repo_name=c.repo_name),class_='settings')}</li>
 
                     %endif
 
                   %endif
 

	
 
                   	<li>${h.link_to(_('fork'),h.url('repo_fork_home',repo_name=c.repo_name),class_='fork')}</li>
 
                    %if h.is_hg(c.rhodecode_repo):
 
                     <li>${h.link_to(_('Open new pull request'),h.url('pullrequest_home',repo_name=c.repo_name),class_='pull_request')}</li>
 
                    %endif
 
                   	<li>${h.link_to(_('search'),h.url('search_repo',search_repo=c.repo_name),class_='search')}</li>
 

	
 
                    %if h.HasRepoPermissionAny('repository.write','repository.admin')(c.repo_name) and c.rhodecode_db_repo.enable_locking:
 
                      %if c.rhodecode_db_repo.locked[0]:
 
                        <li>${h.link_to(_('unlock'), h.url('toggle_locking',repo_name=c.repo_name),class_='locking_del')}</li>
 
                      %else:
 
                        <li>${h.link_to(_('lock'), h.url('toggle_locking',repo_name=c.repo_name),class_='locking_add')}</li>
 
                      %endif
 
                    %endif
 

	
 
                    % if h.HasPermissionAll('hg.admin')('access admin main page'):
 
                     <li>
 
                       ${h.link_to(_('admin'),h.url('admin_home'),class_='admin')}
 
                        <%def name="admin_menu()">
 
                        <ul>
 
                            <li>${h.link_to(_('journal'),h.url('admin_home'),class_='journal')}</li>
 
                            <li>${h.link_to(_('repositories'),h.url('repos'),class_='repos')}</li>
 
                            <li>${h.link_to(_('repositories groups'),h.url('repos_groups'),class_='repos_groups')}</li>
 
                            <li>${h.link_to(_('users'),h.url('users'),class_='users')}</li>
 
                            <li>${h.link_to(_('users groups'),h.url('users_groups'),class_='groups')}</li>
 
                            <li>${h.link_to(_('permissions'),h.url('edit_permission',id='default'),class_='permissions')}</li>
 
                            <li>${h.link_to(_('ldap'),h.url('ldap_home'),class_='ldap')}</li>
 
                            <li class="last">${h.link_to(_('settings'),h.url('admin_settings'),class_='settings')}</li>
 
                        </ul>
 
                        </%def>
 

	
 
                        ## ADMIN MENU
 
                        ${admin_menu()}
 
                     </li>
 
                    % endif
 
                   </ul>
 
                </li>
 

	
 
                <li>
 
                    <a class="menu_link" title="${_('Followers')}" href="${h.url('repo_followers_home',repo_name=c.repo_name)}">
 
                    <span class="icon_short">
 
                        <img src="${h.url('/images/icons/heart.png')}" alt="${_('Followers')}" />
 
                    </span>
 
                    <span id="current_followers_count" class="short">${c.repository_followers}</span>
 
                    </a>
 
                </li>
 
                <li>
 
                    <a class="menu_link" title="${_('Forks')}" href="${h.url('repo_forks_home',repo_name=c.repo_name)}">
 
                    <span class="icon_short">
 
                        <img src="${h.url('/images/icons/arrow_divide.png')}" alt="${_('Forks')}" />
 
                    </span>
 
                    <span class="short">${c.repository_forks}</span>
 
                    </a>
 
                </li>
 
                <li>
 
                    <a class="menu_link" title="${_('Pull requests')}" href="${h.url('pullrequest_show_all',repo_name=c.repo_name)}">
 
                    <span class="icon_short">
 
                        <img src="${h.url('/images/icons/arrow_join.png')}" alt="${_('Pull requests')}" />
 
                    </span>
 
                    <span class="short">${c.repository_pull_requests}</span>
 
                    </a>
 
                </li>
 
                ${usermenu()}
 
	        </ul>
 
            <script type="text/javascript">
 
               YUE.on('repo_switcher','mouseover',function(){
 
                      function qfilter(){
 
                          var nodes = YUQ('ul#repo_switcher_list li a.repo_name');
 
                          var target = 'q_filter_rs';
 
                          var func = function(node){
 
                              return node.parentNode;
 
                          }
 
                          q_filter(target,nodes,func);
 
                      }
 
                   var loaded = YUD.hasClass('repo_switcher','loaded');
 
                   if(!loaded){
 
                       YUD.addClass('repo_switcher','loaded');
 
                       ypjax("${h.url('repo_switcher')}",'repo_switcher_list',
 
                           function(o){qfilter();},
 
                           function(o){YUD.removeClass('repo_switcher','loaded');}
 
                           ,null);
 
                   }
 
                   return false;
 
               });
 

	
 
              YUE.on('branch_tag_switcher','mouseover',function(){
 
                 var loaded = YUD.hasClass('branch_tag_switcher','loaded');
 
                 if(!loaded){
 
                     YUD.addClass('branch_tag_switcher','loaded');
 
                     ypjax("${h.url('branch_tag_switcher',repo_name=c.repo_name)}",'switch_to_list',
 
                         function(o){},
 
                         function(o){YUD.removeClass('branch_tag_switcher','loaded');}
 
                         ,null);
 
                 }
 
                 return false;
 
              });
 
            </script>
 
		%else:
 
		    ##ROOT MENU
 
            <ul id="quick">
 
                <li>
 
                    <a class="menu_link" title="${_('Home')}"  href="${h.url('home')}">
 
                    <span class="icon">
 
                        <img src="${h.url('/images/icons/home_16.png')}" alt="${_('Home')}" />
 
                    </span>
 
                    <span>${_('Home')}</span>
 
                    </a>
 
                </li>
 
                %if c.rhodecode_user.username != 'default':
 
                 <li>
 
                    <a class="menu_link" title="${_('Journal')}"  href="${h.url('journal')}">
 
                    <span class="icon">
 
                        <img src="${h.url('/images/icons/book.png')}" alt="${_('Journal')}" />
 
                    </span>
 
                    <span>${_('Journal')}</span>
 
                    </a>
 
                 </li>
 
                %else:
 
                 <li>
 
                    <a class="menu_link" title="${_('Public journal')}"  href="${h.url('public_journal')}">
 
                    <span class="icon">
 
                        <img src="${h.url('/images/icons/book.png')}" alt="${_('Public journal')}" />
 
                    </span>
 
                    <span>${_('Public journal')}</span>
 
                    </a>
 
                 </li>
 
                %endif
 
                <li>
rhodecode/templates/base/root.html
Show inline comments
 
## -*- coding: utf-8 -*-
 
<!DOCTYPE html>
 
<html xmlns="http://www.w3.org/1999/xhtml">
 
    <head>
 
        <title>${self.title()}</title>
 
        <meta http-equiv="Content-Type" content="text/html;charset=utf-8" />
 
        <meta name="robots" content="index, nofollow"/>
 
        <link rel="icon" href="${h.url('/images/icons/database_gear.png')}" type="image/png" />
 

	
 
        ## CSS ###
 
        <%def name="css()">
 
            <link rel="stylesheet" type="text/css" href="${h.url('/css/style.css')}" media="screen"/>
 
            <link rel="stylesheet" type="text/css" href="${h.url('/css/pygments.css')}"/>
 
            <link rel="stylesheet" type="text/css" href="${h.url('/css/style.css', ver=c.rhodecode_version)}" media="screen"/>
 
            <link rel="stylesheet" type="text/css" href="${h.url('/css/pygments.css', ver=c.rhodecode_version)}"/>
 
            ## EXTRA FOR CSS
 
            ${self.css_extra()}
 
        </%def>
 
        <%def name="css_extra()">
 
        </%def>
 

	
 
        ${self.css()}
 

	
 
        %if c.ga_code:
 
        <!-- Analytics -->
 
	     <script type="text/javascript">
 
	      var _gaq = _gaq || [];
 
	      _gaq.push(['_setAccount', '${c.ga_code}']);
 
	      _gaq.push(['_trackPageview']);
 

	
 
	      (function() {
 
	        var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
 
	        ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
 
	        var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
 
	      })();
 
	     </script>
 
	    %endif
 

	
 
        ## JAVASCRIPT ##
 
        <%def name="js()">
 
            <script type="text/javascript">
 
            //JS translations map
 
            var TRANSLATION_MAP = {
 
                'add another comment':'${_("add another comment")}',
 
                'Stop following this repository':"${_('Stop following this repository')}",
 
                'Start following this repository':"${_('Start following this repository')}",
 
                'Group':"${_('Group')}",
 
                'members':"${_('members')}",
 
                'search truncated': "${_('search truncated')}",
 
                'no matching files': "${_('no matching files')}"
 

	
 
            };
 
            var _TM = TRANSLATION_MAP;
 
            </script>
 
            <script type="text/javascript" src="${h.url('/js/yui.2.9.js')}"></script>
 
            <script type="text/javascript" src="${h.url('/js/yui.2.9.js', ver=c.rhodecode_version)}"></script>
 
            <!--[if lt IE 9]>
 
               <script language="javascript" type="text/javascript" src="${h.url('/js/excanvas.min.js')}"></script>
 
            <![endif]-->
 
            <script type="text/javascript" src="${h.url('/js/yui.flot.js')}"></script>
 
            <script type="text/javascript" src="${h.url('/js/native.history.js')}"></script>
 
            <script type="text/javascript" src="${h.url('/js/rhodecode.js')}"></script>
 
            <script type="text/javascript" src="${h.url('/js/yui.flot.js', ver=c.rhodecode_version)}"></script>
 
            <script type="text/javascript" src="${h.url('/js/native.history.js', ver=c.rhodecode_version)}"></script>
 
            <script type="text/javascript" src="${h.url('/js/rhodecode.js', ver=c.rhodecode_version)}"></script>
 
           ## EXTRA FOR JS
 
           ${self.js_extra()}
 

	
 
            <script type="text/javascript">
 
            (function(window,undefined){
 

	
 
                // Prepare
 
                var History = window.History; // Note: We are using a capital H instead of a lower h
 
                if ( !History.enabled ) {
 
                     // History.js is disabled for this browser.
 
                     // This is because we can optionally choose to support HTML4 browsers or not.
 
                    return false;
 
                }
 
            })(window);
 
            var follow_base_url  = "${h.url('toggle_following')}";
 

	
 
            var onSuccessFollow = function(target){
 
                var f = YUD.get(target.id);
 
                var f_cnt = YUD.get('current_followers_count');
 

	
 
                if(f.getAttribute('class')=='follow'){
 
                    f.setAttribute('class','following');
 
                    f.setAttribute('title',_TM['Stop following this repository']);
 

	
 
                    if(f_cnt){
 
                        var cnt = Number(f_cnt.innerHTML)+1;
 
                        f_cnt.innerHTML = cnt;
 
                    }
 
                }
 
                else{
 
                    f.setAttribute('class','follow');
 
                    f.setAttribute('title',_TM['Start following this repository']);
 
                    if(f_cnt){
 
                        var cnt = Number(f_cnt.innerHTML)-1;
 
                        f_cnt.innerHTML = cnt;
 
                    }
 
                }
 
            }
 

	
 
            var toggleFollowingUser = function(target,fallows_user_id,token,user_id){
 
                args = 'follows_user_id='+fallows_user_id;
 
                args+= '&amp;auth_token='+token;
 
                if(user_id != undefined){
 
                    args+="&amp;user_id="+user_id;
 
                }
 
                YUC.asyncRequest('POST',follow_base_url,{
 
                    success:function(o){
 
                    	onSuccessFollow(target);
 
                    }
 
                },args);
 
                return false;
 
            }
 

	
 
            var toggleFollowingRepo = function(target,fallows_repo_id,token,user_id){
 

	
 
                args = 'follows_repo_id='+fallows_repo_id;
 
                args+= '&amp;auth_token='+token;
 
                if(user_id != undefined){
 
                    args+="&amp;user_id="+user_id;
 
                }
 
                YUC.asyncRequest('POST',follow_base_url,{
 
                    success:function(o){
 
                    	onSuccessFollow(target);
 
                    }
 
                },args);
 
                return false;
 
            }
 
           YUE.onDOMReady(function(){
 
             tooltip_activate();
 
             show_more_event();
 

	
 
             YUE.on('quick_login_link','click',function(e){
 
                 // make sure we don't redirect
 
                 YUE.preventDefault(e);
 

	
 
                 if(YUD.hasClass('quick_login_link','enabled')){
 
                     YUD.setStyle('quick_login','display','none');
 
                     YUD.removeClass('quick_login_link','enabled');
 
                 }
 
                 else{
 
                     YUD.setStyle('quick_login','display','');
 
                     YUD.addClass('quick_login_link','enabled');
 
                     var usr = YUD.get('username');
 
                     if(usr){
 
                    	 usr.focus();
 
                     }
 
                 }
 
             });
 
           })
 
            </script>
 
        </%def>
 
        <%def name="js_extra()"></%def>
 
        ${self.js()}
 
        <%def name="head_extra()"></%def>
 
        ${self.head_extra()}
 
    </head>
rhodecode/templates/pullrequests/pullrequest.html
Show inline comments
 
<%inherit file="/base/base.html"/>
 

	
 
<%def name="title()">
 
    ${c.repo_name} ${_('New pull request')}
 
</%def>
 

	
 
<%def name="breadcrumbs_links()">
 
    ${h.link_to(_(u'Home'),h.url('/'))}
 
    &raquo;
 
    ${h.link_to(c.repo_name,h.url('changelog_home',repo_name=c.repo_name))}
 
    &raquo;
 
    ${_('New pull request')}
 
</%def>
 

	
 
<%def name="main()">
 

	
 
<div class="box">
 
    <!-- box / title -->
 
    <div class="title">
 
        ${self.breadcrumbs()}
 
    </div>
 
    ${h.form(url('pullrequest', repo_name=c.repo_name), method='post', id='pull_request_form')}
 
    <div style="float:left;padding:0px 30px 30px 30px">
 
       <div style="padding:0px 5px 5px 5px">
 
         <span>
 
           <a id="refresh" href="#">
 
             <img class="icon" title="${_('Refresh')}" alt="${_('Refresh')}" src="${h.url('/images/icons/arrow_refresh.png')}"/>
 
             ${_('refresh overview')}
 
           </a>
 
         </span>
 
       </div>
 
        ##ORG
 
        <div style="float:left">
 
            <div class="fork_user">
 
                <div class="gravatar">
 
                    <img alt="gravatar" src="${h.gravatar_url(c.rhodecode_db_repo.user.email,24)}"/>
 
                </div>
 
                <span style="font-size: 20px">
 
                ${h.select('org_repo','',c.org_repos,class_='refs')}:${h.select('org_ref','',c.org_refs,class_='refs')}
 
                </span>
 
                 <div style="padding:5px 3px 3px 42px;">${c.rhodecode_db_repo.description}</div>
 
            </div>
 
            <div style="clear:both;padding-top: 10px"></div>
 
        </div>
 
          <div style="float:left;font-size:24px;padding:0px 20px">
 
          <img height=32 width=32 src="${h.url('/images/arrow_right_64.png')}"/>
 
          </div>
 

	
 
        ##OTHER, most Probably the PARENT OF THIS FORK
 
        <div style="float:left">
 
            <div class="fork_user">
 
                <div class="gravatar">
 
                    <img id="other_repo_gravatar" alt="gravatar" src=""/>
 
                </div>
 
                <span style="font-size: 20px">
 
                ${h.select('other_repo',c.default_pull_request ,c.other_repos,class_='refs')}:${h.select('other_ref','',c.default_revs,class_='refs')}
 
                ${h.select('other_repo',c.default_pull_request ,c.other_repos,class_='refs')}:${h.select('other_ref',c.default_pull_request_rev,c.default_revs,class_='refs')}
 
                </span>
 
                 <div id="other_repo_desc" style="padding:5px 3px 3px 42px;"></div>
 
            </div>
 
            <div style="clear:both;padding-top: 10px"></div>
 
        </div>
 
       <div style="clear:both;padding-top: 10px"></div>
 
       ## overview pulled by ajax
 
       <div style="float:left" id="pull_request_overview"></div>
 
       <div style="float:left;clear:both;padding:10px 10px 10px 0px;display:none">
 
            <a id="pull_request_overview_url" href="#">${_('Detailed compare view')}</a>
 
       </div>
 
     </div>
 
    <div style="float:left; border-left:1px dashed #eee">
 
        <h4>${_('Pull request reviewers')}</h4>
 
        <div id="reviewers" style="padding:0px 0px 0px 15px">
 
          ## members goes here !
 
          <div class="group_members_wrap">
 
            <ul id="review_members" class="group_members">
 
            %for member in c.review_members:
 
              <li id="reviewer_${member.user_id}">
 
                <div class="reviewers_member">
 
                  <div class="gravatar"><img alt="gravatar" src="${h.gravatar_url(member.email,14)}"/> </div>
 
                  <div style="float:left">${member.full_name} (${_('owner')})</div>
 
                  <input type="hidden" value="${member.user_id}" name="review_members" />
 
                  <span class="delete_icon action_button" onclick="removeReviewer(${member.user_id})"></span>
 
                </div>
 
              </li>
 
            %endfor
 
            </ul>
 
          </div>
 

	
 
          <div class='ac'>
 
            <div class="reviewer_ac">
 
               ${h.text('user', class_='yui-ac-input')}
 
               <span class="help-block">${_('Add reviewer to this pull request.')}</span>
 
               <div id="reviewers_container"></div>
 
            </div>
 
          </div>
 
        </div>
 
    </div>
 
    <h3>${_('Create new pull request')}</h3>
 

	
 
    <div class="form">
 
        <!-- fields -->
 

	
 
        <div class="fields">
 

	
 
             <div class="field">
 
                <div class="label">
 
                    <label for="pullrequest_title">${_('Title')}:</label>
 
                </div>
 
                <div class="input">
 
                    ${h.text('pullrequest_title',size=30)}
 
                </div>
 
             </div>
 

	
 
            <div class="field">
 
                <div class="label label-textarea">
 
                    <label for="pullrequest_desc">${_('description')}:</label>
 
                </div>
 
                <div class="textarea text-area editor">
 
                    ${h.textarea('pullrequest_desc',size=30)}
 
                </div>
 
            </div>
 

	
 
            <div class="buttons">
 
                ${h.submit('save',_('Send pull request'),class_="ui-btn large")}
 
                ${h.reset('reset',_('Reset'),class_="ui-btn large")}
 
           </div>
 
        </div>
 
    </div>
 
    ${h.end_form()}
 

	
 
</div>
 

	
 
<script type="text/javascript">
 
  var _USERS_AC_DATA = ${c.users_array|n};
 
  var _GROUPS_AC_DATA = ${c.users_groups_array|n};
 
  PullRequestAutoComplete('user', 'reviewers_container', _USERS_AC_DATA, _GROUPS_AC_DATA);
 

	
 
  var other_repos_info = ${c.other_repos_info|n};
 
  
 
  var loadPreview = function(){
 
	  YUD.setStyle(YUD.get('pull_request_overview_url').parentElement,'display','none');
 
      var url = "${h.url('compare_url',
 
    	                 repo_name='org_repo',
 
    	                 org_ref_type='org_ref_type', org_ref='org_ref',
 
                         other_ref_type='other_ref_type', other_ref='other_ref',
 
                         repo='other_repo',
 
                         as_form=True)}";
 

	
 
      var select_refs = YUQ('#pull_request_form select.refs')
 

	
 
      var rev_data = {}; // gather the org/other ref and repo here
 
      for(var i=0;i<select_refs.length;i++){
 
        var select_ref = select_refs[i];
 
        var select_ref_data = select_ref.value.split(':');
 
        var key = null;
 
        var val = null;
 
        
 
        if(select_ref_data.length>1){
 
          key = select_ref.name+"_type";
 
          val = select_ref_data[0];
 
          url = url.replace(key,val);
 

	
 
          rev_data[key] = val;
 
          
 
          key = select_ref.name;
 
          val = select_ref_data[1];
 
          url = url.replace(key,val);
 

	
 
          rev_data[key] = val;
 
          
 
        }else{
 
          key = select_ref.name;
 
          val = select_ref.value;
 
          url = url.replace(key,val);
 
          rev_data[key] = val;
 
        }
 
      }
 

	
 
      YUE.on('other_repo', 'change', function(e){
 
    	  var repo_name = e.currentTarget.value;
 
    	  // replace the <select> of changed repo
 
    	  YUD.get('other_ref').innerHTML = other_repos_info[repo_name]['revs'];
 
      });
 
      
 
      ypjax(url,'pull_request_overview', function(data){
 
    	  var sel_box = YUQ('#pull_request_form #other_repo')[0];
 
    	  var repo_name = sel_box.options[sel_box.selectedIndex].value;
 
    	  YUD.get('pull_request_overview_url').href = url;
 
    	  YUD.setStyle(YUD.get('pull_request_overview_url').parentElement,'display','');
 
    	  YUD.get('other_repo_gravatar').src = other_repos_info[repo_name]['gravatar'];
 
    	  YUD.get('other_repo_desc').innerHTML = other_repos_info[repo_name]['description'];
 
    	  YUD.get('other_ref').innerHTML = other_repos_info[repo_name]['revs'];
 
    	  // select back the revision that was just compared
 
    	  setSelectValue(YUD.get('other_ref'), rev_data['other_ref']);
 
      })
 
  }
 
  YUE.on('refresh','click',function(e){
 
     loadPreview()
 
  })
 

	
 
  //lazy load overview after 0.5s
 
  setTimeout(loadPreview, 500)
 

	
 
</script>
 

	
 
</%def>
rhodecode/tests/test_libs.py
Show inline comments
 
@@ -66,112 +66,133 @@ TEST_URLS += [
 

	
 
class TestLibs(unittest.TestCase):
 

	
 
    def test_uri_filter(self):
 
        from rhodecode.lib.utils2 import uri_filter
 

	
 
        for url in TEST_URLS:
 
            self.assertEqual(uri_filter(url[0]), url[1])
 

	
 
    def test_credentials_filter(self):
 
        from rhodecode.lib.utils2 import credentials_filter
 

	
 
        for url in TEST_URLS:
 
            self.assertEqual(credentials_filter(url[0]), url[2])
 

	
 
    def test_str2bool(self):
 
        from rhodecode.lib.utils2 import str2bool
 
        test_cases = [
 
            ('t', True),
 
            ('true', True),
 
            ('y', True),
 
            ('yes', True),
 
            ('on', True),
 
            ('1', True),
 
            ('Y', True),
 
            ('yeS', True),
 
            ('Y', True),
 
            ('TRUE', True),
 
            ('T', True),
 
            ('False', False),
 
            ('F', False),
 
            ('FALSE', False),
 
            ('0', False),
 
            ('-1', False),
 
            ('', False), ]
 

	
 
        for case in test_cases:
 
            self.assertEqual(str2bool(case[0]), case[1])
 

	
 
    def test_mention_extractor(self):
 
        from rhodecode.lib.utils2 import extract_mentioned_users
 
        sample = (
 
            "@first hi there @marcink here's my email marcin@email.com "
 
            "@lukaszb check @one_more22 it pls @ ttwelve @D[] @one@two@three "
 
            "@MARCIN    @maRCiN @2one_more22 @john please see this http://org.pl "
 
            "@marian.user just do it @marco-polo and next extract @marco_polo "
 
            "user.dot  hej ! not-needed maril@domain.org"
 
        )
 

	
 
        s = sorted([
 
        'first', 'marcink', 'lukaszb', 'one_more22', 'MARCIN', 'maRCiN', 'john',
 
        'marian.user', 'marco-polo', 'marco_polo'
 
        ], key=lambda k: k.lower())
 
        self.assertEqual(s, extract_mentioned_users(sample))
 

	
 
    def test_age(self):
 
        import calendar
 
        from rhodecode.lib.utils2 import age
 
        n = datetime.datetime.now()
 
        delt = lambda *args, **kwargs: datetime.timedelta(*args, **kwargs)
 
        self.assertEqual(age(n), u'just now')
 
        self.assertEqual(age(n - delt(seconds=1)), u'1 second ago')
 
        self.assertEqual(age(n - delt(seconds=60 * 2)), u'2 minutes ago')
 
        self.assertEqual(age(n - delt(hours=1)), u'1 hour ago')
 
        self.assertEqual(age(n - delt(hours=24)), u'1 day ago')
 
        self.assertEqual(age(n - delt(hours=24 * 5)), u'5 days ago')
 
        self.assertEqual(age(n - delt(hours=24 * (calendar.mdays[n.month-1] + 2))),
 
                         u'1 month and 2 days ago')
 
        self.assertEqual(age(n - delt(hours=24 * 400)), u'1 year and 1 month ago')
 

	
 
    def test_tag_exctrator(self):
 
        sample = (
 
            "hello pta[tag] gog [[]] [[] sda ero[or]d [me =>>< sa]"
 
            "[requires] [stale] [see<>=>] [see => http://url.com]"
 
            "[requires => url] [lang => python] [just a tag]"
 
            "[,d] [ => ULR ] [obsolete] [desc]]"
 
        )
 
        from rhodecode.lib.helpers import desc_stylize
 
        res = desc_stylize(sample)
 
        self.assertTrue('<div class="metatag" tag="tag">tag</div>' in res)
 
        self.assertTrue('<div class="metatag" tag="obsolete">obsolete</div>' in res)
 
        self.assertTrue('<div class="metatag" tag="stale">stale</div>' in res)
 
        self.assertTrue('<div class="metatag" tag="lang">python</div>' in res)
 
        self.assertTrue('<div class="metatag" tag="requires">requires =&gt; <a href="/url">url</a></div>' in res)
 
        self.assertTrue('<div class="metatag" tag="tag">tag</div>' in res)
 

	
 
    def test_alternative_gravatar(self):
 
        from rhodecode.lib.helpers import gravatar_url
 
        _md5 = lambda s: hashlib.md5(s).hexdigest()
 

	
 
        def fake_conf(**kwargs):
 
            from pylons import config
 
            config['app_conf'] = {}
 
            config['app_conf']['use_gravatar'] = True
 
            config['app_conf'].update(kwargs)
 
            return config
 
        fake = fake_conf(alternative_gravatar_url='http://test.com/{email}')
 
        with mock.patch('pylons.config', fake):
 
            grav = gravatar_url(email_address='test@foo.com', size=24)
 
            assert grav == 'http://test.com/test@foo.com'
 

	
 
        class fake_url():
 
            @classmethod
 
            def current(cls, *args, **kwargs):
 
                return 'https://server.com'
 

	
 
        with mock.patch('pylons.url', fake_url):
 
            fake = fake_conf(alternative_gravatar_url='http://test.com/{email}')
 
            with mock.patch('pylons.config', fake):
 
                    from pylons import url
 
                    assert url.current() == 'https://server.com'
 
                    grav = gravatar_url(email_address='test@foo.com', size=24)
 
                    assert grav == 'http://test.com/test@foo.com'
 

	
 
            fake = fake_conf(alternative_gravatar_url='http://test.com/{email}')
 
            with mock.patch('pylons.config', fake):
 
                grav = gravatar_url(email_address='test@foo.com', size=24)
 
                assert grav == 'http://test.com/test@foo.com'
 

	
 
        fake = fake_conf(alternative_gravatar_url='http://test.com/{md5email}')
 
        with mock.patch('pylons.config', fake):
 
            em = 'test@foo.com'
 
            grav = gravatar_url(email_address=em, size=24)
 
            assert grav == 'http://test.com/%s' % (_md5(em))
 
            fake = fake_conf(alternative_gravatar_url='http://test.com/{md5email}')
 
            with mock.patch('pylons.config', fake):
 
                em = 'test@foo.com'
 
                grav = gravatar_url(email_address=em, size=24)
 
                assert grav == 'http://test.com/%s' % (_md5(em))
 

	
 
        fake = fake_conf(alternative_gravatar_url='http://test.com/{md5email}/{size}')
 
        with mock.patch('pylons.config', fake):
 
            em = 'test@foo.com'
 
            grav = gravatar_url(email_address=em, size=24)
 
            assert grav == 'http://test.com/%s/%s' % (_md5(em), 24)
 
            fake = fake_conf(alternative_gravatar_url='http://test.com/{md5email}/{size}')
 
            with mock.patch('pylons.config', fake):
 
                em = 'test@foo.com'
 
                grav = gravatar_url(email_address=em, size=24)
 
                assert grav == 'http://test.com/%s/%s' % (_md5(em), 24)
 

	
 
            fake = fake_conf(alternative_gravatar_url='{scheme}://{netloc}/{md5email}/{size}')
 
            with mock.patch('pylons.config', fake):
 
                em = 'test@foo.com'
 
                grav = gravatar_url(email_address=em, size=24)
 
                assert grav == 'https://server.com/%s/%s' % (_md5(em), 24)
 

	
0 comments (0 inline, 0 general)