diff --git a/mercurial/revset.py b/mercurial/revset.py
index a5f7f1e9340e2cb19882fc64d7370a61124fe63f_bWVyY3VyaWFsL3JldnNldC5weQ==..515c2786e1cfc4a823458df20118a2072cb27864_bWVyY3VyaWFsL3JldnNldC5weQ== 100644
--- a/mercurial/revset.py
+++ b/mercurial/revset.py
@@ -232,6 +232,6 @@
     return [r for r in subset if r in ps]
 
 def parents(repo, subset, x):
-    """``parents(set)``
-    The set of all parents for all changesets in set.
+    """``parents([set])``
+    The set of all parents for all changesets in set, or the working directory.
     """
@@ -237,4 +237,8 @@
     """
+    repo.ui.debug(repr(x), '\n')
+    if x is None:
+        return [r.rev() for r in repo[x].parents()]
+
     ps = set()
     cl = repo.changelog
     for r in getset(repo, range(len(repo)), x):
diff --git a/tests/test-revset-dirstate-parents.t b/tests/test-revset-dirstate-parents.t
index a5f7f1e9340e2cb19882fc64d7370a61124fe63f_dGVzdHMvdGVzdC1yZXZzZXQtZGlyc3RhdGUtcGFyZW50cy50..515c2786e1cfc4a823458df20118a2072cb27864_dGVzdHMvdGVzdC1yZXZzZXQtZGlyc3RhdGUtcGFyZW50cy50 100644
--- a/tests/test-revset-dirstate-parents.t
+++ b/tests/test-revset-dirstate-parents.t
@@ -21,6 +21,7 @@
 null revision
   $ log 'p1()'
   $ log 'p2()'
+  $ log 'parents()'
 
 working dir with a single parent
   $ echo a > a
@@ -28,6 +29,8 @@
   $ log 'p1()'
   0
   $ log 'p2()'
+  $ log 'parents()'
+  0
 
 merge in progress
   $ echo b > b
@@ -40,3 +43,6 @@
   2
   $ log 'p2()'
   1
+  $ log 'parents()'
+  2
+  1