Mercurial > public > mercurial-scm > hg-stable
diff hgext/win32text.py @ 8147:441dc7becd43
win32text: be more careful about rejecting violating changesets
We now try to walk changesets in reverse order from newest to oldest,
so that if we see a file multiple times, we treat the newest version
as canonical.
This should prevent us from rejecting a changegroup that contains an
unacceptable commit followed later by a commit that fixes the problem.
author | Bryan O'Sullivan <bos@serpentine.com> |
---|---|
date | Fri, 24 Apr 2009 00:06:01 -0700 |
parents | 36a23a18b999 |
children | bbc24c0753a0 |
line wrap: on
line diff
--- a/hgext/win32text.py Thu Apr 23 15:40:10 2009 -0500 +++ b/hgext/win32text.py Fri Apr 24 00:06:01 2009 -0700 @@ -99,11 +99,19 @@ def forbidnewline(ui, repo, hooktype, node, newline, **kwargs): halt = False - for rev in xrange(repo[node].rev(), len(repo)): + seen = util.set() + # we try to walk changesets in reverse order from newest to + # oldest, so that if we see a file multiple times, we take the + # newest version as canonical. this prevents us from blocking a + # changegroup that contains an unacceptable commit followed later + # by a commit that fixes the problem. + tip = repo['tip'] + for rev in xrange(len(repo)-1, repo[node].rev()-1, -1): c = repo[rev] for f in c.files(): - if f not in c: + if f in seen or f not in tip or f not in c: continue + seen.add(f) data = c[f].data() if not util.binary(data) and newline in data: if not halt: