view tests/test-win32text.out @ 5675:a5fe27b83a4a

Issue 882: add standard hook to reject text files with CRLF. While the win32text extension does LF <-> CRLF conversion, and will issue a warning in case a file already in the repository uses CRLF, it provides no mechanism for verifying that incoming changes use LF. In a large development team with some Windows users, it is virtually guaranteed that someone will forget to set up the encode filter correctly and accidentally check in a file using CRLF, which can cause warnings for other Windows users when they next fetch changes. Since this is a general problem it is desirable to have a pre-commit (or -push) hook available to reject such accidents earlier rather than trying to fix them up after the fact.
author Jesse Glick <jesse.glick@sun.com>
date Wed, 19 Dec 2007 17:02:31 -0500
parents
children 963c516bb38c
line wrap: on
line source

[hooks]
pretxncommit.crlf = python:hgext.win32text.forbidcrlf
pretxnchangegroup.crlf = python:hgext.win32text.forbidcrlf


Attempt to commit or push text file(s) using CRLF line endings
in b1aa5cde7ff4: f
transaction abort!
rollback completed
abort: pretxncommit.crlf hook failed
reverting f

Attempt to commit or push text file(s) using CRLF line endings
in 88b17af74937: d/f2
transaction abort!
rollback completed
abort: pretxncommit.crlf hook failed
forgetting d/f2


changeset:   2:a55cab36df04
tag:         tip
user:        test
date:        Thu Jan 01 00:00:00 1970 +0000
files:       bin
description:
5


changeset:   1:c72a7d1d0907
user:        test
date:        Thu Jan 01 00:00:00 1970 +0000
files:       f
description:
4


changeset:   0:fcf06d5c4e1d
user:        test
date:        Thu Jan 01 00:00:00 1970 +0000
files:       f
description:
1



1 files updated, 0 files merged, 0 files removed, 0 files unresolved

adding dupe/a
adding dupe/b
adding dupe/c
adding dupe/d
changeset:   5:81c49ee61396
tag:         tip
user:        test
date:        Thu Jan 01 00:00:00 1970 +0000
files:       d
description:
d


changeset:   4:02184785bcac
user:        test
date:        Thu Jan 01 00:00:00 1970 +0000
files:       b c
description:
b/c


changeset:   3:36e70ffe2c3d
user:        test
date:        Thu Jan 01 00:00:00 1970 +0000
files:       a
description:
a


changeset:   2:a55cab36df04
user:        test
date:        Thu Jan 01 00:00:00 1970 +0000
files:       bin
description:
5


changeset:   1:c72a7d1d0907
user:        test
date:        Thu Jan 01 00:00:00 1970 +0000
files:       f
description:
4


changeset:   0:fcf06d5c4e1d
user:        test
date:        Thu Jan 01 00:00:00 1970 +0000
files:       f
description:
1



pulling from dupe
searching for changes
adding changesets
adding manifests
adding file changes
added 3 changesets with 4 changes to 4 files
Attempt to commit or push text file(s) using CRLF line endings
in 02184785bcac: b
in 02184785bcac: c
in 81c49ee61396: d

To prevent this mistake in your local repository,
add to Mercurial.ini or .hg/hgrc:

[hooks]
pretxncommit.crlf = python:hgext.win32text.forbidcrlf

and also consider adding:

[extensions]
hgext.win32text =
[encode]
** = cleverencode:
[decode]
** = cleverdecode:
transaction abort!
rollback completed
abort: pretxnchangegroup.crlf hook failed

changeset:   2:a55cab36df04
tag:         tip
user:        test
date:        Thu Jan 01 00:00:00 1970 +0000
files:       bin
description:
5


changeset:   1:c72a7d1d0907
user:        test
date:        Thu Jan 01 00:00:00 1970 +0000
files:       f
description:
4


changeset:   0:fcf06d5c4e1d
user:        test
date:        Thu Jan 01 00:00:00 1970 +0000
files:       f
description:
1