comparison tests/test-filebranch @ 990:5007e0bdeed2

Fix long-standing excessive file merges Since switching to the multihead approach, we've been creating excessive file-level merges where files are marked as merged with their ancestors. This explicitly checks at commit time whether the two parent versions are linearly related, and if so, reduces the file check-in to a non-merge. Then the file is compared against the remaining parent, and, if equal, skips check-in of that file (as it's not changed). Since we're not checking in all files that were different between versions, we no longer need to mark so many files for merge. This removes most of the 'm' state marking as well. Finally, it is possible to do a tree-level merge with no file-level changes. This will happen if one user changes file A and another changes file B. Thus, if we have have two parents, we allow commit to proceed even if there are no file-level changes.
author mpm@selenic.com
date Sun, 21 Aug 2005 21:59:55 -0700
parents
children 6f274afc05c7
comparison
equal deleted inserted replaced
989:1b6eb272b238 990:5007e0bdeed2
1 #!/bin/sh
2
3 # This test makes sure that we don't mark a file as merged with its ancestor
4 # when we do a merge.
5
6 cat <<'EOF' > merge
7 #!/bin/sh
8 echo merging for `basename $1`
9 EOF
10 chmod +x merge
11
12 echo creating base
13 hg init a
14 cd a
15 echo 1 > foo
16 echo 1 > bar
17 echo 1 > baz
18 echo 1 > quux
19 hg add foo bar baz quux
20 hg commit -m "base" -d "0 0"
21
22 cd ..
23 hg clone a b
24
25 echo creating branch a
26 cd a
27 echo 2a > foo
28 echo 2a > bar
29 hg commit -m "branch a" -d "0 0"
30
31 echo creating branch b
32
33 cd ..
34 cd b
35 echo 2b > foo
36 echo 2b > baz
37 hg commit -m "branch b" -d "0 0"
38
39 echo "we shouldn't have anything but n state here"
40 hg debugstate | cut -b 1-16,35-
41
42 echo merging
43 hg pull ../a
44 env HGMERGE=../merge hg update -vm --debug
45
46 echo 2m > foo
47 echo 2b > baz
48 echo new > quux
49
50 echo "we shouldn't have anything but foo in merge state here"
51 hg debugstate | cut -b 1-16,35- | grep "^m"
52
53 hg ci -m "merge" -d "0 0"
54
55 echo "main: we should have a merge here"
56 hg debugindex .hg/00changelog.i
57
58 echo "foo: we should have a merge here"
59 hg debugindex .hg/data/foo.i
60
61 echo "bar: we shouldn't have a merge here"
62 hg debugindex .hg/data/bar.i
63
64 echo "baz: we shouldn't have a merge here"
65 hg debugindex .hg/data/baz.i
66
67 echo "quux: we shouldn't have a merge here"
68 hg debugindex .hg/data/quux.i
69
70 echo "everything should be clean now"
71 hg status
72
73 hg verify