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