diff mercurial/commands.py @ 5300:81575b7b505e

Merge with crew-stable
author Patrick Mezard <pmezard@gmail.com>
date Tue, 11 Sep 2007 23:38:29 +0200
parents d59ed18ec2d0 cba2a689117d
children ba3dc7883968
line wrap: on
line diff
--- a/mercurial/commands.py	Tue Sep 11 13:24:52 2007 -0700
+++ b/mercurial/commands.py	Tue Sep 11 23:38:29 2007 +0200
@@ -1976,16 +1976,30 @@
     revision or the argument to --rev if given) is printed.
     """
     rev = opts.get('rev')
+    if rev:
+        ctx = repo.changectx(rev)
+    else:
+        ctx = repo.workingctx()
+
     if file_:
         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)
+        file_ = files[0]
+        filenodes = []
+        for cp in ctx.parents():
+            if not cp:
+                continue
+            try:
+                filenodes.append(cp.filenode(file_))
+            except revlog.LookupError:
+                pass
+        if not filenodes:
+            raise util.Abort(_("'%s' not found in manifest!") % file_)
+        fl = repo.file(file_)
+        p = [repo.lookup(fl.linkrev(fn)) for fn in filenodes]
     else:
-        ctx = repo.workingctx()
-    p = [cp.node() for cp in ctx.parents()]
+        p = [cp.node() for cp in ctx.parents()]
 
     displayer = cmdutil.show_changeset(ui, repo, opts)
     for n in p: