Efficiently comparing manifests

Matt Mackall mpm at selenic.com
Thu May 13 14:02:11 CDT 2010


On Thu, 2010-05-13 at 14:44 -0400, Greg Ward wrote:
> So I peeled a layer off the onion and went straight to the manifest class:
> 
>     cl = repo.changelog
>     ml = repo.manifest
> 
>     node = cl.node(rev)
>     p1 = cl.parents(node)[0]
> 
>     mymft = ml.revision(cl.read(node)[0])
>     p1mft = ml.revision(cl.read(p1)[0])
>     return mymft == p1mft

How about simply:

return cl.read(node)[0] == cl.read(p1)[0] # compare manifest SHA1s

This is equivalent to:

return repo[node].manifestnode() == repo[p1].manifestnode()

-- 
Mathematics is the supreme nostalgia of our time.




More information about the Mercurial-devel mailing list