Commits

Friedrich Kastner-Masilko committed 74fb69b

casestop: simplified casestop extension

Still needed because fold extension is not working with >2.0

  • Participants
  • Parent commits 480e99e

Comments (0)

Files changed (1)

-# casestop.py - defines a hook for stop commiting case-folding
-#               collisions
+# casestop.py - installs a hook to stop commiting case-folding collisions
 #
 # Copyright 2009 Friedrich Kastner-Masilko <face@snoopie.at>
 #
 # This software may be used and distributed according to the terms
 # of the GNU General Public License, incorporated herein by reference.
 
-from mercurial.i18n import _
-from mercurial import util
+from mercurial import merge
 
-def hook(ui, repo, hooktype, parent1=None, parent2=None, **kwargs):
-    '''hook for stop commiting case-folding collisions'''
-    
-    if hooktype != 'precommit':
-        raise util.Abort(_('casestop hook is only allowed for precommit!'))
-    
-    modified, added, removed, deleted, unknown, ignored, clean = [
-        n for n in repo.status(clean=True)]
-    changed = modified + added + clean
-    fslow = {}
-    for f in changed:
-        flow = f.lower()
-        if flow in fslow:
-            raise util.Abort(_("case-folding collision between %s and %s")
-                             % (f, fslow[flow]))
-        fslow[flow] = f
+def hook(ui, repo, *args, **kwargs):
+    '''hook to stop commiting case-folding collisions'''
+    merge._checkcollision(repo[None])
+
+def reposetup(ui, repo):
+    ui.setconfig('hooks', 'precommit.casestop', hook)