changeset 5608:9a4d4e623c85

Merge stable
author Mads Kiilerich <madski@unity3d.com>
date Fri, 25 Dec 2015 13:50:18 +0100
parents 8bc8366a6874 (current diff) efce61aac33d (diff)
children ada6571a6d27
files kallithea/lib/indexers/daemon.py kallithea/model/db.py kallithea/public/js/base.js
diffstat 8 files changed, 35 insertions(+), 6 deletions(-) [+]
line wrap: on
line diff
--- a/kallithea/lib/auth_modules/auth_internal.py	Fri Nov 27 01:48:09 2015 +0100
+++ b/kallithea/lib/auth_modules/auth_internal.py	Fri Dec 25 13:50:18 2015 +0100
@@ -67,6 +67,9 @@
             log.warning("userobj:%s extern_type mismatch got:`%s` expected:`%s`",
                      userobj, userobj.extern_type, self.name)
             return None
+        if not username:
+            log.debug('Empty username - skipping...')
+            return None
 
         user_data = {
             "username": userobj.username,
--- a/kallithea/lib/auth_modules/auth_pam.py	Fri Nov 27 01:48:09 2015 +0100
+++ b/kallithea/lib/auth_modules/auth_pam.py	Fri Dec 25 13:50:18 2015 +0100
@@ -85,6 +85,9 @@
         return True
 
     def auth(self, userobj, username, password, settings, **kwargs):
+        if not username:
+            log.debug('Empty username - skipping...')
+            return None
         if username not in _auth_cache:
             # Need lock here, as PAM authentication is not thread safe
             _pam_lock.acquire()
--- a/kallithea/lib/diffs.py	Fri Nov 27 01:48:09 2015 +0100
+++ b/kallithea/lib/diffs.py	Fri Dec 25 13:50:18 2015 +0100
@@ -160,11 +160,11 @@
         # has already been split on this:
         # ^diff[ ]--git
             [ ]a/(?P<a_path>.+?)[ ]b/(?P<b_path>.+?)\n
+        (?:^old[ ]mode[ ](?P<old_mode>\d+)\n
+           ^new[ ]mode[ ](?P<new_mode>\d+)(?:\n|$))?
         (?:^similarity[ ]index[ ](?P<similarity_index>\d+)%\n
            ^rename[ ]from[ ](?P<rename_from>.+)\n
            ^rename[ ]to[ ](?P<rename_to>.+)(?:\n|$))?
-        (?:^old[ ]mode[ ](?P<old_mode>\d+)\n
-           ^new[ ]mode[ ](?P<new_mode>\d+)(?:\n|$))?
         (?:^new[ ]file[ ]mode[ ](?P<new_file_mode>.+)(?:\n|$))?
         (?:^deleted[ ]file[ ]mode[ ](?P<deleted_file_mode>.+)(?:\n|$))?
         (?:^index[ ](?P<a_blob_id>[0-9A-Fa-f]+)
--- a/kallithea/lib/indexers/daemon.py	Fri Nov 27 01:48:09 2015 +0100
+++ b/kallithea/lib/indexers/daemon.py	Fri Dec 25 13:50:18 2015 +0100
@@ -177,8 +177,12 @@
         Adding doc to writer this function itself fetches data from
         the instance of vcs backend
         """
+        try:
+            node = self.get_node(repo, path, index_rev)
+        except (ChangesetError, NodeDoesNotExistError):
+            log.debug("couldn't add doc - %s did not have %r at %s", repo, path, index_rev)
+            return 0, 0
 
-        node = self.get_node(repo, path, index_rev)
         indexed = indexed_w_content = 0
         if self.is_indexable_node(node):
             u_content = node.content
--- a/kallithea/model/db.py	Fri Nov 27 01:48:09 2015 +0100
+++ b/kallithea/model/db.py	Fri Dec 25 13:50:18 2015 +0100
@@ -2138,7 +2138,13 @@
             return True
         inv_obj.cache_active = True
         Session().add(inv_obj)
-        Session().commit()
+        try:
+            Session().commit()
+        except exc.IntegrityError:
+            inv_obj = cls.query().filter(cls.cache_key == cache_key).scalar()
+            if not inv_obj:
+                raise
+            # TOCTOU - another thread added the key at the same time; no further action required
         return False
 
     @classmethod
--- a/kallithea/public/js/base.js	Fri Nov 27 01:48:09 2015 +0100
+++ b/kallithea/public/js/base.js	Fri Dec 25 13:50:18 2015 +0100
@@ -1918,7 +1918,7 @@
 $(document).ready(function(){
     $('.diff-collapse-button').click(function(e) {
         var $button = $(e.currentTarget);
-        var $target = $('#' + $button.prop('target'));
+        var $target = $('#' + $button.attr('target'));
         if($target.hasClass('hidden')){
             $target.removeClass('hidden');
             $button.html("&uarr; {0} &uarr;".format(_TM['Collapse Diff']));
--- a/kallithea/tests/fixtures/git_diff_rename_file.diff	Fri Nov 27 01:48:09 2015 +0100
+++ b/kallithea/tests/fixtures/git_diff_rename_file.diff	Fri Dec 25 13:50:18 2015 +0100
@@ -2,3 +2,9 @@
 similarity index 100%
 rename from work-horus.xls
 rename to file.xls
+diff --git a/files/var/www/favicon.ico b/files/var/www/favicon.ico/DEFAULT
+old mode 100644
+new mode 100755
+similarity index 100%
+rename from files/var/www/favicon.ico
+rename to files/var/www/favicon.ico/DEFAULT
--- a/kallithea/tests/models/test_diff_parsers.py	Fri Nov 27 01:48:09 2015 +0100
+++ b/kallithea/tests/models/test_diff_parsers.py	Fri Dec 25 13:50:18 2015 +0100
@@ -133,7 +133,14 @@
          {'added': 0,
           'deleted': 0,
           'binary': True,
-          'ops': {RENAMED_FILENODE: 'file renamed from work-horus.xls to file.xls'}})
+          'ops': {RENAMED_FILENODE: 'file renamed from work-horus.xls to file.xls'}}),
+        ('files/var/www/favicon.ico/DEFAULT',
+         'R',
+         {'added': 0,
+          'binary': True,
+          'deleted': 0,
+          'ops': {4: 'file renamed from files/var/www/favicon.ico to files/var/www/favicon.ico/DEFAULT',
+                  6: 'modified file chmod 100644 => 100755'}})
     ],
     'git_diff_mod_single_binary_file.diff': [
         ('US Warszawa.jpg', 'M',