Mercurial > hg
changeset 51524:4bfae99c4021
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.
author | Pierre-Yves David <pierre-yves.david@octobus.net> |
---|---|
date | Tue, 05 Mar 2024 15:21:18 +0100 |
parents | ef369d16965d |
children | 530b4cffd6a6 |
files | mercurial/scmutil.py |
diffstat | 1 files changed, 9 insertions(+), 4 deletions(-) [+] |
line wrap: on
line diff
--- 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"""