mercurial/commands.py
changeset 1622 5e9168401a68
parent 1619 1ba0d7041ac4
child 1625 e1bcf7fa983f
--- a/mercurial/commands.py
+++ b/mercurial/commands.py
@@ -1531,9 +1531,15 @@ def locate(ui, repo, *pats, **opts):
     that contain white space as multiple filenames.
     """
     end = opts['print0'] and '\0' or '\n'
+    rev = opts['rev']
+    if rev:
+        node = repo.lookup(rev)
+    else:
+        node = None
 
-    for src, abs, rel, exact in walk(repo, pats, opts, '(?:.*/|)'):
-        if repo.dirstate.state(abs) == '?':
+    for src, abs, rel, exact in walk(repo, pats, opts, node=node,
+                                     head='(?:.*/|)'):
+        if not node and repo.dirstate.state(abs) == '?':
             continue
         if opts['fullpath']:
             ui.write(os.path.join(repo.root, abs), end)