mercurial/commands.py
changeset 4896 ee04732fe61d
parent 4888 2d545b98a7bc
parent 4894 be5dc5e3ab2d
child 4915 8535c1770dd3
child 4948 6fd953d5faea
--- a/mercurial/commands.py
+++ b/mercurial/commands.py
@@ -1993,7 +1993,10 @@ def parents(ui, repo, file_=None, **opts
     """
     rev = opts.get('rev')
     if file_:
-        ctx = repo.filectx(file_, changeid=rev)
+        files, match, anypats = cmdutil.matchpats(repo, (file_,), opts)
+        if anypats or len(files) != 1:
+            raise util.Abort(_('can only specify an explicit file name'))
+        ctx = repo.filectx(files[0], changeid=rev)
     elif rev:
         ctx = repo.changectx(rev)
     else: