[PATCH 3 of 3] merge: add file ancestor linknode to mergestate

Durham Goode durham at fb.com
Wed Jan 6 19:48:44 CST 2016

On 1/6/16 5:40 PM, Durham Goode wrote:
> # HG changeset patch
> # User Durham Goode <durham at fb.com>
> # Date 1452127911 28800
> #      Wed Jan 06 16:51:51 2016 -0800
> # Node ID a8adf78352f494c7cf88221bd346ecdda2a9cdfa
> # Parent  7afd0e010fd8d7fea0e6339f5f280fa192c1e176
> merge: add file ancestor linknode to mergestate
> During a merge, each file has a current filenode, an other filenode, and an
> ancestor filenode. The ancestor filenode's linknode is not stored though, and we
> rely on the ability for the filectx() to look up the linknode by using the
> revlog's linkrev. In alternative backends (like remotefilelog), linkrev's may
> not be present or may have restriction that prevent arbitrary linkrev look up
> given a filenode.
> This patch accounts for that by storing the ancestor filenode's linknode in the
> merge state so that it is available later at resolution time.
> This results in some minor test changes due to the extra state, and due to us no
> longer always using the earliest commit (i.e. the linkrev target) for that
> filenode (which is ok, since we're still using an ancestor of current and other
> that uses the correct filenode).
For anyone curious, the following is a list of all the places in 
Mercurial that construct filectx's without providing a changeid/ctx:

     File "/data/users/durham/hg/hgext/children.py", line 47, in children
     File "/data/users/durham/hg/hgext/keyword.py", line 231, in linkctx
     File "/data/users/durham/hg/mercurial/commands.py", line 5335, in 
     File "/data/users/durham/hg/mercurial/context.py", line 1711, in 
     File "/data/users/durham/hg/mercurial/context.py", line 900, in parents
     File "/data/users/durham/hg/mercurial/copies.py", line 268, in makectx
     File "/data/users/durham/hg/mercurial/merge.py", line 1040, in 
     File "/data/users/durham/hg/mercurial/tags.py", line 120, in 
     File "/data/users/durham/hg/mercurial/tags.py", line 122, in 

Eventually I'd like to get rid of all of these (except perhaps the tag 
stuff), so we can enable non-revlog based storage.

More information about the Mercurial-devel mailing list