diff --git a/mercurial/commands.py b/mercurial/commands.py
index a5e3634ba024f562acd25092f59a4c1bb54d9f40_bWVyY3VyaWFsL2NvbW1hbmRzLnB5..45bd336e3991b4e59ecb258a3bb8aa43d766a5f3_bWVyY3VyaWFsL2NvbW1hbmRzLnB5 100644
--- a/mercurial/commands.py
+++ b/mercurial/commands.py
@@ -5511,7 +5511,8 @@
 
     ctx = scmutil.revsingle(repo, opts.get('rev'))
 
-    if not pats and not (opts.get('all') or opts.get('interactive')):
+    if (not (pats or opts.get('include') or opts.get('exclude') or
+             opts.get('all') or opts.get('interactive'))):
         msg = _("no files or directories specified")
         if p2 != nullid:
             hint = _("uncommitted merge, use --all to discard all changes,"
diff --git a/tests/test-revert.t b/tests/test-revert.t
index a5e3634ba024f562acd25092f59a4c1bb54d9f40_dGVzdHMvdGVzdC1yZXZlcnQudA==..45bd336e3991b4e59ecb258a3bb8aa43d766a5f3_dGVzdHMvdGVzdC1yZXZlcnQudA== 100644
--- a/tests/test-revert.t
+++ b/tests/test-revert.t
@@ -201,8 +201,22 @@
   (use --all to revert all files, or 'hg update 1' to update)
   [255]
 
+call `hg revert` with -I
+---------------------------
+
+  $ echo a >> a
+  $ hg revert -I a
+  reverting a
+
+call `hg revert` with -X
+---------------------------
+
+  $ echo a >> a
+  $ hg revert -X d
+  reverting a
+
 call `hg revert` with --all
 ---------------------------
 
   $ hg revert --all -rtip
   reverting a
@@ -204,9 +218,9 @@
 call `hg revert` with --all
 ---------------------------
 
   $ hg revert --all -rtip
   reverting a
-
+  $ rm *.orig
 
 Issue332: confusing message when reverting directory
 ----------------------------------------------------