Added
Link Here
|
1 |
--- hgsubversion/__init__.py.orig 2018-11-03 03:35:02 UTC |
2 |
+++ hgsubversion/__init__.py |
3 |
@@ -21,12 +21,7 @@ import inspect |
4 |
import os |
5 |
|
6 |
from mercurial import commands |
7 |
-try: |
8 |
- from mercurial import exchange |
9 |
- exchange.push # existed in first iteration of this file |
10 |
-except ImportError: |
11 |
- # We only *use* the exchange module in hg 3.2+, so this is safe |
12 |
- pass |
13 |
+from mercurial import exchange |
14 |
from mercurial import error as hgerror |
15 |
from mercurial import extensions |
16 |
from mercurial import help |
17 |
@@ -52,6 +47,7 @@ except (ImportError, AttributeError): |
18 |
'svn.ra', |
19 |
} |
20 |
|
21 |
+from mercurial import discovery |
22 |
from mercurial import revset |
23 |
from mercurial import subrepo |
24 |
|
25 |
@@ -106,26 +102,13 @@ wrapcmds = { # cmd: generic, target, fixdoc, ppopts, o |
26 |
]), |
27 |
} |
28 |
|
29 |
-try: |
30 |
- from mercurial import discovery |
31 |
- def findcommonoutgoing(orig, *args, **opts): |
32 |
- capable = getattr(args[1], 'capable', lambda x: False) |
33 |
- if capable('subversion'): |
34 |
- return wrappers.findcommonoutgoing(*args, **opts) |
35 |
- else: |
36 |
- return orig(*args, **opts) |
37 |
- extensions.wrapfunction(discovery, 'findcommonoutgoing', findcommonoutgoing) |
38 |
-except AttributeError: |
39 |
- # only need the discovery variant of this code when we drop hg < 1.6 |
40 |
- def findoutgoing(orig, *args, **opts): |
41 |
- capable = getattr(args[1], 'capable', lambda x: False) |
42 |
- if capable('subversion'): |
43 |
- return wrappers.findoutgoing(*args, **opts) |
44 |
- else: |
45 |
- return orig(*args, **opts) |
46 |
- extensions.wrapfunction(discovery, 'findoutgoing', findoutgoing) |
47 |
-except ImportError: |
48 |
- pass |
49 |
+def findcommonoutgoing(orig, *args, **opts): |
50 |
+ capable = getattr(args[1], 'capable', lambda x: False) |
51 |
+ if capable('subversion'): |
52 |
+ return wrappers.findcommonoutgoing(*args, **opts) |
53 |
+ else: |
54 |
+ return orig(*args, **opts) |
55 |
+extensions.wrapfunction(discovery, 'findcommonoutgoing', findcommonoutgoing) |
56 |
|
57 |
def extsetup(ui): |
58 |
"""insert command wrappers for a bunch of commands""" |
59 |
@@ -157,12 +140,8 @@ def extsetup(ui): |
60 |
except: |
61 |
pass |
62 |
|
63 |
- if not hgutil.safehasattr(localrepo.localrepository, 'push'): |
64 |
- # Mercurial >= 3.2 |
65 |
- extensions.wrapfunction(exchange, 'push', wrappers.exchangepush) |
66 |
- if not hgutil.safehasattr(localrepo.localrepository, 'pull'): |
67 |
- # Mercurial >= 3.2 |
68 |
- extensions.wrapfunction(exchange, 'pull', wrappers.exchangepull) |
69 |
+ extensions.wrapfunction(exchange, 'push', wrappers.exchangepush) |
70 |
+ extensions.wrapfunction(exchange, 'pull', wrappers.exchangepull) |
71 |
|
72 |
helpdir = os.path.join(os.path.dirname(__file__), 'help') |
73 |
|