Mercurial > hg
comparison hgext/eol.py @ 13616:e6f93ca9ce86
eol: make the hook check all new heads, not only tip (issue2666)
Report and test by Antoine Pitrou <solipsis@pitrou.net>
author | Patrick Mezard <pmezard@gmail.com> |
---|---|
date | Sun, 13 Mar 2011 15:07:44 +0100 |
parents | 686dec753b52 |
children | 9cb1a42cd4b3 |
comparison
equal
deleted
inserted
replaced
13615:686dec753b52 | 13616:e6f93ca9ce86 |
---|---|
200 "at %s: %s\n") % (inst.args[1], inst.args[0])) | 200 "at %s: %s\n") % (inst.args[1], inst.args[0])) |
201 return None | 201 return None |
202 | 202 |
203 def hook(ui, repo, node, hooktype, **kwargs): | 203 def hook(ui, repo, node, hooktype, **kwargs): |
204 """verify that files have expected EOLs""" | 204 """verify that files have expected EOLs""" |
205 # Extract heads and get touched files set at the same time | |
205 files = set() | 206 files = set() |
207 heads = set() | |
206 for rev in xrange(repo[node].rev(), len(repo)): | 208 for rev in xrange(repo[node].rev(), len(repo)): |
207 files.update(repo[rev].files()) | 209 ctx = repo[rev] |
208 tip = repo['tip'] | 210 files.update(ctx.files()) |
209 eol = parseeol(ui, repo, [tip.node()]) | 211 heads.add(rev) |
210 if eol: | 212 for pctx in ctx.parents(): |
211 eol.checkrev(repo, tip, files) | 213 heads.discard(pctx.rev()) |
214 for rev in heads: | |
215 ctx = repo[rev] | |
216 eol = parseeol(ui, repo, [ctx.node()]) | |
217 if eol: | |
218 eol.checkrev(repo, ctx, files) | |
212 | 219 |
213 def preupdate(ui, repo, hooktype, parent1, parent2): | 220 def preupdate(ui, repo, hooktype, parent1, parent2): |
214 #print "preupdate for %s: %s -> %s" % (repo.root, parent1, parent2) | 221 #print "preupdate for %s: %s -> %s" % (repo.root, parent1, parent2) |
215 repo.loadeol([parent1]) | 222 repo.loadeol([parent1]) |
216 return False | 223 return False |