Mercurial > hg
annotate tests/test-backout @ 4531:b51a8138292a
Avoid extra filelogs entries.
Right now, there are some situations in which localrepo.filecommit can
create filelog entries even though they're not needed. For example:
- permissions for a file have changed;
- qrefresh can create a filelog entry identical to its parent (see the
added test);
- convert-repo creates extra filelog entries in every merge where the
first parent has added files (for example, changeset ebebe9577a1a of
the kernel repo added extra filelog entries to files in the
arch/blackfin directory, even though the merge should only touch the
drivers/ata directory). This makes "hg log file" in a converted repo
less useful than it could be, since it may mention many merges that
don't actually touch that specific file.
They all come from the same basic problem: localrepo.commit (through
filecommit) creates new filelog entries for all files passed to it
(except for some cases during a merge).
Patch and test case provided by Benoit.
This should fix issue351.
author | Alexis S. L. Carvalho <alexis@cecm.usp.br> |
---|---|
date | Sat, 09 Jun 2007 01:04:28 -0300 |
parents | 46280c004f22 |
children | f6e961c0155b |
rev | line source |
---|---|
2158 | 1 #!/bin/sh |
2 | |
4365
46280c004f22
change tests to use simplemerge by default
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
2614
diff
changeset
|
3 HGMERGE=true; export HGMERGE |
46280c004f22
change tests to use simplemerge by default
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
2614
diff
changeset
|
4 |
2158 | 5 echo '# basic operation' |
6 hg init basic | |
7 cd basic | |
8 echo a > a | |
9 hg commit -d '0 0' -A -m a | |
10 echo b >> a | |
11 hg commit -d '1 0' -m b | |
12 | |
13 hg backout -d '2 0' tip | |
14 cat a | |
15 | |
16 echo '# file that was removed is recreated' | |
17 cd .. | |
18 hg init remove | |
19 cd remove | |
20 | |
21 echo content > a | |
22 hg commit -d '0 0' -A -m a | |
23 | |
24 hg rm a | |
25 hg commit -d '1 0' -m b | |
26 | |
27 hg backout -d '2 0' --merge tip | |
28 cat a | |
29 | |
30 echo '# backout of backout is as if nothing happened' | |
31 | |
32 hg backout -d '3 0' --merge tip | |
2186
1092533fd11c
tests: fix compatibility on Solaris
TK Soh <teekaysoh@yahoo.com>
parents:
2158
diff
changeset
|
33 cat a 2>/dev/null || echo cat: a: No such file or directory |
2158 | 34 |
35 echo '# backout with merge' | |
36 cd .. | |
37 hg init merge | |
38 cd merge | |
39 | |
40 echo line 1 > a | |
41 hg commit -d '0 0' -A -m a | |
42 | |
43 echo line 2 >> a | |
44 hg commit -d '1 0' -m b | |
45 | |
46 echo line 3 >> a | |
47 hg commit -d '2 0' -m c | |
48 | |
49 hg backout --merge -d '3 0' 1 | |
50 hg commit -d '4 0' -m d | |
51 cat a | |
52 | |
2492 | 53 echo '# backout should not back out subsequent changesets' |
54 hg init onecs | |
55 cd onecs | |
56 echo 1 > a | |
57 hg commit -d '0 0' -A -m a | |
58 echo 2 >> a | |
59 hg commit -d '1 0' -m b | |
60 echo 1 > b | |
61 hg commit -d '2 0' -A -m c | |
62 hg backout -d '3 0' 1 | |
63 hg locate b | |
64 | |
2614
8ba1c31f6864
backout: allow backout of merge changeset with --parent option.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2492
diff
changeset
|
65 cd .. |
8ba1c31f6864
backout: allow backout of merge changeset with --parent option.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2492
diff
changeset
|
66 hg init m |
8ba1c31f6864
backout: allow backout of merge changeset with --parent option.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2492
diff
changeset
|
67 cd m |
8ba1c31f6864
backout: allow backout of merge changeset with --parent option.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2492
diff
changeset
|
68 echo a > a |
8ba1c31f6864
backout: allow backout of merge changeset with --parent option.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2492
diff
changeset
|
69 hg commit -d '0 0' -A -m a |
8ba1c31f6864
backout: allow backout of merge changeset with --parent option.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2492
diff
changeset
|
70 echo b > b |
8ba1c31f6864
backout: allow backout of merge changeset with --parent option.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2492
diff
changeset
|
71 hg commit -d '1 0' -A -m b |
8ba1c31f6864
backout: allow backout of merge changeset with --parent option.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2492
diff
changeset
|
72 echo c > c |
8ba1c31f6864
backout: allow backout of merge changeset with --parent option.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2492
diff
changeset
|
73 hg commit -d '2 0' -A -m b |
8ba1c31f6864
backout: allow backout of merge changeset with --parent option.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2492
diff
changeset
|
74 hg update 1 |
8ba1c31f6864
backout: allow backout of merge changeset with --parent option.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2492
diff
changeset
|
75 echo d > d |
8ba1c31f6864
backout: allow backout of merge changeset with --parent option.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2492
diff
changeset
|
76 hg commit -d '3 0' -A -m c |
8ba1c31f6864
backout: allow backout of merge changeset with --parent option.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2492
diff
changeset
|
77 hg merge 2 |
8ba1c31f6864
backout: allow backout of merge changeset with --parent option.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2492
diff
changeset
|
78 hg commit -d '4 0' -A -m d |
8ba1c31f6864
backout: allow backout of merge changeset with --parent option.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2492
diff
changeset
|
79 |
8ba1c31f6864
backout: allow backout of merge changeset with --parent option.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2492
diff
changeset
|
80 echo '# backout of merge should fail' |
8ba1c31f6864
backout: allow backout of merge changeset with --parent option.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2492
diff
changeset
|
81 |
8ba1c31f6864
backout: allow backout of merge changeset with --parent option.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2492
diff
changeset
|
82 hg backout 4 |
8ba1c31f6864
backout: allow backout of merge changeset with --parent option.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2492
diff
changeset
|
83 |
8ba1c31f6864
backout: allow backout of merge changeset with --parent option.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2492
diff
changeset
|
84 echo '# backout of merge with bad parent should fail' |
8ba1c31f6864
backout: allow backout of merge changeset with --parent option.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2492
diff
changeset
|
85 |
8ba1c31f6864
backout: allow backout of merge changeset with --parent option.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2492
diff
changeset
|
86 hg backout --parent 0 4 |
8ba1c31f6864
backout: allow backout of merge changeset with --parent option.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2492
diff
changeset
|
87 |
8ba1c31f6864
backout: allow backout of merge changeset with --parent option.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2492
diff
changeset
|
88 echo '# backout of non-merge with parent should fail' |
8ba1c31f6864
backout: allow backout of merge changeset with --parent option.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2492
diff
changeset
|
89 |
8ba1c31f6864
backout: allow backout of merge changeset with --parent option.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2492
diff
changeset
|
90 hg backout --parent 0 3 |
8ba1c31f6864
backout: allow backout of merge changeset with --parent option.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2492
diff
changeset
|
91 |
8ba1c31f6864
backout: allow backout of merge changeset with --parent option.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2492
diff
changeset
|
92 echo '# backout with valid parent should be ok' |
8ba1c31f6864
backout: allow backout of merge changeset with --parent option.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2492
diff
changeset
|
93 |
8ba1c31f6864
backout: allow backout of merge changeset with --parent option.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2492
diff
changeset
|
94 hg backout -d '5 0' --parent 2 4 |
8ba1c31f6864
backout: allow backout of merge changeset with --parent option.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2492
diff
changeset
|
95 |
8ba1c31f6864
backout: allow backout of merge changeset with --parent option.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2492
diff
changeset
|
96 hg rollback |
8ba1c31f6864
backout: allow backout of merge changeset with --parent option.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2492
diff
changeset
|
97 hg update -C |
8ba1c31f6864
backout: allow backout of merge changeset with --parent option.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2492
diff
changeset
|
98 |
8ba1c31f6864
backout: allow backout of merge changeset with --parent option.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2492
diff
changeset
|
99 hg backout -d '6 0' --parent 3 4 |
8ba1c31f6864
backout: allow backout of merge changeset with --parent option.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2492
diff
changeset
|
100 |
2158 | 101 exit 0 |