annotate tests/test-purge @ 12252:4481f8a93c7a stable

convert/darcs: handle non-ASCII metadata in darcs changelog (issue2354) Given a commit author or message with non-ASCII characters in a darcs repo, convert would raise a UnicodeEncodeError when adding changesets to the hg changelog. This happened because etree returns back unicode objects for any text it can't encode into ASCII. convert was passing these objects to changelog.add(), which would then attempt encoding.fromlocal() on them. This patch ensures converter_source.recode() is called on each piece of commit data returned by etree. (Also note that darcs is currently encoding agnostic and will print out whatever is in a patch's metadata byte-for-byte, even in the XML changelog.)
author Brodie Rao <brodie@bitheap.org>
date Fri, 10 Sep 2010 09:30:50 -0500
parents bb5ea66789e3
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
4145
2ebdd33fe456 Add a test for the purge extension
Emanuele Aina <faina.mail@tiscali.it>
parents:
diff changeset
1 #!/bin/sh
2ebdd33fe456 Add a test for the purge extension
Emanuele Aina <faina.mail@tiscali.it>
parents:
diff changeset
2
2ebdd33fe456 Add a test for the purge extension
Emanuele Aina <faina.mail@tiscali.it>
parents:
diff changeset
3 cat <<EOF >> $HGRCPATH
2ebdd33fe456 Add a test for the purge extension
Emanuele Aina <faina.mail@tiscali.it>
parents:
diff changeset
4 [extensions]
10119
bb5ea66789e3 tests: load with "ext =" instead of "hgext.ext ="
Martin Geisler <mg@lazybytes.net>
parents: 8044
diff changeset
5 purge =
4145
2ebdd33fe456 Add a test for the purge extension
Emanuele Aina <faina.mail@tiscali.it>
parents:
diff changeset
6 EOF
2ebdd33fe456 Add a test for the purge extension
Emanuele Aina <faina.mail@tiscali.it>
parents:
diff changeset
7
2ebdd33fe456 Add a test for the purge extension
Emanuele Aina <faina.mail@tiscali.it>
parents:
diff changeset
8 echo % init
2ebdd33fe456 Add a test for the purge extension
Emanuele Aina <faina.mail@tiscali.it>
parents:
diff changeset
9 hg init t
2ebdd33fe456 Add a test for the purge extension
Emanuele Aina <faina.mail@tiscali.it>
parents:
diff changeset
10 cd t
2ebdd33fe456 Add a test for the purge extension
Emanuele Aina <faina.mail@tiscali.it>
parents:
diff changeset
11
2ebdd33fe456 Add a test for the purge extension
Emanuele Aina <faina.mail@tiscali.it>
parents:
diff changeset
12 echo % setup
2ebdd33fe456 Add a test for the purge extension
Emanuele Aina <faina.mail@tiscali.it>
parents:
diff changeset
13 echo r1 > r1
2ebdd33fe456 Add a test for the purge extension
Emanuele Aina <faina.mail@tiscali.it>
parents:
diff changeset
14 hg ci -qAmr1 -d'0 0'
2ebdd33fe456 Add a test for the purge extension
Emanuele Aina <faina.mail@tiscali.it>
parents:
diff changeset
15 mkdir directory
2ebdd33fe456 Add a test for the purge extension
Emanuele Aina <faina.mail@tiscali.it>
parents:
diff changeset
16 echo r2 > directory/r2
2ebdd33fe456 Add a test for the purge extension
Emanuele Aina <faina.mail@tiscali.it>
parents:
diff changeset
17 hg ci -qAmr2 -d'1 0'
2ebdd33fe456 Add a test for the purge extension
Emanuele Aina <faina.mail@tiscali.it>
parents:
diff changeset
18 echo 'ignored' > .hgignore
2ebdd33fe456 Add a test for the purge extension
Emanuele Aina <faina.mail@tiscali.it>
parents:
diff changeset
19 hg ci -qAmr3 -d'2 0'
2ebdd33fe456 Add a test for the purge extension
Emanuele Aina <faina.mail@tiscali.it>
parents:
diff changeset
20
2ebdd33fe456 Add a test for the purge extension
Emanuele Aina <faina.mail@tiscali.it>
parents:
diff changeset
21 echo % delete an empty directory
2ebdd33fe456 Add a test for the purge extension
Emanuele Aina <faina.mail@tiscali.it>
parents:
diff changeset
22 mkdir empty_dir
2ebdd33fe456 Add a test for the purge extension
Emanuele Aina <faina.mail@tiscali.it>
parents:
diff changeset
23 hg purge -p
2ebdd33fe456 Add a test for the purge extension
Emanuele Aina <faina.mail@tiscali.it>
parents:
diff changeset
24 hg purge -v
2ebdd33fe456 Add a test for the purge extension
Emanuele Aina <faina.mail@tiscali.it>
parents:
diff changeset
25 ls
2ebdd33fe456 Add a test for the purge extension
Emanuele Aina <faina.mail@tiscali.it>
parents:
diff changeset
26
2ebdd33fe456 Add a test for the purge extension
Emanuele Aina <faina.mail@tiscali.it>
parents:
diff changeset
27 echo % delete an untracked directory
2ebdd33fe456 Add a test for the purge extension
Emanuele Aina <faina.mail@tiscali.it>
parents:
diff changeset
28 mkdir untracked_dir
2ebdd33fe456 Add a test for the purge extension
Emanuele Aina <faina.mail@tiscali.it>
parents:
diff changeset
29 touch untracked_dir/untracked_file1
2ebdd33fe456 Add a test for the purge extension
Emanuele Aina <faina.mail@tiscali.it>
parents:
diff changeset
30 touch untracked_dir/untracked_file2
2ebdd33fe456 Add a test for the purge extension
Emanuele Aina <faina.mail@tiscali.it>
parents:
diff changeset
31 hg purge -p
2ebdd33fe456 Add a test for the purge extension
Emanuele Aina <faina.mail@tiscali.it>
parents:
diff changeset
32 hg purge -v
2ebdd33fe456 Add a test for the purge extension
Emanuele Aina <faina.mail@tiscali.it>
parents:
diff changeset
33 ls
2ebdd33fe456 Add a test for the purge extension
Emanuele Aina <faina.mail@tiscali.it>
parents:
diff changeset
34
2ebdd33fe456 Add a test for the purge extension
Emanuele Aina <faina.mail@tiscali.it>
parents:
diff changeset
35 echo % delete an untracked file
2ebdd33fe456 Add a test for the purge extension
Emanuele Aina <faina.mail@tiscali.it>
parents:
diff changeset
36 touch untracked_file
8043
b777dd8f7836 purge: remove read-only files under Windows (issue583)
Patrick Mezard <pmezard@gmail.com>
parents: 6757
diff changeset
37 touch untracked_file_readonly
b777dd8f7836 purge: remove read-only files under Windows (issue583)
Patrick Mezard <pmezard@gmail.com>
parents: 6757
diff changeset
38 python <<EOF
b777dd8f7836 purge: remove read-only files under Windows (issue583)
Patrick Mezard <pmezard@gmail.com>
parents: 6757
diff changeset
39 import os, stat
b777dd8f7836 purge: remove read-only files under Windows (issue583)
Patrick Mezard <pmezard@gmail.com>
parents: 6757
diff changeset
40 f= 'untracked_file_readonly'
8044
c1e2b7407dc3 purge: fix b777dd8f7836 (remove read-only files)
Patrick Mezard <pmezard@gmail.com>
parents: 8043
diff changeset
41 os.chmod(f, stat.S_IMODE(os.stat(f).st_mode) & ~stat.S_IWRITE)
8043
b777dd8f7836 purge: remove read-only files under Windows (issue583)
Patrick Mezard <pmezard@gmail.com>
parents: 6757
diff changeset
42 EOF
4145
2ebdd33fe456 Add a test for the purge extension
Emanuele Aina <faina.mail@tiscali.it>
parents:
diff changeset
43 hg purge -p
2ebdd33fe456 Add a test for the purge extension
Emanuele Aina <faina.mail@tiscali.it>
parents:
diff changeset
44 hg purge -v
2ebdd33fe456 Add a test for the purge extension
Emanuele Aina <faina.mail@tiscali.it>
parents:
diff changeset
45 ls
2ebdd33fe456 Add a test for the purge extension
Emanuele Aina <faina.mail@tiscali.it>
parents:
diff changeset
46
2ebdd33fe456 Add a test for the purge extension
Emanuele Aina <faina.mail@tiscali.it>
parents:
diff changeset
47 echo % delete an untracked file in a tracked directory
2ebdd33fe456 Add a test for the purge extension
Emanuele Aina <faina.mail@tiscali.it>
parents:
diff changeset
48 touch directory/untracked_file
2ebdd33fe456 Add a test for the purge extension
Emanuele Aina <faina.mail@tiscali.it>
parents:
diff changeset
49 hg purge -p
2ebdd33fe456 Add a test for the purge extension
Emanuele Aina <faina.mail@tiscali.it>
parents:
diff changeset
50 hg purge -v
2ebdd33fe456 Add a test for the purge extension
Emanuele Aina <faina.mail@tiscali.it>
parents:
diff changeset
51 ls
2ebdd33fe456 Add a test for the purge extension
Emanuele Aina <faina.mail@tiscali.it>
parents:
diff changeset
52
2ebdd33fe456 Add a test for the purge extension
Emanuele Aina <faina.mail@tiscali.it>
parents:
diff changeset
53 echo % delete nested directories
2ebdd33fe456 Add a test for the purge extension
Emanuele Aina <faina.mail@tiscali.it>
parents:
diff changeset
54 mkdir -p untracked_directory/nested_directory
2ebdd33fe456 Add a test for the purge extension
Emanuele Aina <faina.mail@tiscali.it>
parents:
diff changeset
55 hg purge -p
2ebdd33fe456 Add a test for the purge extension
Emanuele Aina <faina.mail@tiscali.it>
parents:
diff changeset
56 hg purge -v
2ebdd33fe456 Add a test for the purge extension
Emanuele Aina <faina.mail@tiscali.it>
parents:
diff changeset
57 ls
2ebdd33fe456 Add a test for the purge extension
Emanuele Aina <faina.mail@tiscali.it>
parents:
diff changeset
58
4155
4c714ed245d6 purge.py: fix invocation of statwalk
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents: 4145
diff changeset
59 echo % delete nested directories from a subdir
4c714ed245d6 purge.py: fix invocation of statwalk
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents: 4145
diff changeset
60 mkdir -p untracked_directory/nested_directory
4c714ed245d6 purge.py: fix invocation of statwalk
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents: 4145
diff changeset
61 cd directory
4c714ed245d6 purge.py: fix invocation of statwalk
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents: 4145
diff changeset
62 hg purge -p
4c714ed245d6 purge.py: fix invocation of statwalk
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents: 4145
diff changeset
63 hg purge -v
4c714ed245d6 purge.py: fix invocation of statwalk
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents: 4145
diff changeset
64 cd ..
4c714ed245d6 purge.py: fix invocation of statwalk
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents: 4145
diff changeset
65 ls
4c714ed245d6 purge.py: fix invocation of statwalk
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents: 4145
diff changeset
66
4c714ed245d6 purge.py: fix invocation of statwalk
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents: 4145
diff changeset
67 echo % delete only part of the tree
4c714ed245d6 purge.py: fix invocation of statwalk
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents: 4145
diff changeset
68 mkdir -p untracked_directory/nested_directory
4c714ed245d6 purge.py: fix invocation of statwalk
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents: 4145
diff changeset
69 touch directory/untracked_file
4c714ed245d6 purge.py: fix invocation of statwalk
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents: 4145
diff changeset
70 cd directory
4c714ed245d6 purge.py: fix invocation of statwalk
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents: 4145
diff changeset
71 hg purge -p ../untracked_directory
4c714ed245d6 purge.py: fix invocation of statwalk
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents: 4145
diff changeset
72 hg purge -v ../untracked_directory
4c714ed245d6 purge.py: fix invocation of statwalk
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents: 4145
diff changeset
73 cd ..
4c714ed245d6 purge.py: fix invocation of statwalk
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents: 4145
diff changeset
74 ls
4c714ed245d6 purge.py: fix invocation of statwalk
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents: 4145
diff changeset
75 ls directory/untracked_file
4c714ed245d6 purge.py: fix invocation of statwalk
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents: 4145
diff changeset
76 rm directory/untracked_file
4c714ed245d6 purge.py: fix invocation of statwalk
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents: 4145
diff changeset
77
4691
ca4971347e0a purge: don't delete ignored files if --all is not specified
Emanuele Aina <em@nerd.ocracy.org>
parents: 4463
diff changeset
78 echo % skip ignored files if --all not specified
4145
2ebdd33fe456 Add a test for the purge extension
Emanuele Aina <faina.mail@tiscali.it>
parents:
diff changeset
79 touch ignored
2ebdd33fe456 Add a test for the purge extension
Emanuele Aina <faina.mail@tiscali.it>
parents:
diff changeset
80 hg purge -p
2ebdd33fe456 Add a test for the purge extension
Emanuele Aina <faina.mail@tiscali.it>
parents:
diff changeset
81 hg purge -v
2ebdd33fe456 Add a test for the purge extension
Emanuele Aina <faina.mail@tiscali.it>
parents:
diff changeset
82 ls
4691
ca4971347e0a purge: don't delete ignored files if --all is not specified
Emanuele Aina <em@nerd.ocracy.org>
parents: 4463
diff changeset
83 hg purge -p --all
ca4971347e0a purge: don't delete ignored files if --all is not specified
Emanuele Aina <em@nerd.ocracy.org>
parents: 4463
diff changeset
84 hg purge -v --all
ca4971347e0a purge: don't delete ignored files if --all is not specified
Emanuele Aina <em@nerd.ocracy.org>
parents: 4463
diff changeset
85 ls
4310
c8919eb0f315 purge: abort with missing files avoiding problems with name-mangling fs
Emanuele Aina <em@nerd.ocracy.org>
parents: 4155
diff changeset
86
c8919eb0f315 purge: abort with missing files avoiding problems with name-mangling fs
Emanuele Aina <em@nerd.ocracy.org>
parents: 4155
diff changeset
87 echo % abort with missing files until we support name mangling filesystems
c8919eb0f315 purge: abort with missing files avoiding problems with name-mangling fs
Emanuele Aina <em@nerd.ocracy.org>
parents: 4155
diff changeset
88 touch untracked_file
c8919eb0f315 purge: abort with missing files avoiding problems with name-mangling fs
Emanuele Aina <em@nerd.ocracy.org>
parents: 4155
diff changeset
89 rm r1
c8919eb0f315 purge: abort with missing files avoiding problems with name-mangling fs
Emanuele Aina <em@nerd.ocracy.org>
parents: 4155
diff changeset
90 # hide error messages to avoid changing the output when the text changes
c8919eb0f315 purge: abort with missing files avoiding problems with name-mangling fs
Emanuele Aina <em@nerd.ocracy.org>
parents: 4155
diff changeset
91 hg purge -p 2> /dev/null
6757
55c71226eceb purge: cleanup
Matt Mackall <mpm@selenic.com>
parents: 5517
diff changeset
92 hg st
55c71226eceb purge: cleanup
Matt Mackall <mpm@selenic.com>
parents: 5517
diff changeset
93
55c71226eceb purge: cleanup
Matt Mackall <mpm@selenic.com>
parents: 5517
diff changeset
94 hg purge -p
4310
c8919eb0f315 purge: abort with missing files avoiding problems with name-mangling fs
Emanuele Aina <em@nerd.ocracy.org>
parents: 4155
diff changeset
95 hg purge -v 2> /dev/null
6757
55c71226eceb purge: cleanup
Matt Mackall <mpm@selenic.com>
parents: 5517
diff changeset
96 hg st
55c71226eceb purge: cleanup
Matt Mackall <mpm@selenic.com>
parents: 5517
diff changeset
97
55c71226eceb purge: cleanup
Matt Mackall <mpm@selenic.com>
parents: 5517
diff changeset
98 hg purge -v
4310
c8919eb0f315 purge: abort with missing files avoiding problems with name-mangling fs
Emanuele Aina <em@nerd.ocracy.org>
parents: 4155
diff changeset
99 hg revert --all --quiet
6757
55c71226eceb purge: cleanup
Matt Mackall <mpm@selenic.com>
parents: 5517
diff changeset
100 hg st -a
4463
a73cf208b2a0 purge: add --include and --exclude options
Emanuele Aina <em@nerd.ocracy.org>
parents: 4311
diff changeset
101
5517
98d5f9b95699 purge: simplify safety net for case mangling filesystems
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents: 4691
diff changeset
102 echo '% tracked file in ignored directory (issue621)'
98d5f9b95699 purge: simplify safety net for case mangling filesystems
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents: 4691
diff changeset
103 echo directory >> .hgignore
98d5f9b95699 purge: simplify safety net for case mangling filesystems
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents: 4691
diff changeset
104 hg ci -m 'ignore directory'
98d5f9b95699 purge: simplify safety net for case mangling filesystems
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents: 4691
diff changeset
105 touch untracked_file
98d5f9b95699 purge: simplify safety net for case mangling filesystems
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents: 4691
diff changeset
106 hg purge -p
98d5f9b95699 purge: simplify safety net for case mangling filesystems
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents: 4691
diff changeset
107 hg purge -v
98d5f9b95699 purge: simplify safety net for case mangling filesystems
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents: 4691
diff changeset
108
4463
a73cf208b2a0 purge: add --include and --exclude options
Emanuele Aina <em@nerd.ocracy.org>
parents: 4311
diff changeset
109 echo % skip excluded files
a73cf208b2a0 purge: add --include and --exclude options
Emanuele Aina <em@nerd.ocracy.org>
parents: 4311
diff changeset
110 touch excluded_file
a73cf208b2a0 purge: add --include and --exclude options
Emanuele Aina <em@nerd.ocracy.org>
parents: 4311
diff changeset
111 hg purge -p -X excluded_file
a73cf208b2a0 purge: add --include and --exclude options
Emanuele Aina <em@nerd.ocracy.org>
parents: 4311
diff changeset
112 hg purge -v -X excluded_file
a73cf208b2a0 purge: add --include and --exclude options
Emanuele Aina <em@nerd.ocracy.org>
parents: 4311
diff changeset
113 ls
a73cf208b2a0 purge: add --include and --exclude options
Emanuele Aina <em@nerd.ocracy.org>
parents: 4311
diff changeset
114 rm excluded_file
a73cf208b2a0 purge: add --include and --exclude options
Emanuele Aina <em@nerd.ocracy.org>
parents: 4311
diff changeset
115
a73cf208b2a0 purge: add --include and --exclude options
Emanuele Aina <em@nerd.ocracy.org>
parents: 4311
diff changeset
116 echo % skip files in excluded dirs
a73cf208b2a0 purge: add --include and --exclude options
Emanuele Aina <em@nerd.ocracy.org>
parents: 4311
diff changeset
117 mkdir excluded_dir
a73cf208b2a0 purge: add --include and --exclude options
Emanuele Aina <em@nerd.ocracy.org>
parents: 4311
diff changeset
118 touch excluded_dir/file
a73cf208b2a0 purge: add --include and --exclude options
Emanuele Aina <em@nerd.ocracy.org>
parents: 4311
diff changeset
119 hg purge -p -X excluded_dir
a73cf208b2a0 purge: add --include and --exclude options
Emanuele Aina <em@nerd.ocracy.org>
parents: 4311
diff changeset
120 hg purge -v -X excluded_dir
a73cf208b2a0 purge: add --include and --exclude options
Emanuele Aina <em@nerd.ocracy.org>
parents: 4311
diff changeset
121 ls
a73cf208b2a0 purge: add --include and --exclude options
Emanuele Aina <em@nerd.ocracy.org>
parents: 4311
diff changeset
122 ls excluded_dir
a73cf208b2a0 purge: add --include and --exclude options
Emanuele Aina <em@nerd.ocracy.org>
parents: 4311
diff changeset
123 rm -R excluded_dir
a73cf208b2a0 purge: add --include and --exclude options
Emanuele Aina <em@nerd.ocracy.org>
parents: 4311
diff changeset
124
a73cf208b2a0 purge: add --include and --exclude options
Emanuele Aina <em@nerd.ocracy.org>
parents: 4311
diff changeset
125 echo % skip excluded empty dirs
a73cf208b2a0 purge: add --include and --exclude options
Emanuele Aina <em@nerd.ocracy.org>
parents: 4311
diff changeset
126 mkdir excluded_dir
a73cf208b2a0 purge: add --include and --exclude options
Emanuele Aina <em@nerd.ocracy.org>
parents: 4311
diff changeset
127 hg purge -p -X excluded_dir
a73cf208b2a0 purge: add --include and --exclude options
Emanuele Aina <em@nerd.ocracy.org>
parents: 4311
diff changeset
128 hg purge -v -X excluded_dir
a73cf208b2a0 purge: add --include and --exclude options
Emanuele Aina <em@nerd.ocracy.org>
parents: 4311
diff changeset
129 ls
a73cf208b2a0 purge: add --include and --exclude options
Emanuele Aina <em@nerd.ocracy.org>
parents: 4311
diff changeset
130 rmdir excluded_dir
a73cf208b2a0 purge: add --include and --exclude options
Emanuele Aina <em@nerd.ocracy.org>
parents: 4311
diff changeset
131
a73cf208b2a0 purge: add --include and --exclude options
Emanuele Aina <em@nerd.ocracy.org>
parents: 4311
diff changeset
132 echo % skip patterns
a73cf208b2a0 purge: add --include and --exclude options
Emanuele Aina <em@nerd.ocracy.org>
parents: 4311
diff changeset
133 mkdir .svn
a73cf208b2a0 purge: add --include and --exclude options
Emanuele Aina <em@nerd.ocracy.org>
parents: 4311
diff changeset
134 touch .svn/foo
a73cf208b2a0 purge: add --include and --exclude options
Emanuele Aina <em@nerd.ocracy.org>
parents: 4311
diff changeset
135 mkdir directory/.svn
a73cf208b2a0 purge: add --include and --exclude options
Emanuele Aina <em@nerd.ocracy.org>
parents: 4311
diff changeset
136 touch directory/.svn/foo
a73cf208b2a0 purge: add --include and --exclude options
Emanuele Aina <em@nerd.ocracy.org>
parents: 4311
diff changeset
137 hg purge -p -X .svn -X '*/.svn'
a73cf208b2a0 purge: add --include and --exclude options
Emanuele Aina <em@nerd.ocracy.org>
parents: 4311
diff changeset
138 hg purge -p -X re:.*.svn