Mercurial > hg
annotate tests/test-win32text @ 5811:180a3eee4b75
Fix copies reporting in log and convert.
If copy logged in file revision, we report copy for changeset only
if file revisions linkrev points back to the changeset in question
or both changeset parents contain different file revisions.
This fixes extra copies reported when executable bit was changed for
previously copied file.
author | Maxim Dounin <mdounin@mdounin.ru> |
---|---|
date | Sat, 29 Dec 2007 17:11:48 +0300 |
parents | 963c516bb38c |
children | f8ad3b76e923 |
rev | line source |
---|---|
5675
a5fe27b83a4a
Issue 882: add standard hook to reject text files with CRLF.
Jesse Glick <jesse.glick@sun.com>
parents:
diff
changeset
|
1 #!/bin/sh |
a5fe27b83a4a
Issue 882: add standard hook to reject text files with CRLF.
Jesse Glick <jesse.glick@sun.com>
parents:
diff
changeset
|
2 |
5680
963c516bb38c
test-win32text: avoid unix2dos, printf extensions
Patrick Mezard <pmezard@gmail.com>
parents:
5675
diff
changeset
|
3 cat > unix2dos.py <<EOF |
963c516bb38c
test-win32text: avoid unix2dos, printf extensions
Patrick Mezard <pmezard@gmail.com>
parents:
5675
diff
changeset
|
4 import sys |
963c516bb38c
test-win32text: avoid unix2dos, printf extensions
Patrick Mezard <pmezard@gmail.com>
parents:
5675
diff
changeset
|
5 |
963c516bb38c
test-win32text: avoid unix2dos, printf extensions
Patrick Mezard <pmezard@gmail.com>
parents:
5675
diff
changeset
|
6 for path in sys.argv[1:]: |
963c516bb38c
test-win32text: avoid unix2dos, printf extensions
Patrick Mezard <pmezard@gmail.com>
parents:
5675
diff
changeset
|
7 data = file(path, 'rb').read() |
963c516bb38c
test-win32text: avoid unix2dos, printf extensions
Patrick Mezard <pmezard@gmail.com>
parents:
5675
diff
changeset
|
8 data = data.replace('\n', '\r\n') |
963c516bb38c
test-win32text: avoid unix2dos, printf extensions
Patrick Mezard <pmezard@gmail.com>
parents:
5675
diff
changeset
|
9 file(path, 'wb').write(data) |
963c516bb38c
test-win32text: avoid unix2dos, printf extensions
Patrick Mezard <pmezard@gmail.com>
parents:
5675
diff
changeset
|
10 EOF |
963c516bb38c
test-win32text: avoid unix2dos, printf extensions
Patrick Mezard <pmezard@gmail.com>
parents:
5675
diff
changeset
|
11 |
5675
a5fe27b83a4a
Issue 882: add standard hook to reject text files with CRLF.
Jesse Glick <jesse.glick@sun.com>
parents:
diff
changeset
|
12 hg init |
a5fe27b83a4a
Issue 882: add standard hook to reject text files with CRLF.
Jesse Glick <jesse.glick@sun.com>
parents:
diff
changeset
|
13 echo '[hooks]' >> .hg/hgrc |
a5fe27b83a4a
Issue 882: add standard hook to reject text files with CRLF.
Jesse Glick <jesse.glick@sun.com>
parents:
diff
changeset
|
14 echo 'pretxncommit.crlf = python:hgext.win32text.forbidcrlf' >> .hg/hgrc |
a5fe27b83a4a
Issue 882: add standard hook to reject text files with CRLF.
Jesse Glick <jesse.glick@sun.com>
parents:
diff
changeset
|
15 echo 'pretxnchangegroup.crlf = python:hgext.win32text.forbidcrlf' >> .hg/hgrc |
a5fe27b83a4a
Issue 882: add standard hook to reject text files with CRLF.
Jesse Glick <jesse.glick@sun.com>
parents:
diff
changeset
|
16 cat .hg/hgrc |
a5fe27b83a4a
Issue 882: add standard hook to reject text files with CRLF.
Jesse Glick <jesse.glick@sun.com>
parents:
diff
changeset
|
17 echo |
a5fe27b83a4a
Issue 882: add standard hook to reject text files with CRLF.
Jesse Glick <jesse.glick@sun.com>
parents:
diff
changeset
|
18 |
a5fe27b83a4a
Issue 882: add standard hook to reject text files with CRLF.
Jesse Glick <jesse.glick@sun.com>
parents:
diff
changeset
|
19 echo hello > f |
a5fe27b83a4a
Issue 882: add standard hook to reject text files with CRLF.
Jesse Glick <jesse.glick@sun.com>
parents:
diff
changeset
|
20 hg add f |
a5fe27b83a4a
Issue 882: add standard hook to reject text files with CRLF.
Jesse Glick <jesse.glick@sun.com>
parents:
diff
changeset
|
21 hg ci -m 1 -d'0 0' |
a5fe27b83a4a
Issue 882: add standard hook to reject text files with CRLF.
Jesse Glick <jesse.glick@sun.com>
parents:
diff
changeset
|
22 echo |
a5fe27b83a4a
Issue 882: add standard hook to reject text files with CRLF.
Jesse Glick <jesse.glick@sun.com>
parents:
diff
changeset
|
23 |
5680
963c516bb38c
test-win32text: avoid unix2dos, printf extensions
Patrick Mezard <pmezard@gmail.com>
parents:
5675
diff
changeset
|
24 python unix2dos.py f |
5675
a5fe27b83a4a
Issue 882: add standard hook to reject text files with CRLF.
Jesse Glick <jesse.glick@sun.com>
parents:
diff
changeset
|
25 hg ci -m 2 -d'0 0' |
a5fe27b83a4a
Issue 882: add standard hook to reject text files with CRLF.
Jesse Glick <jesse.glick@sun.com>
parents:
diff
changeset
|
26 hg revert -a |
a5fe27b83a4a
Issue 882: add standard hook to reject text files with CRLF.
Jesse Glick <jesse.glick@sun.com>
parents:
diff
changeset
|
27 echo |
a5fe27b83a4a
Issue 882: add standard hook to reject text files with CRLF.
Jesse Glick <jesse.glick@sun.com>
parents:
diff
changeset
|
28 |
a5fe27b83a4a
Issue 882: add standard hook to reject text files with CRLF.
Jesse Glick <jesse.glick@sun.com>
parents:
diff
changeset
|
29 mkdir d |
a5fe27b83a4a
Issue 882: add standard hook to reject text files with CRLF.
Jesse Glick <jesse.glick@sun.com>
parents:
diff
changeset
|
30 echo hello > d/f2 |
5680
963c516bb38c
test-win32text: avoid unix2dos, printf extensions
Patrick Mezard <pmezard@gmail.com>
parents:
5675
diff
changeset
|
31 python unix2dos.py d/f2 |
5675
a5fe27b83a4a
Issue 882: add standard hook to reject text files with CRLF.
Jesse Glick <jesse.glick@sun.com>
parents:
diff
changeset
|
32 hg add d/f2 |
a5fe27b83a4a
Issue 882: add standard hook to reject text files with CRLF.
Jesse Glick <jesse.glick@sun.com>
parents:
diff
changeset
|
33 hg ci -m 3 -d'0 0' |
a5fe27b83a4a
Issue 882: add standard hook to reject text files with CRLF.
Jesse Glick <jesse.glick@sun.com>
parents:
diff
changeset
|
34 hg revert -a |
a5fe27b83a4a
Issue 882: add standard hook to reject text files with CRLF.
Jesse Glick <jesse.glick@sun.com>
parents:
diff
changeset
|
35 rm d/f2 |
a5fe27b83a4a
Issue 882: add standard hook to reject text files with CRLF.
Jesse Glick <jesse.glick@sun.com>
parents:
diff
changeset
|
36 echo |
a5fe27b83a4a
Issue 882: add standard hook to reject text files with CRLF.
Jesse Glick <jesse.glick@sun.com>
parents:
diff
changeset
|
37 |
a5fe27b83a4a
Issue 882: add standard hook to reject text files with CRLF.
Jesse Glick <jesse.glick@sun.com>
parents:
diff
changeset
|
38 hg rem f |
a5fe27b83a4a
Issue 882: add standard hook to reject text files with CRLF.
Jesse Glick <jesse.glick@sun.com>
parents:
diff
changeset
|
39 hg ci -m 4 -d'0 0' |
a5fe27b83a4a
Issue 882: add standard hook to reject text files with CRLF.
Jesse Glick <jesse.glick@sun.com>
parents:
diff
changeset
|
40 echo |
a5fe27b83a4a
Issue 882: add standard hook to reject text files with CRLF.
Jesse Glick <jesse.glick@sun.com>
parents:
diff
changeset
|
41 |
5680
963c516bb38c
test-win32text: avoid unix2dos, printf extensions
Patrick Mezard <pmezard@gmail.com>
parents:
5675
diff
changeset
|
42 python -c 'file("bin", "wb").write("hello\x00\x0D\x0A")' |
5675
a5fe27b83a4a
Issue 882: add standard hook to reject text files with CRLF.
Jesse Glick <jesse.glick@sun.com>
parents:
diff
changeset
|
43 hg add bin |
a5fe27b83a4a
Issue 882: add standard hook to reject text files with CRLF.
Jesse Glick <jesse.glick@sun.com>
parents:
diff
changeset
|
44 hg ci -m 5 -d'0 0' |
a5fe27b83a4a
Issue 882: add standard hook to reject text files with CRLF.
Jesse Glick <jesse.glick@sun.com>
parents:
diff
changeset
|
45 hg log -v |
a5fe27b83a4a
Issue 882: add standard hook to reject text files with CRLF.
Jesse Glick <jesse.glick@sun.com>
parents:
diff
changeset
|
46 echo |
a5fe27b83a4a
Issue 882: add standard hook to reject text files with CRLF.
Jesse Glick <jesse.glick@sun.com>
parents:
diff
changeset
|
47 |
a5fe27b83a4a
Issue 882: add standard hook to reject text files with CRLF.
Jesse Glick <jesse.glick@sun.com>
parents:
diff
changeset
|
48 hg clone . dupe |
a5fe27b83a4a
Issue 882: add standard hook to reject text files with CRLF.
Jesse Glick <jesse.glick@sun.com>
parents:
diff
changeset
|
49 echo |
a5fe27b83a4a
Issue 882: add standard hook to reject text files with CRLF.
Jesse Glick <jesse.glick@sun.com>
parents:
diff
changeset
|
50 for x in a b c d; do echo content > dupe/$x; done |
a5fe27b83a4a
Issue 882: add standard hook to reject text files with CRLF.
Jesse Glick <jesse.glick@sun.com>
parents:
diff
changeset
|
51 hg -R dupe add |
5680
963c516bb38c
test-win32text: avoid unix2dos, printf extensions
Patrick Mezard <pmezard@gmail.com>
parents:
5675
diff
changeset
|
52 python unix2dos.py dupe/b dupe/c dupe/d |
5675
a5fe27b83a4a
Issue 882: add standard hook to reject text files with CRLF.
Jesse Glick <jesse.glick@sun.com>
parents:
diff
changeset
|
53 hg -R dupe ci -m a -d'0 0' dupe/a |
a5fe27b83a4a
Issue 882: add standard hook to reject text files with CRLF.
Jesse Glick <jesse.glick@sun.com>
parents:
diff
changeset
|
54 hg -R dupe ci -m b/c -d'0 0' dupe/[bc] |
a5fe27b83a4a
Issue 882: add standard hook to reject text files with CRLF.
Jesse Glick <jesse.glick@sun.com>
parents:
diff
changeset
|
55 hg -R dupe ci -m d -d'0 0' dupe/d |
a5fe27b83a4a
Issue 882: add standard hook to reject text files with CRLF.
Jesse Glick <jesse.glick@sun.com>
parents:
diff
changeset
|
56 hg -R dupe log -v |
a5fe27b83a4a
Issue 882: add standard hook to reject text files with CRLF.
Jesse Glick <jesse.glick@sun.com>
parents:
diff
changeset
|
57 echo |
a5fe27b83a4a
Issue 882: add standard hook to reject text files with CRLF.
Jesse Glick <jesse.glick@sun.com>
parents:
diff
changeset
|
58 |
a5fe27b83a4a
Issue 882: add standard hook to reject text files with CRLF.
Jesse Glick <jesse.glick@sun.com>
parents:
diff
changeset
|
59 hg pull dupe |
a5fe27b83a4a
Issue 882: add standard hook to reject text files with CRLF.
Jesse Glick <jesse.glick@sun.com>
parents:
diff
changeset
|
60 echo |
a5fe27b83a4a
Issue 882: add standard hook to reject text files with CRLF.
Jesse Glick <jesse.glick@sun.com>
parents:
diff
changeset
|
61 |
a5fe27b83a4a
Issue 882: add standard hook to reject text files with CRLF.
Jesse Glick <jesse.glick@sun.com>
parents:
diff
changeset
|
62 hg log -v |
a5fe27b83a4a
Issue 882: add standard hook to reject text files with CRLF.
Jesse Glick <jesse.glick@sun.com>
parents:
diff
changeset
|
63 echo |
a5fe27b83a4a
Issue 882: add standard hook to reject text files with CRLF.
Jesse Glick <jesse.glick@sun.com>
parents:
diff
changeset
|
64 |
a5fe27b83a4a
Issue 882: add standard hook to reject text files with CRLF.
Jesse Glick <jesse.glick@sun.com>
parents:
diff
changeset
|
65 # XXX missing tests for encode/decode hooks |