203 # Just in case catch this and and pass exit code to caller. |
203 # Just in case catch this and and pass exit code to caller. |
204 return inst.code |
204 return inst.code |
205 except socket.error, inst: |
205 except socket.error, inst: |
206 ui.warn(_("abort: %s\n") % inst.args[-1]) |
206 ui.warn(_("abort: %s\n") % inst.args[-1]) |
207 except: # re-raises |
207 except: # re-raises |
208 ui.warn(_("** unknown exception encountered," |
208 myver = util.version() |
209 " please report by visiting\n")) |
209 # For compatibility checking, we discard the portion of the hg |
210 ui.warn(_("** http://mercurial.selenic.com/wiki/BugTracker\n")) |
210 # version after the + on the assumption that if a "normal |
211 ui.warn(_("** Python %s\n") % sys.version.replace('\n', '')) |
211 # user" is running a build with a + in it the packager |
212 ui.warn(_("** Mercurial Distributed SCM (version %s)\n") |
212 # probably built from fairly close to a tag and anyone with a |
213 % util.version()) |
213 # 'make local' copy of hg (where the version number can be out |
214 ui.warn(_("** Extensions loaded: %s\n") |
214 # of date) will be clueful enough to notice the implausible |
215 % ", ".join([x[0] for x in extensions.extensions()])) |
215 # version number and try updating. |
|
216 compare = myver.split('+')[0] |
|
217 ct = tuplever(compare) |
|
218 worst = None, ct, '' |
|
219 for name, mod in extensions.extensions(): |
|
220 testedwith = getattr(mod, 'testedwith', 'unknown') |
|
221 report = getattr(mod, 'buglink', _('the extension author.')) |
|
222 if testedwith == 'unknown': |
|
223 # We found an untested extension. It's likely the culprit. |
|
224 worst = name, testedwith, report |
|
225 break |
|
226 if compare not in testedwith.split() and testedwith != 'internal': |
|
227 tested = [tuplever(v) for v in testedwith.split()] |
|
228 nearest = max([t for t in tested if t < ct]) |
|
229 if nearest < worst[1]: |
|
230 worst = name, nearest, report |
|
231 if worst[0] is not None: |
|
232 name, testedwith, report = worst |
|
233 if not isinstance(testedwith, str): |
|
234 testedwith = '.'.join([str(c) for c in testedwith]) |
|
235 warning = (_('** Unknown exception encountered with ' |
|
236 'possibly-broken third-party extension %s\n' |
|
237 '** which supports versions %s of Mercurial.\n' |
|
238 '** Please disable %s and try your action again.\n' |
|
239 '** If that fixes the bug please report it to %s\n') |
|
240 % (name, testedwith, name, report)) |
|
241 else: |
|
242 warning = (_("** unknown exception encountered, " |
|
243 "please report by visiting\n") + |
|
244 _("** http://mercurial.selenic.com/wiki/BugTracker\n")) |
|
245 warning += ((_("** Python %s\n") % sys.version.replace('\n', '')) + |
|
246 (_("** Mercurial Distributed SCM (version %s)\n") % myver) + |
|
247 (_("** Extensions loaded: %s\n") % |
|
248 ", ".join([x[0] for x in extensions.extensions()]))) |
|
249 ui.warn(warning) |
216 raise |
250 raise |
217 |
251 |
218 return -1 |
252 return -1 |
|
253 |
|
254 def tuplever(v): |
|
255 return tuple([int(i) for i in v.split('.')]) |
|
256 |
219 |
257 |
220 def aliasargs(fn, givenargs): |
258 def aliasargs(fn, givenargs): |
221 args = getattr(fn, 'args', []) |
259 args = getattr(fn, 'args', []) |
222 if args: |
260 if args: |
223 cmd = ' '.join(map(util.shellquote, args)) |
261 cmd = ' '.join(map(util.shellquote, args)) |