Show More
@@ -1,4 +1,4 b'' | |||||
1 | RhodeCode VCSServer provides access to different vcs backends via network. |
|
1 | # RhodeCode VCSServer provides access to different vcs backends via network. | |
2 | # Copyright (C) 2014-2020 RhodeCode GmbH |
|
2 | # Copyright (C) 2014-2020 RhodeCode GmbH | |
3 | # |
|
3 | # | |
4 | # This program is free software; you can redistribute it and/or modify |
|
4 | # This program is free software; you can redistribute it and/or modify |
@@ -14,17 +14,16 b'' | |||||
14 | # You should have received a copy of the GNU General Public License |
|
14 | # You should have received a copy of the GNU General Public License | |
15 | # along with this program; if not, write to the Free Software Foundation, |
|
15 | # along with this program; if not, write to the Free Software Foundation, | |
16 | # Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA |
|
16 | # Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA | |
17 | import functools |
|
17 | ||
18 | import io |
|
18 | import io | |
19 | import logging |
|
19 | import logging | |
20 | import os |
|
|||
21 | import stat |
|
20 | import stat | |
22 | import urllib.request, urllib.parse, urllib.error |
|
21 | import urllib.request, urllib.parse, urllib.error | |
23 | import urllib.request, urllib.error, urllib.parse |
|
22 | import urllib.request, urllib.error, urllib.parse | |
24 | import traceback |
|
23 | import traceback | |
25 |
|
24 | |||
26 | from hgext import largefiles, rebase, purge |
|
25 | from hgext import largefiles, rebase, purge | |
27 | from hgext.strip import strip as hgext_strip |
|
26 | ||
28 | from mercurial import commands |
|
27 | from mercurial import commands | |
29 | from mercurial import unionrepo |
|
28 | from mercurial import unionrepo | |
30 | from mercurial import verify |
|
29 | from mercurial import verify | |
@@ -39,7 +38,7 b' from vcsserver.hgcompat import (' | |||||
39 | makepeer, instance, match, memctx, exchange, memfilectx, nullrev, hg_merge, |
|
38 | makepeer, instance, match, memctx, exchange, memfilectx, nullrev, hg_merge, | |
40 | patch, peer, revrange, ui, hg_tag, Abort, LookupError, RepoError, |
|
39 | patch, peer, revrange, ui, hg_tag, Abort, LookupError, RepoError, | |
41 | RepoLookupError, InterventionRequired, RequirementError, |
|
40 | RepoLookupError, InterventionRequired, RequirementError, | |
42 | alwaysmatcher, patternmatcher, hgutil) |
|
41 | alwaysmatcher, patternmatcher, hgutil, hgext_strip) | |
43 | from vcsserver.vcs_base import RemoteBase |
|
42 | from vcsserver.vcs_base import RemoteBase | |
44 |
|
43 | |||
45 | log = logging.getLogger(__name__) |
|
44 | log = logging.getLogger(__name__) |
@@ -21,6 +21,7 b' Mercurial libs compatibility' | |||||
21 |
|
21 | |||
22 | import mercurial |
|
22 | import mercurial | |
23 | from mercurial import demandimport |
|
23 | from mercurial import demandimport | |
|
24 | ||||
24 | # patch demandimport, due to bug in mercurial when it always triggers |
|
25 | # patch demandimport, due to bug in mercurial when it always triggers | |
25 | # demandimport.enable() |
|
26 | # demandimport.enable() | |
26 | demandimport.enable = lambda *args, **kwargs: 1 |
|
27 | demandimport.enable = lambda *args, **kwargs: 1 | |
@@ -39,7 +40,8 b' from mercurial import subrepo' | |||||
39 | from mercurial import subrepoutil |
|
40 | from mercurial import subrepoutil | |
40 | from mercurial import tags as hg_tag |
|
41 | from mercurial import tags as hg_tag | |
41 | from mercurial import util as hgutil |
|
42 | from mercurial import util as hgutil | |
42 |
from mercurial.commands import clone, |
|
43 | from mercurial.commands import clone, pull | |
|
44 | from mercurial.node import nullid | |||
43 | from mercurial.context import memctx, memfilectx |
|
45 | from mercurial.context import memctx, memfilectx | |
44 | from mercurial.error import ( |
|
46 | from mercurial.error import ( | |
45 | LookupError, RepoError, RepoLookupError, Abort, InterventionRequired, |
|
47 | LookupError, RepoError, RepoLookupError, Abort, InterventionRequired, | |
@@ -53,7 +55,7 b' from mercurial.encoding import tolocal' | |||||
53 | from mercurial.discovery import findcommonoutgoing |
|
55 | from mercurial.discovery import findcommonoutgoing | |
54 | from mercurial.hg import peer |
|
56 | from mercurial.hg import peer | |
55 | from mercurial.httppeer import makepeer |
|
57 | from mercurial.httppeer import makepeer | |
56 | from mercurial.util import url as hg_url |
|
58 | from mercurial.utils.urlutil import url as hg_url | |
57 | from mercurial.scmutil import revrange, revsymbol |
|
59 | from mercurial.scmutil import revrange, revsymbol | |
58 | from mercurial.node import nullrev |
|
60 | from mercurial.node import nullrev | |
59 | from mercurial import exchange |
|
61 | from mercurial import exchange | |
@@ -63,6 +65,9 b' from hgext import largefiles' | |||||
63 | # infinit looping when given invalid resources |
|
65 | # infinit looping when given invalid resources | |
64 | from mercurial.url import httpbasicauthhandler, httpdigestauthhandler |
|
66 | from mercurial.url import httpbasicauthhandler, httpdigestauthhandler | |
65 |
|
67 | |||
|
68 | # hg strip is in core now | |||
|
69 | from mercurial import strip as hgext_strip | |||
|
70 | ||||
66 |
|
71 | |||
67 | def get_ctx(repo, ref): |
|
72 | def get_ctx(repo, ref): | |
68 | try: |
|
73 | try: |
@@ -21,10 +21,8 b' import logging' | |||||
21 | import functools |
|
21 | import functools | |
22 |
|
22 | |||
23 | from dogpile.cache import CacheRegion |
|
23 | from dogpile.cache import CacheRegion | |
24 | from dogpile.cache.util import compat |
|
|||
25 |
|
24 | |||
26 | from vcsserver.utils import safe_str, sha1 |
|
25 | from vcsserver.utils import safe_str, sha1 | |
27 |
|
||||
28 | from vcsserver.lib.rc_cache import region_meta |
|
26 | from vcsserver.lib.rc_cache import region_meta | |
29 |
|
27 | |||
30 | log = logging.getLogger(__name__) |
|
28 | log = logging.getLogger(__name__) | |
@@ -36,7 +34,7 b' class RhodeCodeCacheRegion(CacheRegion):' | |||||
36 | self, namespace=None, |
|
34 | self, namespace=None, | |
37 | expiration_time=None, |
|
35 | expiration_time=None, | |
38 | should_cache_fn=None, |
|
36 | should_cache_fn=None, | |
39 |
to_str= |
|
37 | to_str=str, | |
40 | function_key_generator=None, |
|
38 | function_key_generator=None, | |
41 | condition=True): |
|
39 | condition=True): | |
42 | """ |
|
40 | """ | |
@@ -44,7 +42,7 b' class RhodeCodeCacheRegion(CacheRegion):' | |||||
44 | condition isn't meet. This works a bit different than should_cache_fn |
|
42 | condition isn't meet. This works a bit different than should_cache_fn | |
45 | And it's faster in cases we don't ever want to compute cached values |
|
43 | And it's faster in cases we don't ever want to compute cached values | |
46 | """ |
|
44 | """ | |
47 |
expiration_time_is_callable = |
|
45 | expiration_time_is_callable = callable(expiration_time) | |
48 |
|
46 | |||
49 | if function_key_generator is None: |
|
47 | if function_key_generator is None: | |
50 | function_key_generator = self.function_key_generator |
|
48 | function_key_generator = self.function_key_generator | |
@@ -53,7 +51,7 b' class RhodeCodeCacheRegion(CacheRegion):' | |||||
53 | # once we've migrated to py3 |
|
51 | # once we've migrated to py3 | |
54 | if 'cython' == 'cython': |
|
52 | if 'cython' == 'cython': | |
55 | def decorator(fn): |
|
53 | def decorator(fn): | |
56 |
if to_str is |
|
54 | if to_str is str: | |
57 | # backwards compatible |
|
55 | # backwards compatible | |
58 | key_generator = function_key_generator(namespace, fn) |
|
56 | key_generator = function_key_generator(namespace, fn) | |
59 | else: |
|
57 | else: | |
@@ -123,7 +121,7 b' class RhodeCodeCacheRegion(CacheRegion):' | |||||
123 | return self.get_or_create(key, user_func, timeout, should_cache_fn, (arg, kw)) |
|
121 | return self.get_or_create(key, user_func, timeout, should_cache_fn, (arg, kw)) | |
124 |
|
122 | |||
125 | def cache_decorator(user_func): |
|
123 | def cache_decorator(user_func): | |
126 |
if to_str is |
|
124 | if to_str is str: | |
127 | # backwards compatible |
|
125 | # backwards compatible | |
128 | key_generator = function_key_generator(namespace, user_func) |
|
126 | key_generator = function_key_generator(namespace, user_func) | |
129 | else: |
|
127 | else: | |
@@ -176,7 +174,7 b' def get_default_cache_settings(settings,' | |||||
176 | if key.startswith(prefix): |
|
174 | if key.startswith(prefix): | |
177 | name = key.split(prefix)[1].strip() |
|
175 | name = key.split(prefix)[1].strip() | |
178 | val = settings[key] |
|
176 | val = settings[key] | |
179 |
if isinstance(val, |
|
177 | if isinstance(val, str): | |
180 | val = val.strip() |
|
178 | val = val.strip() | |
181 | cache_settings[name] = val |
|
179 | cache_settings[name] = val | |
182 | return cache_settings |
|
180 | return cache_settings |
@@ -16,10 +16,8 b'' | |||||
16 | # Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA |
|
16 | # Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA | |
17 |
|
17 | |||
18 |
|
18 | |||
19 |
|
||||
20 | import os |
|
19 | import os | |
21 | import subprocess |
|
20 | import subprocess | |
22 | import time |
|
|||
23 | from urllib.error import URLError |
|
21 | from urllib.error import URLError | |
24 | import urllib.parse |
|
22 | import urllib.parse | |
25 | import logging |
|
23 | import logging |
General Comments 0
You need to be logged in to leave comments.
Login now