Mercurial > public > mercurial-scm > hg
diff hgext/git/manifest.py @ 52660:1c8bc6110a1a
git: skip recursing into manifest subtrees that are the same
If during manifest comparison we are presented with identical tree objects,
then we are guaranteed that:
1. the contents of these tree objects are the same
2. the contents of any of their children are the same
This speeds up 'hg diff -c <hash>' considerably since unchanged subtrees are
are skipped. For example, a commit that modified the README in the linux
kernel repo (~84k tracked files) now takes 1.1s instead of 15.7s.
author | Josef 'Jeff' Sipek <jeffpc@josefsipek.net> |
---|---|
date | Sat, 04 Jan 2025 11:13:15 -0500 |
parents | 4cb75772818d |
children | 279e217d6041 |
line wrap: on
line diff
--- a/hgext/git/manifest.py Tue Jan 07 17:52:52 2025 -0500 +++ b/hgext/git/manifest.py Sat Jan 04 11:13:15 2025 -0500 @@ -170,6 +170,11 @@ def _iterativediff(t1, t2, subdir): """compares two trees and appends new tree nodes to examine to the stack""" + if t1 == t2: + # If the trees are the same (git) object, then there are no + # differences in this tree or any of its children. + return + if t1 is None: t1 = {} if t2 is None: