##// END OF EJS Templates
py3: add a test to show `hg diff` works on Python 3
Pulkit Goyal -
r32644:01a95cbb default
parent child Browse files
Show More
@@ -1,217 +1,224
1 #require py3exe
1 #require py3exe
2
2
3 This test helps in keeping a track on which commands we can run on
3 This test helps in keeping a track on which commands we can run on
4 Python 3 and see what kind of errors are coming up.
4 Python 3 and see what kind of errors are coming up.
5 The full traceback is hidden to have a stable output.
5 The full traceback is hidden to have a stable output.
6 $ HGBIN=`which hg`
6 $ HGBIN=`which hg`
7
7
8 $ for cmd in version debuginstall ; do
8 $ for cmd in version debuginstall ; do
9 > echo $cmd
9 > echo $cmd
10 > $PYTHON3 $HGBIN $cmd 2>&1 2>&1 | tail -1
10 > $PYTHON3 $HGBIN $cmd 2>&1 2>&1 | tail -1
11 > done
11 > done
12 version
12 version
13 warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
13 warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
14 debuginstall
14 debuginstall
15 no problems detected
15 no problems detected
16
16
17 #if test-repo
17 #if test-repo
18 Make a clone so that any features in the developer's .hg/hgrc that
18 Make a clone so that any features in the developer's .hg/hgrc that
19 might confuse Python 3 don't break this test. When we can do commit in
19 might confuse Python 3 don't break this test. When we can do commit in
20 Python 3, we'll stop doing this. We use e76ed1e480ef for the clone
20 Python 3, we'll stop doing this. We use e76ed1e480ef for the clone
21 because it has different files than 273ce12ad8f1, so we can test both
21 because it has different files than 273ce12ad8f1, so we can test both
22 `files` from dirstate and `files` loaded from a specific revision.
22 `files` from dirstate and `files` loaded from a specific revision.
23
23
24 $ hg clone -r e76ed1e480ef "`dirname "$TESTDIR"`" testrepo 2>&1 | tail -1
24 $ hg clone -r e76ed1e480ef "`dirname "$TESTDIR"`" testrepo 2>&1 | tail -1
25 15 files updated, 0 files merged, 0 files removed, 0 files unresolved
25 15 files updated, 0 files merged, 0 files removed, 0 files unresolved
26
26
27 Test using -R, which exercises some URL code:
27 Test using -R, which exercises some URL code:
28 $ $PYTHON3 $HGBIN -R testrepo files -r 273ce12ad8f1 | tail -1
28 $ $PYTHON3 $HGBIN -R testrepo files -r 273ce12ad8f1 | tail -1
29 testrepo/tkmerge
29 testrepo/tkmerge
30
30
31 Now prove `hg files` is reading the whole manifest. We have to grep
31 Now prove `hg files` is reading the whole manifest. We have to grep
32 out some potential warnings that come from hgrc as yet.
32 out some potential warnings that come from hgrc as yet.
33 $ cd testrepo
33 $ cd testrepo
34 $ $PYTHON3 $HGBIN files -r 273ce12ad8f1
34 $ $PYTHON3 $HGBIN files -r 273ce12ad8f1
35 .hgignore
35 .hgignore
36 PKG-INFO
36 PKG-INFO
37 README
37 README
38 hg
38 hg
39 mercurial/__init__.py
39 mercurial/__init__.py
40 mercurial/byterange.py
40 mercurial/byterange.py
41 mercurial/fancyopts.py
41 mercurial/fancyopts.py
42 mercurial/hg.py
42 mercurial/hg.py
43 mercurial/mdiff.py
43 mercurial/mdiff.py
44 mercurial/revlog.py
44 mercurial/revlog.py
45 mercurial/transaction.py
45 mercurial/transaction.py
46 notes.txt
46 notes.txt
47 setup.py
47 setup.py
48 tkmerge
48 tkmerge
49
49
50 $ $PYTHON3 $HGBIN files -r 273ce12ad8f1 | wc -l
50 $ $PYTHON3 $HGBIN files -r 273ce12ad8f1 | wc -l
51 \s*14 (re)
51 \s*14 (re)
52 $ $PYTHON3 $HGBIN files | wc -l
52 $ $PYTHON3 $HGBIN files | wc -l
53 \s*15 (re)
53 \s*15 (re)
54
54
55 Test if log-like commands work:
55 Test if log-like commands work:
56
56
57 $ $PYTHON3 $HGBIN tip
57 $ $PYTHON3 $HGBIN tip
58 changeset: 10:e76ed1e480ef
58 changeset: 10:e76ed1e480ef
59 tag: tip
59 tag: tip
60 user: oxymoron@cinder.waste.org
60 user: oxymoron@cinder.waste.org
61 date: Tue May 03 23:37:43 2005 -0800
61 date: Tue May 03 23:37:43 2005 -0800
62 summary: Fix linking of changeset revs when merging
62 summary: Fix linking of changeset revs when merging
63
63
64
64
65 $ $PYTHON3 $HGBIN log -r0
65 $ $PYTHON3 $HGBIN log -r0
66 changeset: 0:9117c6561b0b
66 changeset: 0:9117c6561b0b
67 user: mpm@selenic.com
67 user: mpm@selenic.com
68 date: Tue May 03 13:16:10 2005 -0800
68 date: Tue May 03 13:16:10 2005 -0800
69 summary: Add back links from file revisions to changeset revisions
69 summary: Add back links from file revisions to changeset revisions
70
70
71
71
72 $ cd ..
72 $ cd ..
73 #endif
73 #endif
74
74
75 Test if `hg config` works:
75 Test if `hg config` works:
76
76
77 $ $PYTHON3 $HGBIN config
77 $ $PYTHON3 $HGBIN config
78 devel.all-warnings=true
78 devel.all-warnings=true
79 devel.default-date=0 0
79 devel.default-date=0 0
80 largefiles.usercache=$TESTTMP/.cache/largefiles
80 largefiles.usercache=$TESTTMP/.cache/largefiles
81 ui.slash=True
81 ui.slash=True
82 ui.interactive=False
82 ui.interactive=False
83 ui.mergemarkers=detailed
83 ui.mergemarkers=detailed
84 ui.promptecho=True
84 ui.promptecho=True
85 web.address=localhost
85 web.address=localhost
86 web.ipv6=False
86 web.ipv6=False
87
87
88 $ cat > included-hgrc <<EOF
88 $ cat > included-hgrc <<EOF
89 > [extensions]
89 > [extensions]
90 > babar = imaginary_elephant
90 > babar = imaginary_elephant
91 > EOF
91 > EOF
92 $ cat >> $HGRCPATH <<EOF
92 $ cat >> $HGRCPATH <<EOF
93 > %include $TESTTMP/included-hgrc
93 > %include $TESTTMP/included-hgrc
94 > EOF
94 > EOF
95 $ $PYTHON3 $HGBIN version | tail -1
95 $ $PYTHON3 $HGBIN version | tail -1
96 *** failed to import extension babar from imaginary_elephant: *: 'imaginary_elephant' (glob)
96 *** failed to import extension babar from imaginary_elephant: *: 'imaginary_elephant' (glob)
97 warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
97 warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
98
98
99 $ rm included-hgrc
99 $ rm included-hgrc
100 $ touch included-hgrc
100 $ touch included-hgrc
101
101
102 Test bytes-ness of policy.policy with HGMODULEPOLICY
102 Test bytes-ness of policy.policy with HGMODULEPOLICY
103
103
104 $ HGMODULEPOLICY=py
104 $ HGMODULEPOLICY=py
105 $ export HGMODULEPOLICY
105 $ export HGMODULEPOLICY
106 $ $PYTHON3 `which hg` debuginstall 2>&1 2>&1 | tail -1
106 $ $PYTHON3 `which hg` debuginstall 2>&1 2>&1 | tail -1
107 no problems detected
107 no problems detected
108
108
109 `hg init` can create empty repos
109 `hg init` can create empty repos
110 `hg status works fine`
110 `hg status works fine`
111 `hg summary` also works!
111 `hg summary` also works!
112
112
113 $ $PYTHON3 `which hg` init py3repo
113 $ $PYTHON3 `which hg` init py3repo
114 $ cd py3repo
114 $ cd py3repo
115 $ echo "This is the file 'iota'." > iota
115 $ echo "This is the file 'iota'." > iota
116 $ $PYTHON3 $HGBIN status
116 $ $PYTHON3 $HGBIN status
117 ? iota
117 ? iota
118 $ $PYTHON3 $HGBIN add iota
118 $ $PYTHON3 $HGBIN add iota
119 $ $PYTHON3 $HGBIN status
119 $ $PYTHON3 $HGBIN status
120 A iota
120 A iota
121 $ hg diff --nodates --git
122 diff --git a/iota b/iota
123 new file mode 100644
124 --- /dev/null
125 +++ b/iota
126 @@ -0,0 +1,1 @@
127 +This is the file 'iota'.
121 $ $PYTHON3 $HGBIN commit --message 'commit performed in Python 3'
128 $ $PYTHON3 $HGBIN commit --message 'commit performed in Python 3'
122 $ $PYTHON3 $HGBIN status
129 $ $PYTHON3 $HGBIN status
123
130
124 $ mkdir A
131 $ mkdir A
125 $ echo "This is the file 'mu'." > A/mu
132 $ echo "This is the file 'mu'." > A/mu
126 $ $PYTHON3 $HGBIN addremove
133 $ $PYTHON3 $HGBIN addremove
127 adding A/mu
134 adding A/mu
128 $ $PYTHON3 $HGBIN status
135 $ $PYTHON3 $HGBIN status
129 A A/mu
136 A A/mu
130 $ HGEDITOR='echo message > ' $PYTHON3 $HGBIN commit
137 $ HGEDITOR='echo message > ' $PYTHON3 $HGBIN commit
131 $ $PYTHON3 $HGBIN status
138 $ $PYTHON3 $HGBIN status
132 $ $PYHON3 $HGBIN summary
139 $ $PYHON3 $HGBIN summary
133 parent: 1:e1e9167203d4 tip
140 parent: 1:e1e9167203d4 tip
134 message
141 message
135 branch: default
142 branch: default
136 commit: (clean)
143 commit: (clean)
137 update: (current)
144 update: (current)
138 phases: 2 draft
145 phases: 2 draft
139
146
140 Test weird unicode-vs-bytes stuff
147 Test weird unicode-vs-bytes stuff
141
148
142 $ $PYTHON3 $HGBIN help | egrep -v '^ |^$'
149 $ $PYTHON3 $HGBIN help | egrep -v '^ |^$'
143 Mercurial Distributed SCM
150 Mercurial Distributed SCM
144 list of commands:
151 list of commands:
145 additional help topics:
152 additional help topics:
146 (use 'hg help -v' to show built-in aliases and global options)
153 (use 'hg help -v' to show built-in aliases and global options)
147
154
148 $ $PYTHON3 $HGBIN help help | egrep -v '^ |^$'
155 $ $PYTHON3 $HGBIN help help | egrep -v '^ |^$'
149 hg help [-ecks] [TOPIC]
156 hg help [-ecks] [TOPIC]
150 show help for a given topic or a help overview
157 show help for a given topic or a help overview
151 options ([+] can be repeated):
158 options ([+] can be repeated):
152 (some details hidden, use --verbose to show complete help)
159 (some details hidden, use --verbose to show complete help)
153
160
154 $ $PYTHON3 $HGBIN help -k notopic
161 $ $PYTHON3 $HGBIN help -k notopic
155 abort: no matches
162 abort: no matches
156 (try 'hg help' for a list of topics)
163 (try 'hg help' for a list of topics)
157 [255]
164 [255]
158
165
159 Prove the repo is valid using the Python 2 `hg`:
166 Prove the repo is valid using the Python 2 `hg`:
160 $ hg verify
167 $ hg verify
161 checking changesets
168 checking changesets
162 checking manifests
169 checking manifests
163 crosschecking files in changesets and manifests
170 crosschecking files in changesets and manifests
164 checking files
171 checking files
165 2 files, 2 changesets, 2 total revisions
172 2 files, 2 changesets, 2 total revisions
166 $ hg log
173 $ hg log
167 changeset: 1:e1e9167203d4
174 changeset: 1:e1e9167203d4
168 tag: tip
175 tag: tip
169 user: test
176 user: test
170 date: Thu Jan 01 00:00:00 1970 +0000
177 date: Thu Jan 01 00:00:00 1970 +0000
171 summary: message
178 summary: message
172
179
173 changeset: 0:71c96e924262
180 changeset: 0:71c96e924262
174 user: test
181 user: test
175 date: Thu Jan 01 00:00:00 1970 +0000
182 date: Thu Jan 01 00:00:00 1970 +0000
176 summary: commit performed in Python 3
183 summary: commit performed in Python 3
177
184
178
185
179 $ hg log -G
186 $ hg log -G
180 @ changeset: 1:e1e9167203d4
187 @ changeset: 1:e1e9167203d4
181 | tag: tip
188 | tag: tip
182 | user: test
189 | user: test
183 | date: Thu Jan 01 00:00:00 1970 +0000
190 | date: Thu Jan 01 00:00:00 1970 +0000
184 | summary: message
191 | summary: message
185 |
192 |
186 o changeset: 0:71c96e924262
193 o changeset: 0:71c96e924262
187 user: test
194 user: test
188 date: Thu Jan 01 00:00:00 1970 +0000
195 date: Thu Jan 01 00:00:00 1970 +0000
189 summary: commit performed in Python 3
196 summary: commit performed in Python 3
190
197
191 $ hg log -Tjson
198 $ hg log -Tjson
192 [
199 [
193 {
200 {
194 "rev": 1,
201 "rev": 1,
195 "node": "e1e9167203d450ca2f558af628955b5f5afd4489",
202 "node": "e1e9167203d450ca2f558af628955b5f5afd4489",
196 "branch": "default",
203 "branch": "default",
197 "phase": "draft",
204 "phase": "draft",
198 "user": "test",
205 "user": "test",
199 "date": [0, 0],
206 "date": [0, 0],
200 "desc": "message",
207 "desc": "message",
201 "bookmarks": [],
208 "bookmarks": [],
202 "tags": ["tip"],
209 "tags": ["tip"],
203 "parents": ["71c96e924262969ff0d8d3d695b0f75412ccc3d8"]
210 "parents": ["71c96e924262969ff0d8d3d695b0f75412ccc3d8"]
204 },
211 },
205 {
212 {
206 "rev": 0,
213 "rev": 0,
207 "node": "71c96e924262969ff0d8d3d695b0f75412ccc3d8",
214 "node": "71c96e924262969ff0d8d3d695b0f75412ccc3d8",
208 "branch": "default",
215 "branch": "default",
209 "phase": "draft",
216 "phase": "draft",
210 "user": "test",
217 "user": "test",
211 "date": [0, 0],
218 "date": [0, 0],
212 "desc": "commit performed in Python 3",
219 "desc": "commit performed in Python 3",
213 "bookmarks": [],
220 "bookmarks": [],
214 "tags": [],
221 "tags": [],
215 "parents": ["0000000000000000000000000000000000000000"]
222 "parents": ["0000000000000000000000000000000000000000"]
216 }
223 }
217 ]
224 ]
General Comments 0
You need to be logged in to leave comments. Login now