##// END OF EJS Templates
fix: clone-url test for mercurial uses a consistent and strict non-interactive mode so we never will see password prompts
super-admin -
r1263:3fe73e54 default
parent child Browse files
Show More
@@ -86,7 +86,7 b' from vcsserver.lib.exc_tracking import f'
86 86 log = logging.getLogger(__name__)
87 87
88 88
89 def make_ui_from_config(repo_config):
89 def make_ui_from_config(repo_config, interactive=True):
90 90
91 91 class LoggingUI(ui.ui):
92 92
@@ -144,6 +144,7 b' def make_ui_from_config(repo_config):'
144 144 log.debug('Explicitly disable largefiles extension for repo.')
145 145 baseui.setconfig(b'extensions', b'largefiles', b'!')
146 146
147 baseui.setconfig(b'ui', b'interactive', b'true' if interactive else b'false')
147 148 return baseui
148 149
149 150
@@ -523,7 +524,7 b' class HgRemote(RemoteBase):'
523 524 log.debug(
524 525 "Verifying if URL is a Mercurial repository: %s", obfuscated_uri)
525 526 # Create repo path with custom mercurial path object
526 ui = make_ui_from_config(config)
527 ui = make_ui_from_config(config, interactive=False)
527 528 repo_path = hg_path(ui=ui, rawloc=safe_bytes(url))
528 529 peer_checker = make_peer(ui, repo_path, False)
529 530 peer_checker.lookup(b'tip')
@@ -803,12 +804,12 b' class HgRemote(RemoteBase):'
803 804 repo = self._factory.repo(wire)
804 805
805 806 # Disable any prompts for this repo
806 repo.ui.setconfig(b'ui', b'interactive', b'off', b'-y')
807 repo.ui.setconfig(b'ui', b'interactive', b'false', b'-y')
807 808
808 809 bookmarks = list(dict(repo._bookmarks).keys())
809 810 remote = peer(repo, {}, safe_bytes(url))
810 811 # Disable any prompts for this remote
811 remote.ui.setconfig(b'ui', b'interactive', b'off', b'-y')
812 remote.ui.setconfig(b'ui', b'interactive', b'false', b'-y')
812 813
813 814 return exchange.push(
814 815 repo, remote, newbranch=True, bookmarks=bookmarks).cgresult
@@ -1020,11 +1021,11 b' class HgRemote(RemoteBase):'
1020 1021 def pull(self, wire, url, commit_ids=None):
1021 1022 repo = self._factory.repo(wire)
1022 1023 # Disable any prompts for this repo
1023 repo.ui.setconfig(b'ui', b'interactive', b'off', b'-y')
1024 repo.ui.setconfig(b'ui', b'interactive', b'false', b'-y')
1024 1025
1025 1026 remote = peer(repo, {}, safe_bytes(url))
1026 1027 # Disable any prompts for this remote
1027 remote.ui.setconfig(b'ui', b'interactive', b'off', b'-y')
1028 remote.ui.setconfig(b'ui', b'interactive', b'false', b'-y')
1028 1029
1029 1030 if commit_ids:
1030 1031 commit_ids = [bin(commit_id) for commit_id in commit_ids]
@@ -1103,7 +1104,7 b' class HgRemote(RemoteBase):'
1103 1104 # case of merge conflicts or different sub repository sources. By
1104 1105 # setting the interactive flag to `False` mercurial doesn't prompt the
1105 1106 # used but instead uses a default value.
1106 repo.ui.setconfig(b'ui', b'interactive', False)
1107 repo.ui.setconfig(b'ui', b'interactive', b'false')
1107 1108 commands.merge(baseui, repo, rev=safe_bytes(revision))
1108 1109
1109 1110 @reraise_safe_exceptions
@@ -1115,7 +1116,7 b' class HgRemote(RemoteBase):'
1115 1116 # case of merge conflicts or different sub repository sources. By
1116 1117 # setting the interactive flag to `False` mercurial doesn't prompt the
1117 1118 # used but instead uses a default value.
1118 repo.ui.setconfig(b'ui', b'interactive', False)
1119 repo.ui.setconfig(b'ui', b'interactive', b'false')
1119 1120 ms = hg_merge.mergestate(repo)
1120 1121 return [x for x in ms.unresolved()]
1121 1122
@@ -1136,7 +1137,7 b' class HgRemote(RemoteBase):'
1136 1137 # case of merge conflicts or different sub repository sources. By
1137 1138 # setting the interactive flag to `False` mercurial doesn't prompt the
1138 1139 # used but instead uses a default value.
1139 repo.ui.setconfig(b'ui', b'interactive', False)
1140 repo.ui.setconfig(b'ui', b'interactive', b'false')
1140 1141
1141 1142 rebase_kws = dict(
1142 1143 keep=not abort,
General Comments 0
You need to be logged in to leave comments. Login now