Show More
@@ -13,6 +13,7 b' import hashlib' | |||
|
13 | 13 | import os |
|
14 | 14 | import re |
|
15 | 15 | import socket |
|
16 | import subprocess | |
|
16 | 17 | import weakref |
|
17 | 18 | |
|
18 | 19 | from .i18n import _ |
@@ -1038,20 +1039,18 b' def extdatasource(repo, source):' | |||
|
1038 | 1039 | raise error.Abort(_("unknown extdata source '%s'") % source) |
|
1039 | 1040 | |
|
1040 | 1041 | data = {} |
|
1041 | if spec.startswith("shell:"): | |
|
1042 | # external commands should be run relative to the repo root | |
|
1043 | cmd = spec[6:] | |
|
1044 | cwd = os.getcwd() | |
|
1045 | os.chdir(repo.root) | |
|
1046 | try: | |
|
1047 | src = util.popen(cmd) | |
|
1048 | finally: | |
|
1049 | os.chdir(cwd) | |
|
1050 | else: | |
|
1051 | # treat as a URL or file | |
|
1052 | src = url.open(repo.ui, spec) | |
|
1053 | ||
|
1042 | src = proc = None | |
|
1054 | 1043 | try: |
|
1044 | if spec.startswith("shell:"): | |
|
1045 | # external commands should be run relative to the repo root | |
|
1046 | cmd = spec[6:] | |
|
1047 | proc = subprocess.Popen(cmd, shell=True, bufsize=-1, | |
|
1048 | close_fds=util.closefds, | |
|
1049 | stdout=subprocess.PIPE, cwd=repo.root) | |
|
1050 | src = proc.stdout | |
|
1051 | else: | |
|
1052 | # treat as a URL or file | |
|
1053 | src = url.open(repo.ui, spec) | |
|
1055 | 1054 | for l in src: |
|
1056 | 1055 | if " " in l: |
|
1057 | 1056 | k, v = l.strip().split(" ", 1) |
@@ -1064,7 +1063,10 b' def extdatasource(repo, source):' | |||
|
1064 | 1063 | except (error.LookupError, error.RepoLookupError): |
|
1065 | 1064 | pass # we ignore data for nodes that don't exist locally |
|
1066 | 1065 | finally: |
|
1067 | src.close() | |
|
1066 | if proc: | |
|
1067 | proc.communicate() | |
|
1068 | if src: | |
|
1069 | src.close() | |
|
1068 | 1070 | |
|
1069 | 1071 | return data |
|
1070 | 1072 |
General Comments 0
You need to be logged in to leave comments.
Login now