Changeset - dabdc356393b
[Not reviewed]
default
0 56 0
Thomas De Schampheleire - 11 years ago 2015-03-12 21:09:10
thomas.de.schampheleire@gmail.com
lib: trivial typo fixes
56 files changed with 106 insertions and 106 deletions:
0 comments (0 inline, 0 general)
kallithea/lib/annotate.py
Show inline comments
 
@@ -12,13 +12,13 @@
 
# You should have received a copy of the GNU General Public License
 
# along with this program.  If not, see <http://www.gnu.org/licenses/>.
 
"""
 
kallithea.lib.annotate
 
~~~~~~~~~~~~~~~~~~~~~~
 

	
 
Anontation library for usage in kallithea, previously part of vcs
 
Annotation library for usage in Kallithea, previously part of vcs
 

	
 
This file was forked by the Kallithea project in July 2014.
 
Original author and date, and relevant copyright and licensing information is below:
 
:created_on: Dec 4, 2011
 
:author: marcink
 
:copyright: (c) 2013 RhodeCode GmbH, and others.
kallithea/lib/auth.py
Show inline comments
 
@@ -233,13 +233,13 @@ def _cached_perms_data(user_id, user_is_
 

	
 
    #==================================================================
 
    # SET DEFAULTS GLOBAL, REPOS, REPOSITORY GROUPS
 
    #==================================================================
 
    uid = user_id
 

	
 
    # default global permissions taken fron the default user
 
    # default global permissions taken from the default user
 
    default_global_perms = UserToPerm.query()\
 
        .filter(UserToPerm.user_id == default_user_id)\
 
        .options(joinedload(UserToPerm.permission))
 

	
 
    for perm in default_global_perms:
 
        permissions[GLOBAL].add(perm.permission.permission_name)
 
@@ -551,13 +551,13 @@ class AuthUser(object):
 
        Fills user permission attribute with permissions taken from database
 
        works for permissions given for repositories, and for permissions that
 
        are granted to groups
 

	
 
        :param user: instance of User object from database
 
        :param explicit: In case there are permissions both for user and a group
 
            that user is part of, explicit flag will defiine if user will
 
            that user is part of, explicit flag will define if user will
 
            explicitly override permissions from group, if it's False it will
 
            make decision based on the algo
 
        :param algo: algorithm to decide what permission should be choose if
 
            it's multiple defined, eg user in two different groups. It also
 
            decides if explicit flag is turned off how to specify the permission
 
            for case when user is in a group + have defined separate permission
kallithea/lib/auth_modules/__init__.py
Show inline comments
 
@@ -64,13 +64,13 @@ class KallitheaAuthPluginBase(object):
 
    @property
 
    def validators(self):
 
        """
 
        Exposes Kallithea validators modules
 
        """
 
        # this is a hack to overcome issues with pylons threadlocals and
 
        # translator object _() not beein registered properly.
 
        # translator object _() not being registered properly.
 
        class LazyCaller(object):
 
            def __init__(self, name):
 
                self.validator_name = name
 

	
 
            def __call__(self, *args, **kwargs):
 
                from kallithea.model import validators as v
 
@@ -127,13 +127,13 @@ class KallitheaAuthPluginBase(object):
 
            return False
 
        return True
 

	
 
    def get_user(self, username=None, **kwargs):
 
        """
 
        Helper method for user fetching in plugins, by default it's using
 
        simple fetch by username, but this method can be custimized in plugins
 
        simple fetch by username, but this method can be customized in plugins
 
        eg. container auth plugin to fetch user by environ params
 

	
 
        :param username: username if given to fetch from database
 
        :param kwargs: extra arguments needed for user fetching.
 
        """
 
        user = None
 
@@ -260,13 +260,13 @@ class KallitheaExternalAuthPlugin(Kallit
 
        auth = super(KallitheaExternalAuthPlugin, self)._authenticate(
 
            userobj, username, passwd, settings, **kwargs)
 
        if auth:
 
            # maybe plugin will clean the username ?
 
            # we should use the return value
 
            username = auth['username']
 
            # if user is not active from our extern type we should fail to authe
 
            # if user is not active from our extern type we should fail to auth
 
            # this can prevent from creating users in Kallithea when using
 
            # external authentication, but if it's inactive user we shouldn't
 
            # create that user anyway
 
            if auth['active_from_extern'] is False:
 
                log.warning("User %s authenticated against %s, but is inactive"
 
                            % (username, self.__module__))
 
@@ -321,13 +321,13 @@ def importplugin(plugin):
 
    PLUGIN_CLASS_NAME = "KallitheaAuthPlugin"
 
    try:
 
        module = importlib.import_module(plugin)
 
    except (ImportError, TypeError):
 
        log.error(traceback.format_exc())
 
        # TODO: make this more error prone, if by some accident we screw up
 
        # the plugin name, the crash is preatty bad and hard to recover
 
        # the plugin name, the crash is pretty bad and hard to recover
 
        raise
 

	
 
    log.debug("Loaded auth plugin from %s (module:%s, file:%s)"
 
              % (plugin, module.__name__, module.__file__))
 

	
 
    pluginclass = getattr(module, PLUGIN_CLASS_NAME)
 
@@ -343,13 +343,13 @@ def loadplugin(plugin):
 

	
 
        see: importplugin
 
    """
 
    plugin = importplugin(plugin)()
 
    if plugin.plugin_settings.im_func != KallitheaAuthPluginBase.plugin_settings.im_func:
 
        raise TypeError("Authentication class %s.KallitheaAuthPluginBase "
 
                        "has overriden the plugin_settings method, which is "
 
                        "has overridden the plugin_settings method, which is "
 
                        "forbidden." % plugin)
 
    return plugin
 

	
 

	
 
def authenticate(username, password, environ=None):
 
    """
 
@@ -396,13 +396,13 @@ def authenticate(username, password, env
 
        else:
 
            log.debug('Plugin %s accepted user `%s` for authentication'
 
                      % (module, user))
 

	
 
        log.info('Authenticating user using %s plugin' % plugin.__module__)
 
        # _authenticate is a wrapper for .auth() method of plugin.
 
        # it checks if .auth() sends proper data. for KallitheaExternalAuthPlugin
 
        # it checks if .auth() sends proper data. For KallitheaExternalAuthPlugin
 
        # it also maps users to Database and maps the attributes returned
 
        # from .auth() to Kallithea database. If this function returns data
 
        # then auth is correct.
 
        plugin_user = plugin._authenticate(user, username, password,
 
                                           plugin_settings,
 
                                           environ=environ or {})
kallithea/lib/auth_modules/auth_container.py
Show inline comments
 
@@ -115,26 +115,26 @@ class KallitheaAuthPlugin(auth_modules.K
 
            log.debug('New cleanup user is: %s' % username)
 
        return username
 

	
 
    def get_user(self, username=None, **kwargs):
 
        """
 
        Helper method for user fetching in plugins, by default it's using
 
        simple fetch by username, but this method can be custimized in plugins
 
        simple fetch by username, but this method can be customized in plugins
 
        eg. container auth plugin to fetch user by environ params
 
        :param username: username if given to fetch
 
        :param kwargs: extra arguments needed for user fetching.
 
        """
 
        environ = kwargs.get('environ') or {}
 
        settings = kwargs.get('settings') or {}
 
        username = self._get_username(environ, settings)
 
        # we got the username, so use default method now
 
        return super(KallitheaAuthPlugin, self).get_user(username)
 

	
 
    def auth(self, userobj, username, password, settings, **kwargs):
 
        """
 
        Get's the container_auth username (or email). It tries to get username
 
        Gets the container_auth username (or email). It tries to get username
 
        from REMOTE_USER if this plugin is enabled, if that fails
 
        it tries to get username from HTTP_X_FORWARDED_USER if fallback header
 
        is set. clean_username extracts the username from this data if it's
 
        having @ in it.
 
        Return None on failure. On success, return a dictionary of the form:
 

	
 
