# HG changeset patch # User Pierre-Yves David # Date 1709648478 -3600 # Node ID 4bfae99c4021b3f5f2dfdf2f839c4e9986432bc9 # Parent ef369d16965ddffe4de35074ae843830ce59efe8 filteredhash: move the hashing in its own function This will help us to reuse this logic in variants of the hashes used for branch cache validation. diff -r ef369d16965d -r 4bfae99c4021 mercurial/scmutil.py --- a/mercurial/scmutil.py Sun Feb 25 23:31:50 2024 +0100 +++ b/mercurial/scmutil.py Tue Mar 05 15:21:18 2024 +0100 @@ -377,14 +377,19 @@ if not result: revs = sorted(r for r in cl.filteredrevs | obsrevs if r <= maxrev) if revs: - s = hashutil.sha1() - for rev in revs: - s.update(b'%d;' % rev) - result = s.digest() + result = _hash_revs(revs) cl._filteredrevs_hashcache[key] = result return result +def _hash_revs(revs): + """return a hash from a list of revision numbers""" + s = hashutil.sha1() + for rev in revs: + s.update(b'%d;' % rev) + return s.digest() + + def walkrepos(path, followsym=False, seen_dirs=None, recurse=False): """yield every hg repository under path, always recursively. The recurse flag will only control recursion into repo working dirs"""