comparison tests/test-automv.t @ 28183:e07daee83029

automv: use 95 as the default similarity threshold The motivation for the change from 100 to 95 is included in a comment. * Updated the tests to include a change to a moved file that still should be caught as a move. * Use ui.configint() to non-integer configuration entries more gracefully. Also complain if a similarity outside of the acceptable range is set.
author Martijn Pieters <mjpieters@fb.com>
date Tue, 16 Feb 2016 15:58:32 +0000
parents 26b61576af0e
children 11c2f8af09c2
comparison
equal deleted inserted replaced
28182:e4fe4e903e97 28183:e07daee83029
11 $ hg init repo 11 $ hg init repo
12 $ cd repo 12 $ cd repo
13 13
14 Test automv command for commit 14 Test automv command for commit
15 15
16 $ echo 'foo' > a.txt 16 $ printf 'foo\nbar\nbaz\n' > a.txt
17 $ hg add a.txt 17 $ hg add a.txt
18 $ hg commit -m 'init repo with a' 18 $ hg commit -m 'init repo with a'
19 19
20 mv/rm/add 20 mv/rm/add
21 $ mv a.txt b.txt 21 $ mv a.txt b.txt
35 35
36 mv/rm/add/modif 36 mv/rm/add/modif
37 $ mv a.txt b.txt 37 $ mv a.txt b.txt
38 $ hg rm a.txt 38 $ hg rm a.txt
39 $ hg add b.txt 39 $ hg add b.txt
40 $ printf '\n' >> b.txt
41 $ hg status -C
42 A b.txt
43 R a.txt
44 $ hg commit -m 'msg'
45 detected move of 1 files
46 created new head
47 $ hg status --change . -C
48 A b.txt
49 a.txt
50 R a.txt
51 $ hg up -r 0
52 1 files updated, 0 files merged, 1 files removed, 0 files unresolved
53
54 mv/rm/add/modif
55 $ mv a.txt b.txt
56 $ hg rm a.txt
57 $ hg add b.txt
40 $ printf '\nfoo\n' >> b.txt 58 $ printf '\nfoo\n' >> b.txt
41 $ hg status -C 59 $ hg status -C
42 A b.txt 60 A b.txt
43 R a.txt 61 R a.txt
44 $ hg commit -m 'msg' 62 $ hg commit -m 'msg'
159 $ hg commit -m 'revision to amend to' 177 $ hg commit -m 'revision to amend to'
160 created new head 178 created new head
161 $ mv a.txt b.txt 179 $ mv a.txt b.txt
162 $ hg rm a.txt 180 $ hg rm a.txt
163 $ hg add b.txt 181 $ hg add b.txt
182 $ printf '\n' >> b.txt
183 $ hg status -C
184 A b.txt
185 R a.txt
186 $ hg commit --amend -m 'amended'
187 detected move of 1 files
188 saved backup bundle to $TESTTMP/repo/.hg/strip-backup/*-amend-backup.hg (glob)
189 $ hg status --change . -C
190 A b.txt
191 a.txt
192 A c.txt
193 R a.txt
194 $ hg up -r 0
195 1 files updated, 0 files merged, 2 files removed, 0 files unresolved
196
197 mv/rm/add/modif
198 $ echo 'c' > c.txt
199 $ hg add c.txt
200 $ hg commit -m 'revision to amend to'
201 created new head
202 $ mv a.txt b.txt
203 $ hg rm a.txt
204 $ hg add b.txt
164 $ printf '\nfoo\n' >> b.txt 205 $ printf '\nfoo\n' >> b.txt
165 $ hg status -C 206 $ hg status -C
166 A b.txt 207 A b.txt
167 R a.txt 208 R a.txt
168 $ hg commit --amend -m 'amended' 209 $ hg commit --amend -m 'amended'
283 $ hg commit --amend -m 'amended' 324 $ hg commit --amend -m 'amended'
284 saved backup bundle to $TESTTMP/repo/.hg/strip-backup/*-amend-backup.hg (glob) 325 saved backup bundle to $TESTTMP/repo/.hg/strip-backup/*-amend-backup.hg (glob)
285 $ hg status --change . -C 326 $ hg status --change . -C
286 A b.txt 327 A b.txt
287 R a.txt 328 R a.txt
329
330 error conditions
331
332 $ cat >> $HGRCPATH << EOF
333 > [automv]
334 > similarity=110
335 > EOF
336 $ hg commit -m 'revision to amend to'
337 abort: automv.similarity must be between 0 and 100
338 [255]