Show More
@@ -1,75 +1,75 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-2019 RhodeCode GmbH |
|
2 | # Copyright (C) 2014-2019 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 | |
5 | # it under the terms of the GNU General Public License as published by |
|
5 | # it under the terms of the GNU General Public License as published by | |
6 | # the Free Software Foundation; either version 3 of the License, or |
|
6 | # the Free Software Foundation; either version 3 of the License, or | |
7 | # (at your option) any later version. |
|
7 | # (at your option) any later version. | |
8 | # |
|
8 | # | |
9 | # This program is distributed in the hope that it will be useful, |
|
9 | # This program is distributed in the hope that it will be useful, | |
10 | # but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
10 | # but WITHOUT ANY WARRANTY; without even the implied warranty of | |
11 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
11 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
12 | # GNU General Public License for more details. |
|
12 | # GNU General Public License for more details. | |
13 | # |
|
13 | # | |
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 |
|
17 | |||
18 | """ |
|
18 | """ | |
19 | Mercurial libs compatibility |
|
19 | Mercurial libs compatibility | |
20 | """ |
|
20 | """ | |
21 |
|
21 | |||
22 | import mercurial |
|
22 | import mercurial | |
23 | from mercurial import demandimport |
|
23 | from mercurial import demandimport | |
24 | # patch demandimport, due to bug in mercurial when it always triggers |
|
24 | # patch demandimport, due to bug in mercurial when it always triggers | |
25 | # demandimport.enable() |
|
25 | # demandimport.enable() | |
26 | demandimport.enable = lambda *args, **kwargs: 1 |
|
26 | demandimport.enable = lambda *args, **kwargs: 1 | |
27 |
|
27 | |||
28 | from mercurial import ui |
|
28 | from mercurial import ui | |
29 | from mercurial import patch |
|
29 | from mercurial import patch | |
30 | from mercurial import config |
|
30 | from mercurial import config | |
31 | from mercurial import extensions |
|
31 | from mercurial import extensions | |
32 | from mercurial import scmutil |
|
32 | from mercurial import scmutil | |
33 | from mercurial import archival |
|
33 | from mercurial import archival | |
34 | from mercurial import discovery |
|
34 | from mercurial import discovery | |
35 | from mercurial import unionrepo |
|
35 | from mercurial import unionrepo | |
36 | from mercurial import localrepo |
|
36 | from mercurial import localrepo | |
37 | from mercurial import merge as hg_merge |
|
37 | from mercurial import merge as hg_merge | |
38 | from mercurial import subrepo |
|
38 | from mercurial import subrepo | |
39 | from mercurial import subrepoutil |
|
39 | from mercurial import subrepoutil | |
40 | from mercurial import tags as hg_tag |
|
40 | from mercurial import tags as hg_tag | |
41 |
|
41 | |||
42 | from mercurial.commands import clone, nullid, pull |
|
42 | from mercurial.commands import clone, nullid, pull | |
43 | from mercurial.context import memctx, memfilectx |
|
43 | from mercurial.context import memctx, memfilectx | |
44 | from mercurial.error import ( |
|
44 | from mercurial.error import ( | |
45 | LookupError, RepoError, RepoLookupError, Abort, InterventionRequired, |
|
45 | LookupError, RepoError, RepoLookupError, Abort, InterventionRequired, | |
46 | RequirementError, ProgrammingError) |
|
46 | RequirementError, ProgrammingError) | |
47 | from mercurial.hgweb import hgweb_mod |
|
47 | from mercurial.hgweb import hgweb_mod | |
48 | from mercurial.localrepo import instance |
|
48 | from mercurial.localrepo import instance | |
49 | from mercurial.match import match |
|
49 | from mercurial.match import match | |
50 | from mercurial.mdiff import diffopts |
|
50 | from mercurial.mdiff import diffopts | |
51 | from mercurial.node import bin, hex |
|
51 | from mercurial.node import bin, hex | |
52 | from mercurial.encoding import tolocal |
|
52 | from mercurial.encoding import tolocal | |
53 | from mercurial.discovery import findcommonoutgoing |
|
53 | from mercurial.discovery import findcommonoutgoing | |
54 | from mercurial.hg import peer |
|
54 | from mercurial.hg import peer | |
55 | from mercurial.httppeer import makepeer |
|
55 | from mercurial.httppeer import makepeer | |
56 | from mercurial.util import url as hg_url |
|
56 | from mercurial.util import url as hg_url | |
57 | from mercurial.scmutil import revrange, revsymbol |
|
57 | from mercurial.scmutil import revrange, revsymbol | |
58 | from mercurial.node import nullrev |
|
58 | from mercurial.node import nullrev | |
59 | from mercurial import exchange |
|
59 | from mercurial import exchange | |
60 | from hgext import largefiles |
|
60 | from hgext import largefiles | |
61 |
|
61 | |||
62 | # those authnadlers are patched for python 2.6.5 bug an |
|
62 | # those authnadlers are patched for python 2.6.5 bug an | |
63 | # infinit looping when given invalid resources |
|
63 | # infinit looping when given invalid resources | |
64 | from mercurial.url import httpbasicauthhandler, httpdigestauthhandler |
|
64 | from mercurial.url import httpbasicauthhandler, httpdigestauthhandler | |
65 |
|
65 | |||
66 |
|
66 | |||
67 | def get_ctx(repo, ref): |
|
67 | def get_ctx(repo, ref): | |
68 | try: |
|
68 | try: | |
69 | ctx = repo[ref] |
|
69 | ctx = repo[ref] | |
70 | except ProgrammingError: |
|
70 | except (ProgrammingError, LookupError, RepoLookupError): | |
71 | # we're unable to find the rev using a regular lookup, we fallback |
|
71 | # we're unable to find the rev using a regular lookup, we fallback | |
72 | # to slower, but backward compat revsymbol usage |
|
72 | # to slower, but backward compat revsymbol usage | |
73 | ctx = revsymbol(repo, ref) |
|
73 | ctx = revsymbol(repo, ref) | |
74 |
|
74 | |||
75 | return ctx |
|
75 | return ctx |
General Comments 0
You need to be logged in to leave comments.
Login now