##// END OF EJS Templates
remotenames: abort if literal revset pattern matches nothing...
Yuya Nishihara -
r40105:fd4d59cf default
parent child Browse files
Show More
@@ -33,6 +33,7 from mercurial.node import (
33 33 )
34 34 from mercurial import (
35 35 bookmarks,
36 error,
36 37 extensions,
37 38 logexchange,
38 39 namespaces,
@@ -355,6 +356,7 def _revsetutil(repo, subset, x, rtypes)
355 356 kind, pattern, matcher = stringutil.stringmatcher(
356 357 revsetlang.getstring(args[0], _('argument must be a string')))
357 358 else:
359 kind = pattern = None
358 360 matcher = util.always
359 361
360 362 nodes = set()
@@ -366,6 +368,9 def _revsetutil(repo, subset, x, rtypes)
366 368 if not matcher(name):
367 369 continue
368 370 nodes.update(ns.nodes(repo, name))
371 if kind == 'literal' and not nodes:
372 raise error.RepoLookupError(_("remote name '%s' does not exist")
373 % pattern)
369 374
370 375 revs = (cl.rev(n) for n in nodes if cl.hasnode(n))
371 376 return subset & smartset.baseset(revs)
@@ -478,13 +478,23 Testing for a single remote name which e
478 478 |
479 479 ~
480 480
481 Testing for a single name which does not exists
481 Testing for a literal name which does not exists, which should fail.
482 482
483 483 $ hg log -r 'remotebranches(def)' -GT "{rev}:{node|short} {remotenames}\n"
484 abort: remote name 'def' does not exist!
485 [255]
484 486
485 487 $ hg log -r 'remotebookmarks("server3")' -GT "{rev}:{node|short} {remotenames}\n"
488 abort: remote name 'server3' does not exist!
489 [255]
486 490
487 491 $ hg log -r 'remotenames("server3")' -GT "{rev}:{node|short} {remotenames}\n"
492 abort: remote name 'server3' does not exist!
493 [255]
494
495 Testing for a pattern which does not match anything, which shouldn't fail.
496
497 $ hg log -r 'remotenames("re:^server3$")'
488 498
489 499 Testing for multiple names, which is not supported.
490 500
General Comments 0
You need to be logged in to leave comments. Login now