@@ -158,14 +158,14 @@ class KallitheaAuthPlugin(auth_modules.K
 
        # only way to log in is using environ
 
        username = None
 
        if userobj:
 
            username = getattr(userobj, 'username')
 

	
 
        if not username:
 
            # we don't have any objects in DB user doesn't exist extrac username
 
            # from environ based on the settings
 
            # we don't have any objects in DB, user doesn't exist, extract
 
            # username from environ based on the settings
 
            username = self._get_username(environ, settings)
 

	
 
        # if cannot fetch username, it's a no-go for this plugin to proceed
 
        if not username:
 
            return None
 

	
kallithea/lib/auth_modules/auth_internal.py
Show inline comments
 
@@ -51,13 +51,13 @@ class KallitheaAuthPlugin(auth_modules.K
 
        def_user_perms = User.get_default_user().AuthUser.permissions['global']
 
        return 'hg.register.auto_activate' in def_user_perms
 

	
 
    def accepts(self, user, accepts_empty=True):
 
        """
 
        Custom accepts for this auth that doesn't accept empty users. We
 
        know that user exisits in database.
 
        know that user exists in database.
 
        """
 
        return super(KallitheaAuthPlugin, self).accepts(user,
 
                                                        accepts_empty=False)
 

	
 
    def auth(self, userobj, username, password, settings, **kwargs):
 
        if not userobj:
kallithea/lib/base.py
Show inline comments
 
@@ -151,13 +151,13 @@ class BaseVCSController(object):
 
    def _handle_request(self, environ, start_response):
 
        raise NotImplementedError()
 

	
 
    def _get_by_id(self, repo_name):
 
        """
 
        Gets a special pattern _<ID> from clone url and tries to replace it
 
        with a repository_name for support of _<ID> non changable urls
 
        with a repository_name for support of _<ID> non changeable urls
 

	
 
        :param repo_name:
 
        """
 

	
 
        data = repo_name.split('/')
 
        if len(data) >= 2:
 
@@ -167,13 +167,13 @@ class BaseVCSController(object):
 
                data[1] = by_id_match
 

	
 
        return '/'.join(data)
 

	
 
    def _invalidate_cache(self, repo_name):
 
        """
 
        Set's cache for this repository for invalidation on next access
 
        Sets cache for this repository for invalidation on next access
 

	
 
        :param repo_name: full repo name, also a cache key
 
        """
 
        ScmModel().mark_for_invalidation(repo_name)
 

	
 
    def _check_permission(self, action, user, repo_name, ip_addr=None):
kallithea/lib/caching_query.py
Show inline comments
 
@@ -121,13 +121,13 @@ def get_cache_region(name, region):
 
    kw = beaker.cache.cache_regions[region]
 
    return beaker.cache.Cache._get_cache(name, kw)
 

	
 

	
 
def _get_cache_parameters(query):
 
    """For a query with cache_region and cache_namespace configured,
 
    return the correspoinding Cache instance and cache key, based
 
    return the corresponding Cache instance and cache key, based
 
    on this query's current criterion and parameter values.
 

	
 
    """
 
    if not hasattr(query, '_cache_parameters'):
 
        raise ValueError("This Query does not have caching "
 
                         "parameters configured.")
kallithea/lib/celerylib/tasks.py
Show inline comments
 
@@ -207,13 +207,13 @@ def get_commits_stats(repo_name, ts_min_
 
            }
 

	
 
        stats = cur_stats if cur_stats else Statistics()
 
        stats.commit_activity = json.dumps(co_day_auth_aggr)
 
        stats.commit_activity_combined = json.dumps(overview_data)
 

	
 
        log.debug('last revison %s' % last_rev)
 
        log.debug('last revision %s' % last_rev)
 
        leftovers = len(repo.revisions[last_rev:])
 
        log.debug('revisions to parse %s' % leftovers)
 

	
 
        if last_rev == 0 or leftovers < parse_limit:
 
            log.debug('getting code trending stats')
 
            stats.languages = json.dumps(__get_codes_stats(repo_name))
kallithea/lib/compat.py
Show inline comments
 
@@ -427,13 +427,13 @@ except ImportError:
 
#==============================================================================
 
# bytes
 
#==============================================================================
 
if __py_version__ >= (2, 6):
 
    _bytes = bytes
 
else:
 
    # in py2.6 bytes is a synonim for str
 
    # in py2.6 bytes is a synonym for str
 
    _bytes = str
 

	
 
if __py_version__ >= (2, 6):
 
    _bytearray = bytearray
 
else:
 
    import array
kallithea/lib/db_manage.py
Show inline comments
 
@@ -399,13 +399,13 @@ class DbManage(object):
 
                log.debug('missing default permission for group %s adding' % g)
 
                perm_obj = RepoGroupModel()._create_default_perms(g)
 
                self.sa.add(perm_obj)
 

	
 
    def reset_permissions(self, username):
 
        """
 
        Resets permissions to default state, usefull when old systems had
 
        Resets permissions to default state, useful when old systems had
 
        bad permissions, we must clean them up
 

	
 
        :param username:
 
        """
 
        default_user = User.get_by_username(username)
 
        if not default_user:
 
@@ -531,14 +531,14 @@ class DbManage(object):
 
        # create default user for handling default permissions.
 
        user = UserModel().create_or_update(username=User.DEFAULT_USER,
 
                                            password=str(uuid.uuid1())[:20],
 
                                            email='anonymous@kallithea-scm.org',
 
                                            firstname='Anonymous',
 
                                            lastname='User')
 
        # based on configuration options activate/deactive this user which
 
        # controlls anonymous access
 
        # based on configuration options activate/deactivate this user which
 
        # controls anonymous access
 
        if self.cli_args.get('public_access') is False:
 
            log.info('Public access disabled')
 
            user.active = False
 
            Session().add(user)
 
            Session().commit()
 

	
kallithea/lib/dbmigrate/migrate/changeset/constraint.py
Show inline comments
 
@@ -35,13 +35,13 @@ class ConstraintChangeset(object):
 
    def create(self, *a, **kw):
 
        """Create the constraint in the database.
 

	
 
        :param engine: the database engine to use. If this is \
 
        :keyword:`None` the instance's engine will be used
 
        :type engine: :class:`sqlalchemy.engine.base.Engine`
 
        :param connection: reuse connection istead of creating new one.
 
        :param connection: reuse connection instead of creating new one.
 
        :type connection: :class:`sqlalchemy.engine.base.Connection` instance
 
        """
 
        # TODO: set the parent here instead of in __init__
 
        self.__do_imports('constraintgenerator', *a, **kw)
 

	
 
    def drop(self, *a, **kw):
 
@@ -49,13 +49,13 @@ class ConstraintChangeset(object):
 

	
 
        :param engine: the database engine to use. If this is
 
          :keyword:`None` the instance's engine will be used
 
        :param cascade: Issue CASCADE drop if database supports it
 
        :type engine: :class:`sqlalchemy.engine.base.Engine`
 
        :type cascade: bool
 
        :param connection: reuse connection istead of creating new one.
 
        :param connection: reuse connection instead of creating new one.
 
        :type connection: :class:`sqlalchemy.engine.base.Connection` instance
 
        :returns: Instance with cleared columns
 
        """
 
        self.cascade = kw.pop('cascade', False)
 
        self.__do_imports('constraintdropper', *a, **kw)
 
        # the spirit of Constraint objects is that they
kallithea/lib/dbmigrate/migrate/changeset/databases/firebird.py
Show inline comments
 
@@ -66,21 +66,21 @@ class FBSchemaChanger(ansisql.ANSISchema
 
        self.append('ALTER COLUMN %s TO %s' % (col_name, new_name))
 

	
 
    def _visit_column_nullable(self, table, column, delta):
 
        """Changing NULL is not supported"""
 
        # TODO: http://www.firebirdfaq.org/faq103/
 
        raise exceptions.NotSupportedError(
 
            "Firebird does not support altering NULL bevahior.")
 
            "Firebird does not support altering NULL behavior.")
 

	
 

	
 
class FBConstraintGenerator(ansisql.ANSIConstraintGenerator):
 
    """Firebird constraint generator implementation."""
 

	
 

	
 
class FBConstraintDropper(ansisql.ANSIConstraintDropper):
 
    """Firebird constaint dropper implementation."""
 
    """Firebird constraint dropper implementation."""
 

	
 
    def cascade_constraint(self, constraint):
 
        """Cascading constraints is not supported"""
 
        raise exceptions.NotSupportedError(
 
            "Firebird does not support cascading constraints")
 

	
kallithea/lib/dbmigrate/migrate/changeset/databases/postgres.py
Show inline comments
 
@@ -28,13 +28,13 @@ class PGSchemaChanger(ansisql.ANSISchema
 
class PGConstraintGenerator(ansisql.ANSIConstraintGenerator):
 
    """PostgreSQL constraint generator implementation."""
 
    pass
 

	
 

	
 
class PGConstraintDropper(ansisql.ANSIConstraintDropper):
 
    """PostgreSQL constaint dropper implementation."""
 
    """PostgreSQL constraint dropper implementation."""
 
    pass
 

	
 

	
 
class PGDialect(ansisql.ANSIDialect):
 
    columngenerator = PGColumnGenerator
 
    columndropper = PGColumnDropper
kallithea/lib/dbmigrate/migrate/changeset/schema.py
Show inline comments
 
@@ -427,13 +427,13 @@ class ChangesetTable(object):
 

	
 
    def drop_column(self, column, *p, **kw):
 
        """Drop a column, given its name or definition.
 

	
 
        API to :meth:`ChangesetColumn.drop`
 

	
 
        :param column: Column to be droped
 
        :param column: Column to be dropped
 
        :type column: Column instance or string
 
        """
 
        if not isinstance(column, sqlalchemy.Column):
 
            # It's a column name
 
            try:
 
                column = getattr(self.c, str(column))
 
@@ -446,13 +446,13 @@ class ChangesetTable(object):
 

	
 
    def rename(self, name, connection=None, **kwargs):
 
        """Rename this table.
 

	
 
        :param name: New name of the table.
 
        :type name: string
 
        :param connection: reuse connection istead of creating new one.
 
        :param connection: reuse connection instead of creating new one.
 
        :type connection: :class:`sqlalchemy.engine.base.Connection` instance
 
        """
 
        engine = self.bind
 
        self.new_name = name
 
        visitorcallable = get_engine_visitor(engine, 'schemachanger')
 
        run_single_visitor(engine, visitorcallable, self, connection, **kwargs)
 
@@ -502,13 +502,13 @@ class ChangesetColumn(object):
 
        :param unique_name: Creates :class:\
 
`~migrate.changeset.constraint.UniqueConstraint` on this column.
 
        :param primary_key_name: Creates :class:\
 
`~migrate.changeset.constraint.PrimaryKeyConstraint` on this column.
 
        :param populate_default: If True, created column will be \
 
populated with defaults
 
        :param connection: reuse connection istead of creating new one.
 
        :param connection: reuse connection instead of creating new one.
 
        :type table: Table instance
 
        :type index_name: string
 
        :type unique_name: string
 
        :type primary_key_name: string
 
        :type populate_default: bool
 
        :type connection: :class:`sqlalchemy.engine.base.Connection` instance
 
@@ -536,13 +536,13 @@ populated with defaults
 

	
 
    def drop(self, table=None, connection=None, **kwargs):
 
        """Drop this column from the database, leaving its table intact.
 

	
 
        ``ALTER TABLE DROP COLUMN``, for most databases.
 

	
 
        :param connection: reuse connection istead of creating new one.
 
        :param connection: reuse connection instead of creating new one.
 
        :type connection: :class:`sqlalchemy.engine.base.Connection` instance
 
        """
 
        if table is not None:
 
            self.table = table
 
        engine = self.table.bind
 
        visitorcallable = get_engine_visitor(engine, 'columndropper')
 
@@ -630,13 +630,13 @@ class ChangesetIndex(object):
 

	
 
    def rename(self, name, connection=None, **kwargs):
 
        """Change the name of an index.
 

	
 
        :param name: New name of the Index.
 
        :type name: string
 
        :param connection: reuse connection istead of creating new one.
 
        :param connection: reuse connection instead of creating new one.
 
        :type connection: :class:`sqlalchemy.engine.base.Connection` instance
 
        """
 
        engine = self.table.bind
 
        self.new_name = name
 
        visitorcallable = get_engine_visitor(engine, 'schemachanger')
 
        engine._run_visitor(visitorcallable, self, connection, **kwargs)
kallithea/lib/dbmigrate/migrate/versioning/script/py.py
Show inline comments
 
@@ -117,13 +117,13 @@ class PythonScript(base.BaseScript):
 
            return buf.getvalue()
 

	
 
        return go(url, step, **args)
 

	
 
    def run(self, engine, step):
 
        """Core method of Script file.
 
        Exectues :func:`update` or :func:`downgrade` functions
 
        Executes :func:`update` or :func:`downgrade` functions
 

	
 
        :param engine: SQLAlchemy Engine
 
        :param step: Operation to run
 
        :type engine: string
 
        :type step: int
 
        """
kallithea/lib/dbmigrate/migrate/versioning/shell.py
Show inline comments
 
@@ -55,13 +55,13 @@ class PassiveOptionParser(OptionParser):
 
                largs.append(arg)
 
                del rargs[0]
 

	
 
def main(argv=None, **kwargs):
 
    """Shell interface to :mod:`migrate.versioning.api`.
 

	
 
    kwargs are default options that can be overriden with passing
 
    kwargs are default options that can be overridden with passing
 
    --some_option as command line option
 

	
 
    :param disable_logging: Let migrate configure logging
 
    :type disable_logging: bool
 
    """
 
    if argv is not None:
kallithea/lib/dbmigrate/schema/db_1_1_0.py
Show inline comments
 
@@ -20,13 +20,13 @@ class BaseModel(object):
 
        d = {}
 
        for k in self._get_keys():
 
            d[k] = getattr(self, k)
 
        return d
 

	
 
    def get_appstruct(self):
 
        """return list with keys and values tupples corresponding
 
        """return list with keys and values tuples corresponding
 
        to this model data """
 

	
 
        l = []
 
        for k in self._get_keys():
 
            l.append((k, getattr(self, k),))
 
        return l
kallithea/lib/dbmigrate/schema/db_1_2_0.py
Show inline comments
 
@@ -85,13 +85,13 @@ class ModelSerializer(json.JSONEncoder):
 
        if hasattr(obj, '__json__'):
 
            return obj.__json__()
 
        else:
 
            return json.JSONEncoder.default(self, obj)
 

	
 
class BaseModel(object):
 
    """Base Model for all classess
 
    """Base Model for all classes
 

	
 
    """
 

	
 
    @classmethod
 
    def _get_keys(cls):
 
        """return column names for this model """
 
@@ -104,13 +104,13 @@ class BaseModel(object):
 
        d = {}
 
        for k in self._get_keys():
 
            d[k] = getattr(self, k)
 
        return d
 

	
 
    def get_appstruct(self):
 
        """return list with keys and values tupples corresponding
 
        """return list with keys and values tuples corresponding
 
        to this model data """
 

	
 
        l = []
 
        for k in self._get_keys():
 
            l.append((k, getattr(self, k),))
 
        return l
 
@@ -781,13 +781,13 @@ class Group(Base, BaseModel):
 
            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
 
                # this will prevent accidental infinite loops
 
                log.error('group nested more than %s' %
 
                          parents_recursion_limit)
 
                break
 

	
 
            groups.insert(0, gr)
 
        return groups
kallithea/lib/dbmigrate/schema/db_1_3_0.py
Show inline comments
 
@@ -115,13 +115,13 @@ class BaseModel(object):
 
        # also use __json__() if present to get additional fields
 
        for k, val in getattr(self, '__json__', lambda: {})().iteritems():
 
            d[k] = val
 
        return d
 

	
 
    def get_appstruct(self):
 
        """return list with keys and values tupples corresponding
 
        """return list with keys and values tuples corresponding
 
        to this model data """
 

	
 
        l = []
 
        for k in self._get_keys():
 
            l.append((k, getattr(self, k),))
 
        return l
 
@@ -809,13 +809,13 @@ class RepoGroup(Base, BaseModel):
 
            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
 
                # this will prevent accidental infinite loops
 
                log.error('group nested more than %s' %
 
                          parents_recursion_limit)
 
                break
 

	
 
            groups.insert(0, gr)
 
        return groups
kallithea/lib/dbmigrate/schema/db_1_4_0.py
Show inline comments
 
@@ -92,13 +92,13 @@ class BaseModel(object):
 
                _json_attr = _json_attr()
 
            for k, val in _json_attr.iteritems():
 
                d[k] = val
 
        return d
 

	
 
    def get_appstruct(self):
 
        """return list with keys and values tupples corresponding
 
        """return list with keys and values tuples corresponding
 
        to this model data """
 

	
 
        l = []
 
        for k in self._get_keys():
 
            l.append((k, getattr(self, k),))
 
        return l
 
@@ -1077,13 +1077,13 @@ class RepoGroup(Base, BaseModel):
 
            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
 
                # this will prevent accidental infinite loops
 
                log.error('group nested more than %s' %
 
                          parents_recursion_limit)
 
                break
 

	
 
            groups.insert(0, gr)
 
        return groups
kallithea/lib/dbmigrate/schema/db_1_5_0.py
Show inline comments
 
@@ -91,13 +91,13 @@ class BaseModel(object):
 
                _json_attr = _json_attr()
 
            for k, val in _json_attr.iteritems():
 
                d[k] = val
 
        return d
 

	
 
    def get_appstruct(self):
 
        """return list with keys and values tupples corresponding
 
        """return list with keys and values tuples corresponding
 
        to this model data """
 

	
 
        l = []
 
        for k in self._get_keys():
 
            l.append((k, getattr(self, k),))
 
        return l
 
@@ -1096,13 +1096,13 @@ class RepoGroup(Base, BaseModel):
 
            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
 
                # this will prevent accidental infinite loops
 
                log.error('group nested more than %s' %
 
                          parents_recursion_limit)
 
                break
 

	
 
            groups.insert(0, gr)
 
        return groups
kallithea/lib/dbmigrate/schema/db_1_5_2.py
Show inline comments
 
@@ -93,13 +93,13 @@ class BaseModel(object):
 
                _json_attr = _json_attr()
 
            for k, val in _json_attr.iteritems():
 
                d[k] = val
 
        return d
 

	
 
    def get_appstruct(self):
 
        """return list with keys and values tupples corresponding
 
        """return list with keys and values tuples corresponding
 
        to this model data """
 

	
 
        l = []
 
        for k in self._get_keys():
 
            l.append((k, getattr(self, k),))
 
        return l
 
@@ -1217,13 +1217,13 @@ class RepoGroup(Base, BaseModel):
 
            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
 
                # this will prevent accidental infinite loops
 
                log.error('group nested more than %s' %
 
                          parents_recursion_limit)
 
                break
 

	
 
            groups.insert(0, gr)
 
        return groups
kallithea/lib/dbmigrate/schema/db_1_6_0.py
Show inline comments
 
@@ -93,13 +93,13 @@ class BaseModel(object):
 
                _json_attr = _json_attr()
 
            for k, val in _json_attr.iteritems():
 
                d[k] = val
 
        return d
 

	
 
    def get_appstruct(self):
 
        """return list with keys and values tupples corresponding
 
        """return list with keys and values tuples corresponding
 
        to this model data """
 

	
 
        l = []
 
        for k in self._get_keys():
 
            l.append((k, getattr(self, k),))
 
        return l
 
@@ -1292,13 +1292,13 @@ class RepoGroup(Base, BaseModel):
 
            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
 
                # this will prevent accidental infinite loops
 
                log.error('group nested more than %s' %
 
                          parents_recursion_limit)
 
                break
 

	
 
            groups.insert(0, gr)
 
        return groups
kallithea/lib/dbmigrate/schema/db_1_7_0.py
Show inline comments
 
@@ -93,13 +93,13 @@ class BaseModel(object):
 
                _json_attr = _json_attr()
 
            for k, val in _json_attr.iteritems():
 
                d[k] = val
 
        return d
 

	
 
    def get_appstruct(self):
 
        """return list with keys and values tupples corresponding
 
        """return list with keys and values tuples corresponding
 
        to this model data """
 

	
 
        l = []
 
        for k in self._get_keys():
 
            l.append((k, getattr(self, k),))
 
        return l
 
@@ -1310,13 +1310,13 @@ class RepoGroup(Base, BaseModel):
 
            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
 
                # this will prevent accidental infinite loops
 
                log.error('group nested more than %s' %
 
                          parents_recursion_limit)
 
                break
 

	
 
            groups.insert(0, gr)
 
        return groups
kallithea/lib/dbmigrate/schema/db_1_8_0.py
Show inline comments
 
@@ -93,13 +93,13 @@ class BaseModel(object):
 
                _json_attr = _json_attr()
 
            for k, val in _json_attr.iteritems():
 
                d[k] = val
 
        return d
 

	
 
    def get_appstruct(self):
 
        """return list with keys and values tupples corresponding
 
        """return list with keys and values tuples corresponding
 
        to this model data """
 

	
 
        l = []
 
        for k in self._get_keys():
 
            l.append((k, getattr(self, k),))
 
        return l
 
@@ -1340,13 +1340,13 @@ class RepoGroup(Base, BaseModel):
 
            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
 
                # this will prevent accidental infinite loops
 
                log.error('group nested more than %s' %
 
                          parents_recursion_limit)
 
                break
 

	
 
            groups.insert(0, gr)
 
        return groups
kallithea/lib/dbmigrate/schema/db_2_0_0.py
Show inline comments
 
@@ -94,13 +94,13 @@ class BaseModel(object):
 
                _json_attr = _json_attr()
 
            for k, val in _json_attr.iteritems():
 
                d[k] = val
 
        return d
 

	
 
    def get_appstruct(self):
 
        """return list with keys and values tupples corresponding
 
        """return list with keys and values tuples corresponding
 
        to this model data """
 

	
 
        l = []
 
        for k in self._get_keys():
 
            l.append((k, getattr(self, k),))
 
        return l
 
@@ -1397,13 +1397,13 @@ class RepoGroup(Base, BaseModel):
 
            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
 
                # this will prevent accidental infinite loops
 
                log.error('group nested more than %s' %
 
                          parents_recursion_limit)
 
                break
 

	
 
            groups.insert(0, gr)
 
        return groups
kallithea/lib/dbmigrate/schema/db_2_0_1.py
Show inline comments
 
@@ -94,13 +94,13 @@ class BaseModel(object):
 
                _json_attr = _json_attr()
 
            for k, val in _json_attr.iteritems():
 
                d[k] = val
 
        return d
 

	
 
    def get_appstruct(self):
 
        """return list with keys and values tupples corresponding
 
        """return list with keys and values tuples corresponding
 
        to this model data """
 

	
 
        l = []
 
        for k in self._get_keys():
 
            l.append((k, getattr(self, k),))
 
        return l
 
@@ -1398,13 +1398,13 @@ class RepoGroup(Base, BaseModel):
 
            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
 
                # this will prevent accidental infinite loops
 
                log.error('group nested more than %s' %
 
                          parents_recursion_limit)
 
                break
 

	
 
            groups.insert(0, gr)
 
        return groups
kallithea/lib/dbmigrate/schema/db_2_0_2.py
Show inline comments
 
@@ -94,13 +94,13 @@ class BaseModel(object):
 
                _json_attr = _json_attr()
 
            for k, val in _json_attr.iteritems():
 
                d[k] = val
 
        return d
 

	
 
    def get_appstruct(self):
 
        """return list with keys and values tupples corresponding
 
        """return list with keys and values tuples corresponding
 
        to this model data """
 

	
 
        l = []
 
        for k in self._get_keys():
 
            l.append((k, getattr(self, k),))
 
        return l
 
@@ -1419,13 +1419,13 @@ class RepoGroup(Base, BaseModel):
 
            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
 
                # this will prevent accidental infinite loops
 
                log.error('group nested more than %s' %
 
                          parents_recursion_limit)
 
                break
 

	
 
            groups.insert(0, gr)
 
        return groups
kallithea/lib/dbmigrate/schema/db_2_1_0.py
Show inline comments
 
@@ -94,13 +94,13 @@ class BaseModel(object):
 
                _json_attr = _json_attr()
 
            for k, val in _json_attr.iteritems():
 
                d[k] = val
 
        return d
 

	
 
    def get_appstruct(self):
 
        """return list with keys and values tupples corresponding
 
        """return list with keys and values tuples corresponding
 
        to this model data """
 

	
 
        l = []
 
        for k in self._get_keys():
 
            l.append((k, getattr(self, k),))
 
        return l
 
@@ -1458,13 +1458,13 @@ class RepoGroup(Base, BaseModel):
 
            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
 
                # this will prevent accidental infinite loops
 
                log.error('group nested more than %s' %
 
                          parents_recursion_limit)
 
                break
 

	
 
            groups.insert(0, gr)
 
        return groups
kallithea/lib/dbmigrate/schema/db_2_2_0.py
Show inline comments
 
@@ -95,13 +95,13 @@ class BaseModel(object):
 
                _json_attr = _json_attr()
 
            for k, val in _json_attr.iteritems():
 
                d[k] = val
 
        return d
 

	
 
    def get_appstruct(self):
 
        """return list with keys and values tupples corresponding
 
        """return list with keys and values tuples corresponding
 
        to this model data """
 

	
 
        l = []
 
        for k in self._get_keys():
 
            l.append((k, getattr(self, k),))
 
        return l
 
@@ -1508,13 +1508,13 @@ class RepoGroup(Base, BaseModel):
 
            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
 
                # this will prevent accidental infinite loops
 
                log.error('group nested more than %s' %
 
                          parents_recursion_limit)
 
                break
 

	
 
            groups.insert(0, gr)
 
        return groups
kallithea/lib/dbmigrate/schema/db_2_2_3.py
Show inline comments
 
@@ -95,13 +95,13 @@ class BaseModel(object):
 
                _json_attr = _json_attr()
 
            for k, val in _json_attr.iteritems():
 
                d[k] = val
 
        return d
 

	
 
    def get_appstruct(self):
 
        """return list with keys and values tupples corresponding
 
        """return list with keys and values tuples corresponding
 
        to this model data """
 

	
 
        l = []
 
        for k in self._get_keys():
 
            l.append((k, getattr(self, k),))
 
        return l
 
@@ -1535,13 +1535,13 @@ class RepoGroup(Base, BaseModel):
 
            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
 
                # this will prevent accidental infinite loops
 
                log.error('group nested more than %s' %
 
                          parents_recursion_limit)
 
                break
 

	
 
            groups.insert(0, gr)
 
        return groups
kallithea/lib/diffs.py
Show inline comments
 
@@ -199,13 +199,13 @@ class DiffProcessor(object):
 
    _escape_re = re.compile(r'(&)|(<)|(>)|(\t)|(\r)|(?<=.)( \n| $)')
 

	
 

	
 
    def __init__(self, diff, vcs='hg', format='gitdiff', diff_limit=None):
 
        """
 
        :param diff:   a text in diff format
 
        :param vcs: type of version controll hg or git
 
        :param vcs: type of version control hg or git
 
        :param format: format of diff passed, `udiff` or `gitdiff`
 
        :param diff_limit: define the size of diff that is considered "big"
 
            based on that parameter cut off will be triggered, set to None
 
            to show full diff
 
        """
 
        if not isinstance(diff, basestring):
kallithea/lib/graphmod.py
Show inline comments
 
@@ -115,13 +115,13 @@ def _colored(repo, dag):
 

	
 
        col = row.index(rev)
 
        addparents = [p for p in dagparents if p not in row]
 

	
 
        # Add unknown parents to nextrow
 
        tmprow = row[:]
 
        tmprow[col:col + 1] = reversed(addparents) # higest revs first (to the right), dead ends last (to the left)
 
        tmprow[col:col + 1] = reversed(addparents) # highest revs first (to the right), dead ends last (to the left)
 
        # Stop looking for non-existing ancestors
 
        nextrow = []
 
        for r in tmprow:
 
            if r > nullrev or r in dagparents:
 
                nextrow.append(r)
 
            else:
kallithea/lib/helpers.py
Show inline comments
 
@@ -121,13 +121,13 @@ def _reset(name, value=None, id=NotGiven
 
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
 
    Creates a unique ID for filenode based on it's hash of path and revision
 
    it's safe to use in urls
 

	
 
    :param raw_id:
 
    :param path:
 
    """
 

	
 
@@ -960,13 +960,13 @@ class Page(_Page):
 
            text = '..'
 
            if self.dotdot_attr:
 
                text = HTML.span(c=text, **self.dotdot_attr)
 
            nav_items.append(text)
 

	
 
        for thispage in xrange(leftmost_page, rightmost_page + 1):
 
            # Hilight the current page number and do not use a link
 
            # Highlight the current page number and do not use a link
 
            if thispage == self.page:
 
                text = '%s' % (thispage,)
 
                # Wrap in a SPAN tag if nolink_attr is set
 
                if self.curpage_attr:
 
                    text = HTML.span(c=text, **self.curpage_attr)
 
                nav_items.append(text)
 
@@ -1259,13 +1259,13 @@ def fancy_file_stats(stats):
 
    )
 
    return literal('<div style="width:%spx">%s%s</div>' % (width, d_a, d_d))
 

	
 

	
 
def urlify_text(text_, safe=True):
 
    """
 
    Extrac urls from text and make html links out of them
 
    Extract urls from text and make html links out of them
 

	
 
    :param text_:
 
    """
 

	
 
    def url_func(match_obj):
 
        url_full = match_obj.groups()[0]
kallithea/lib/hooks.py
Show inline comments
 
@@ -12,13 +12,13 @@
 
# You should have received a copy of the GNU General Public License
 
# along with this program.  If not, see <http://www.gnu.org/licenses/>.
 
"""
 
kallithea.lib.hooks
 
~~~~~~~~~~~~~~~~~~~
 

	
 
Hooks runned by kallithea
 
Hooks run by Kallithea
 

	
 
This file was forked by the Kallithea project in July 2014.
 
Original author and date, and relevant copyright and licensing information is below:
 
:created_on: Aug 6, 2010
 
:author: marcink
 
:copyright: (c) 2013 RhodeCode GmbH, and others.
 
@@ -374,15 +374,15 @@ handle_git_pre_receive = (lambda repo_pa
 
handle_git_post_receive = (lambda repo_path, revs, env:
 
    handle_git_receive(repo_path, revs, env, hook_type='post'))
 

	
 

	
 
def handle_git_receive(repo_path, revs, env, hook_type='post'):
 
    """
 
    A really hacky method that is runned by git post-receive hook and logs
 
    A really hacky method that is run by git post-receive hook and logs
 
    an push action together with pushed revisions. It's executed by subprocess
 
    thus needs all info to be able to create a on the fly pylons enviroment,
 
    thus needs all info to be able to create a on the fly pylons environment,
 
    connect to database and run the logging code. Hacky as sh*t but works.
 

	
 
    :param repo_path:
 
    :param revs:
 
    :param env:
 
    """
kallithea/lib/ipaddr.py
Show inline comments
 
@@ -730,13 +730,13 @@ class _BaseNet(_IPAddrBase):
 

	
 
        Returns:
 
            A sorted list of IPvXNetwork objects addresses which is self
 
            minus other.
 

	
 
        Raises:
 
            TypeError: If self and other are of difffering address
 
            TypeError: If self and other are of differing address
 
              versions, or if other is not a network object.
 
            ValueError: If other is not completely contained by self.
 

	
 
        """
 
        if not self._version == other._version:
 
            raise TypeError("%s and %s are not of the same version" % (
kallithea/lib/markup_renderer.py
Show inline comments
 
@@ -148,13 +148,13 @@ class MarkupRenderer(object):
 
        except ImportError:
 
            log.warning('Install markdown to use this function')
 
            return cls.plain(source)
 
        except Exception:
 
            log.error(traceback.format_exc())
 
            if safe:
 
                log.debug('Fallbacking to render in plain mode')
 
                log.debug('Falling back to render in plain mode')
 
                return cls.plain(source)
 
            else:
 
                raise
 

	
 
    @classmethod
 
    def rst(cls, source, safe=True):
 
@@ -179,13 +179,13 @@ class MarkupRenderer(object):
 
        except ImportError:
 
            log.warning('Install docutils to use this function')
 
            return cls.plain(source)
 
        except Exception:
 
            log.error(traceback.format_exc())
 
            if safe:
 
                log.debug('Fallbacking to render in plain mode')
 
                log.debug('Falling back to render in plain mode')
 
                return cls.plain(source)
 
            else:
 
                raise
 

	
 
    @classmethod
 
    def rst_with_mentions(cls, source):
kallithea/lib/middleware/wrapper.py
Show inline comments
 
@@ -12,13 +12,13 @@
 
# You should have received a copy of the GNU General Public License
 
# along with this program.  If not, see <http://www.gnu.org/licenses/>.
 
"""
 
kallithea.lib.middleware.wrapper
 
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 

	
 
request time mesuring app
 
request time measuring app
 

	
 
This file was forked by the Kallithea project in July 2014.
 
Original author and date, and relevant copyright and licensing information is below:
 
:created_on: May 23, 2013
 
:author: marcink
 
:copyright: (c) 2013 RhodeCode GmbH, and others.
kallithea/lib/pidlock.py
Show inline comments
 
@@ -51,13 +51,13 @@ class DaemonLock(object):
 
                                  args=(self, debug), exitpriority=10)
 

	
 
    @staticmethod
 
    def _on_finalize(lock, debug):
 
        if lock.held:
 
            if debug:
 
                print 'leck held finilazing and running lock.release()'
 
                print 'lock held finalizing and running lock.release()'
 
            lock.release()
 

	
 
    def lock(self):
 
        """
 
        locking function, if lock is present it
 
        will raise LockHeld exception
 
@@ -127,13 +127,13 @@ class DaemonLock(object):
 
            pass
 

	
 
    def makelock(self, lockname, pidfile):
 
        """
 
        this function will make an actual lock
 

	
 
        :param lockname: acctual pid of file
 
        :param lockname: actual pid of file
 
        :param pidfile: the file to write the pid in
 
        """
 
        if self.debug:
 
            print 'creating a file %s and pid: %s' % (pidfile, lockname)
 

	
 
        dir_, file_ = os.path.split(pidfile)
kallithea/lib/profiler.py
Show inline comments
 
@@ -24,13 +24,13 @@ class ProfilingMiddleware(object):
 

	
 
            profiler.runcall(run_app, environ, start_response)
 

	
 
            profiler.snapshot_stats()
 

	
 
            stats = pstats.Stats(profiler)
 
            stats.sort_stats('calls') #cummulative
 
            stats.sort_stats('calls') #cumulative
 

	
 
            # Redirect output
 
            out = StringIO()
 
            stats.stream = out
 

	
 
            stats.print_stats()
kallithea/lib/utils2.py
Show inline comments
 
@@ -113,13 +113,13 @@ def aslist(obj, sep=None, strip=True):
 
    else:
 
        return [obj]
 

	
 

	
 
def convert_line_endings(line, mode):
 
    """
 
    Converts a given line  "line end" accordingly to given mode
 
    Converts a given line  "line end" according to given mode
 

	
 
    Available modes are::
 
        0 - Unix
 
        1 - Mac
 
        2 - DOS
 

	
kallithea/lib/vcs/backends/base.py
Show inline comments
 
@@ -62,13 +62,13 @@ class BaseRepository(object):
 
        """
 
        Initializes repository. Raises RepositoryError if repository could
 
        not be find at the given ``repo_path`` or directory at ``repo_path``
 
        exists and ``create`` is set to True.
 

	
 
        :param repo_path: local path of the repository
 
        :param create=False: if set to True, would try to craete repository.
 
        :param create=False: if set to True, would try to create repository.
 
        :param src_url=None: if set, should be proper url from which repository
 
          would be cloned; requires ``create`` parameter to be set to True -
 
          raises RepositoryError if src_url is set and create evaluates to
 
          False
 
        """
 
        raise NotImplementedError
 
@@ -630,13 +630,13 @@ class BaseChangeset(object):
 
        Returns total number of bytes from contents of all filenodes.
 
        """
 
        return sum((node.size for node in self.get_filenodes_generator()))
 

	
 
    def walk(self, topurl=''):
 
        """
 
        Similar to os.walk method. Insted of filesystem it walks through
 
        Similar to os.walk method. Instead of filesystem it walks through
 
        changeset starting at given ``topurl``.  Returns generator of tuples
 
        (topnode, dirnodes, filenodes).
 
        """
 
        topnode = self.get_node(topurl)
 
        yield (topnode, topnode.dirs, topnode.files)
 
        for dirnode in topnode.dirs:
 
@@ -958,13 +958,13 @@ class BaseInMemoryChangeset(object):
 
            While overriding this method each backend's should call
 
            ``self.check_integrity(parents)`` in the first place.
 

	
 
        :param message: message of the commit
 
        :param author: full username, i.e. "Joe Doe <joe.doe@example.com>"
 
        :param parents: single parent or sequence of parents from which commit
 
          would be derieved
 
          would be derived
 
        :param date: ``datetime.datetime`` instance. Defaults to
 
          ``datetime.datetime.now()``.
 
        :param branch: branch name, as string. If none given, default backend's
 
          branch would be used.
 

	
 
        :raises ``CommitError``: if any error occurs while committing
kallithea/lib/vcs/backends/git/changeset.py
Show inline comments
 
@@ -320,13 +320,13 @@ class GitChangeset(BaseChangeset):
 
        TODO: This function now uses os underlying 'git' command which is
 
        generally not good. Should be replaced with algorithm iterating
 
        commits.
 
        """
 
        cmd = 'blame -l --root -r %s -- "%s"' % (self.id, path)
 
        # -l     ==> outputs long shas (and we need all 40 characters)
 
        # --root ==> doesn't put '^' character for bounderies
 
        # --root ==> doesn't put '^' character for boundaries
 
        # -r sha ==> blames for the given revision
 
        so, se = self.repository.run_git_command(cmd)
 

	
 
        for i, blame_line in enumerate(so.split('\n')[:-1]):
 
            ln_no = i + 1
 
            sha, line = re.split(r' ', blame_line, 1)
kallithea/lib/vcs/backends/git/inmemory.py
Show inline comments
 
@@ -17,13 +17,13 @@ class GitInMemoryChangeset(BaseInMemoryC
 
        returns newly created ``Changeset``. Updates repository's
 
        ``revisions``.
 

	
 
        :param message: message of the commit
 
        :param author: full username, i.e. "Joe Doe <joe.doe@example.com>"
 
        :param parents: single parent or sequence of parents from which commit
 
          would be derieved
 
          would be derived
 
        :param date: ``datetime.datetime`` instance. Defaults to
 
          ``datetime.datetime.now()``.
 
        :param branch: branch name, as string. If none given, default backend's
 
          branch would be used.
 

	
 
        :raises ``CommitError``: if any error occurs while committing
kallithea/lib/vcs/backends/git/repository.py
Show inline comments
 
@@ -275,13 +275,13 @@ class GitRepository(BaseRepository):
 
                    if x[1][1] != 'T']
 
        return [c.commit.id for c in self._repo.get_walker(include=includes)]
 

	
 
    def _get_revision(self, revision):
 
        """
 
        For git backend we always return integer here. This way we ensure
 
        that changset's revision attribute would become integer.
 
        that changeset's revision attribute would become integer.
 
        """
 

	
 
        is_null = lambda o: len(o) == revision.count('0')
 

	
 
        if self._empty:
 
            raise EmptyRepositoryError("There are no changesets yet")
kallithea/lib/vcs/backends/hg/inmemory.py
Show inline comments
 
@@ -16,13 +16,13 @@ class MercurialInMemoryChangeset(BaseInM
 
        returns newly created ``Changeset``. Updates repository's
 
        ``revisions``.
 

	
 
        :param message: message of the commit
 
        :param author: full username, i.e. "Joe Doe <joe.doe@example.com>"
 
        :param parents: single parent or sequence of parents from which commit
 
          would be derieved
 
          would be derived
 
        :param date: ``datetime.datetime`` instance. Defaults to
 
          ``datetime.datetime.now()``.
 
        :param branch: branch name, as string. If none given, default backend's
 
          branch would be used.
 

	
 
        :raises ``CommitError``: if any error occurs while committing
kallithea/lib/vcs/conf/settings.py
Show inline comments
 
@@ -16,13 +16,13 @@ VCSRC_PATH = VCSRC_PATH or abspath(HOME_
 
if os.path.isdir(VCSRC_PATH):
 
    VCSRC_PATH = os.path.join(VCSRC_PATH, '__init__.py')
 

	
 
# list of default encoding used in safe_unicode/safe_str methods
 
DEFAULT_ENCODINGS = aslist('utf8')
 

	
 
# path to git executable runned by run_git_command function
 
# path to git executable run by run_git_command function
 
GIT_EXECUTABLE_PATH = 'git'
 
# can be also --branches --tags
 
GIT_REV_FILTER = '--all'
 

	
 
BACKENDS = {
 
    'hg': 'kallithea.lib.vcs.backends.hg.MercurialRepository',
kallithea/lib/vcs/nodes.py
Show inline comments
 
@@ -234,13 +234,13 @@ class Node(object):
 

	
 

	
 
class FileNode(Node):
 
    """
 
    Class representing file nodes.
 

	
 
    :attribute: path: path to the node, relative to repostiory's root
 
    :attribute: path: path to the node, relative to repository's root
 
    :attribute: content: if given arbitrary sets content of the file
 
    :attribute: changeset: if given, first time content is accessed, callback
 
    :attribute: mode: octal stat mode for a node. Default is 0100644.
 
    """
 

	
 
    def __init__(self, path, content=None, changeset=None, mode=None):
 
@@ -476,13 +476,13 @@ class RemovedFileNode(FileNode):
 

	
 

	
 
class DirNode(Node):
 
    """
 
    DirNode stores list of files and directories within this node.
 
    Nodes may be used standalone but within repository context they
 
    lazily fetch data within same repositorty's changeset.
 
    lazily fetch data within same repository's changeset.
 
    """
 

	
 
    def __init__(self, path, nodes=(), changeset=None):
 
        """
 
        Only one of ``nodes`` and ``changeset`` may be given. Passing both
 
        would raise ``NodeError`` exception.
kallithea/lib/vcs/subprocessio.py
Show inline comments
 
@@ -226,45 +226,45 @@ class BufferedGenerator(object):
 
    def reading_paused(self):
 
        return not self.worker.keep_reading.is_set()
 

	
 
    @property
 
    def done_reading_event(self):
 
        """
 
        Done_reding does not mean that the iterator's buffer is empty.
 
        Done_reading does not mean that the iterator's buffer is empty.
 
        Iterator might have done reading from underlying source, but the read
 
        chunks might still be available for serving through .next() method.
 

	
 
        :returns: An Event class instance.
 
        """
 
        return self.worker.EOF
 

	
 
    @property
 
    def done_reading(self):
 
        """
 
        Done_reding does not mean that the iterator's buffer is empty.
 
        Done_reading does not mean that the iterator's buffer is empty.
 
        Iterator might have done reading from underlying source, but the read
 
        chunks might still be available for serving through .next() method.
 

	
 
        :returns: An Bool value.
 
        """
 
        return self.worker.EOF.is_set()
 

	
 
    @property
 
    def length(self):
 
        """
 
        returns int.
 

	
 
        This is the lenght of the que of chunks, not the length of
 
        This is the length of the queue of chunks, not the length of
 
        the combined contents in those chunks.
 

	
 
        __len__() cannot be meaningfully implemented because this
 
        reader is just flying throuh a bottomless pit content and
 
        can only know the lenght of what it already saw.
 
        reader is just flying through a bottomless pit content and
 
        can only know the length of what it already saw.
 

	
 
        If __len__() on WSGI server per PEP 3333 returns a value,
 
        the responce's length will be set to that. In order not to
 
        the response's length will be set to that. In order not to
 
        confuse WSGI PEP3333 servers, we will not implement __len__
 
        at all.
 
        """
 
        return len(self.data)
 

	
 
    def prepend(self, x):
 
@@ -294,17 +294,17 @@ class SubprocessIOChunker(object):
 
      (reading from subprocess out pauses when internal buffer is full, but
 
       does not block the parent calling code. On the flip side, reading from
 
       slow-yielding subprocess may block the iteration until data shows up. This
 
       does not block the parallel inpipe reading occurring parallel thread.)
 

	
 
    The purpose of the object is to allow us to wrap subprocess interactions into
 
    and interable that can be passed to a WSGI server as the application's return
 
    an iterable that can be passed to a WSGI server as the application's return
 
    value. Because of stream-processing-ability, WSGI does not have to read ALL
 
    of the subprocess's output and buffer it, before handing it to WSGI server for
 
    HTTP response. Instead, the class initializer reads just a bit of the stream
 
    to figure out if error ocurred or likely to occur and if not, just hands the
 
    to figure out if error occurred or likely to occur and if not, just hands the
 
    further iteration over subprocess output to the server for completion of HTTP
 
    response.
 

	
 
    The real or perceived subprocess error is trapped and raised as one of
 
    EnvironmentError family of exceptions
 

	
kallithea/lib/vcs/utils/__init__.py
Show inline comments
 
@@ -47,13 +47,13 @@ def date_fromtimestamp(unixts, tzoffset=
 

	
 
    return datetime.datetime.fromtimestamp(float(unixts))
 

	
 

	
 
def safe_int(val, default=None):
 
    """
 
    Returns int() of val if val is not convertable to int use default
 
    Returns int() of val if val is not convertible to int use default
 
    instead
 

	
 
    :param val:
 
    :param default:
 
    """
 

	
kallithea/lib/vcs/utils/baseui_config.py
Show inline comments
 
from kallithea.lib.vcs.utils.hgcompat import ui, config
 

	
 

	
 
def make_ui(self, path='hgwebdir.config'):
 
    """
 
    A funcion that will read python rc files and make an ui from read options
 
    A function that will read python rc files and make an ui from read options
 

	
 
    :param path: path to mercurial config file
 
    """
 
    #propagated from mercurial documentation
 
    sections = [
 
                'alias',
kallithea/lib/vcs/utils/compat.py
Show inline comments
 
@@ -13,13 +13,13 @@ else:
 
    unittest = __import__('unittest2')
 

	
 

	
 
if sys.version_info >= (2, 6):
 
    _bytes = bytes
 
else:
 
    # in py2.6 bytes is a synonim for str
 
    # in py2.6 bytes is a synonym for str
 
    _bytes = str
 

	
 
if sys.version_info >= (2, 6):
 
    _bytearray = bytearray
 
else:
 
    # no idea if this is correct but all integration tests are passing
kallithea/lib/vcs/utils/helpers.py
Show inline comments
 
"""
 
Utitlites aimed to help achieve mostly basic tasks.
 
Utilities aimed to help achieve mostly basic tasks.
 
"""
 
from __future__ import division
 

	
 
import re
 
import os
 
import time
kallithea/lib/vcs/utils/hgcompat.py
Show inline comments
 
@@ -27,14 +27,14 @@ from mercurial.hg import peer
 
from mercurial.httppeer import httppeer
 
from mercurial.sshpeer import sshpeer
 
from mercurial.util import url as hg_url
 
from mercurial.scmutil import revrange
 
from mercurial.node import nullrev
 

	
 
# those authnadlers are patched for python 2.6.5 bug an
 
# infinit looping when given invalid resources
 
# those authhandlers are patched for python 2.6.5 bug an
 
# infinite looping when given invalid resources
 
from mercurial.url import httpbasicauthhandler, httpdigestauthhandler
 

	
 
import inspect
 
# Mercurial 3.1 503bb3af70fe
 
if inspect.getargspec(memfilectx.__init__).args[1] != 'repo':
 
    _org__init__=memfilectx.__init__
kallithea/lib/vcs/utils/imports.py
Show inline comments
 
@@ -8,13 +8,13 @@ def import_class(class_path):
 
    For example, in order to get class located at
 
    ``vcs.backends.hg.MercurialRepository``:
 

	
 
        try:
 
            hgrepo = import_class('vcs.backends.hg.MercurialRepository')
 
        except VCSError:
 
            # hadle error
 
            # handle error
 
    """
 
    splitted = class_path.split('.')
 
    mod_path = '.'.join(splitted[:-1])
 
    class_name = splitted[-1]
 
    try:
 
        class_mod = __import__(mod_path, {}, {}, [class_name])
kallithea/lib/vcs/utils/lockfiles.py
Show inline comments
 
@@ -54,13 +54,13 @@ class LockFile(object):
 

	
 
    def _release_lock(self):
 
        """Release our lock if we have one"""
 
        if not self._has_lock():
 
            return
 

	
 
        # if someone removed our file beforhand, lets just flag this issue
 
        # if someone removed our file beforehand, lets just flag this issue
 
        # instead of failing, to make it more usable.
 
        lfp = self._lock_file_path()
 
        try:
 
            # on bloody windows, the file needs write permissions to be removable.
 
            # Why ...
 
            if os.name == 'nt':
0 comments (0 inline, 0 general)