diff mercurial/commands.py @ 4894:be5dc5e3ab2d

hg parents: don't pass an OS-specific path to repo.filectx The only reason to use the matcher code instead of calling util.canonpath directly is to be able to use "path:canonical/path/to/file" patterns.
author Alexis S. L. Carvalho <alexis@cecm.usp.br>
date Tue, 17 Jul 2007 09:08:29 -0300
parents 242026115e6a
children ee04732fe61d c4dd58af0fc8
line wrap: on
line diff
--- a/mercurial/commands.py
+++ b/mercurial/commands.py
@@ -1978,7 +1978,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: