[PATCH 1 of 2] parents: change parents command to use filectx

Durham Goode durham at fb.com
Tue Jun 25 19:52:28 CDT 2013


# HG changeset patch
# User Durham Goode <durham at fb.com>
# Date 1371585916 25200
#      Tue Jun 18 13:05:16 2013 -0700
# Node ID f63c47a0e5fecc9e2d8825306da5f4585eed1f50
# Parent  9e39dd78456ade866958b9566156063722c851d0
parents: change parents command to use filectx

Changes the parents command to use filectx to look up the change node
instead of doing it manually.  This allows extensions to modify the
file-to-commit relationship behind the filectx api.

diff --git a/mercurial/commands.py b/mercurial/commands.py
--- a/mercurial/commands.py
+++ b/mercurial/commands.py
@@ -4356,8 +4356,10 @@
                 pass
         if not filenodes:
             raise util.Abort(_("'%s' not found in manifest!") % file_)
-        fl = repo.file(file_)
-        p = [repo.lookup(fl.linkrev(fl.rev(fn))) for fn in filenodes]
+        p = []
+        for fn in filenodes:
+            fctx = repo.filectx(file_, fileid=fn)
+            p.append(fctx.node())
     else:
         p = [cp.node() for cp in ctx.parents()]
 


More information about the Mercurial-devel mailing list