157 ss = b", ".join(sorted(similar)) |
157 ss = b", ".join(sorted(similar)) |
158 write(_(b"(did you mean one of %s?)\n") % ss) |
158 write(_(b"(did you mean one of %s?)\n") % ss) |
159 |
159 |
160 |
160 |
161 def formatparse(write, inst): |
161 def formatparse(write, inst): |
162 similar = [] |
|
163 if isinstance(inst, error.UnknownIdentifier): |
|
164 # make sure to check fileset first, as revset can invoke fileset |
|
165 similar = getsimilar(inst.symbols, inst.function) |
|
166 if inst.location is not None: |
162 if inst.location is not None: |
167 write( |
163 write( |
168 _(b"hg: parse error at %s: %s\n") |
164 _(b"hg: parse error at %s: %s\n") |
169 % (pycompat.bytestr(inst.location), inst.message) |
165 % (pycompat.bytestr(inst.location), inst.message) |
170 ) |
166 ) |
171 else: |
167 else: |
172 write(_(b"hg: parse error: %s\n") % inst.message) |
168 write(_(b"hg: parse error: %s\n") % inst.message) |
|
169 if isinstance(inst, error.UnknownIdentifier): |
|
170 # make sure to check fileset first, as revset can invoke fileset |
|
171 similar = getsimilar(inst.symbols, inst.function) |
173 reportsimilar(write, similar) |
172 reportsimilar(write, similar) |
174 if inst.hint: |
173 elif inst.hint: |
175 write(_(b"(%s)\n") % inst.hint) |
174 write(_(b"(%s)\n") % inst.hint) |
176 |
175 |
177 |
176 |
178 def callcatch(ui, func): |
177 def callcatch(ui, func): |
179 """call func() with global exception handling |
178 """call func() with global exception handling |