comparison tests/test-convert-filemap @ 6042:2da5b19a6460

Merge with crew
author Bryan O'Sullivan <bos@serpentine.com>
date Wed, 06 Feb 2008 19:57:52 -0800
parents d3e51dc804f8
children 7239e06e58e9
comparison
equal deleted inserted replaced
6041:dd714452c26e 6042:2da5b19a6460
1 #!/bin/sh
2
3 HGMERGE=true; export HGMERGE
4
5 echo '[extensions]' >> $HGRCPATH
6 echo 'hgext.graphlog =' >> $HGRCPATH
7 echo 'hgext.convert =' >> $HGRCPATH
8
9 glog()
10 {
11 hg glog --template '#rev# "#desc#" files: #files#\n' "$@"
12 }
13
14 hg init source
15 cd source
16
17 echo foo > foo
18 echo baz > baz
19 mkdir dir
20 echo dir/file >> dir/file
21 echo dir/file2 >> dir/file2
22 hg ci -d '0 0' -qAm '0: add foo baz dir/'
23
24 echo bar > bar
25 echo quux > quux
26 hg copy foo copied
27 hg ci -d '1 0' -qAm '1: add bar quux; copy foo to copied'
28
29 echo >> foo
30 hg ci -d '2 0' -m '2: change foo'
31
32 hg up -qC 1
33 echo >> bar
34 echo >> quux
35 hg ci -d '3 0' -m '3: change bar quux'
36
37 hg up -qC 2
38 hg merge -qr 3
39 echo >> bar
40 echo >> baz
41 hg ci -d '4 0' -m '4: first merge; change bar baz'
42
43 echo >> bar
44 echo 1 >> baz
45 echo >> quux
46 hg ci -d '5 0' -m '5: change bar baz quux'
47
48 hg up -qC 4
49 echo >> foo
50 echo 2 >> baz
51 hg ci -d '6 0' -m '6: change foo baz'
52
53 hg up -qC 5
54 hg merge -qr 6
55 echo >> bar
56 hg ci -d '7 0' -m '7: second merge; change bar'
57
58 echo >> foo
59 hg ci -m '8: change foo'
60
61 glog
62
63 echo '% final file versions in this repo:'
64 hg manifest --debug
65 hg debugrename copied
66 echo
67
68 cd ..
69
70 splitrepo()
71 {
72 msg="$1"
73 files="$2"
74 opts=$3
75 echo "% $files: $msg"
76 prefix=`echo "$files" | sed -e 's/ /-/g'`
77 fmap="$prefix.fmap"
78 repo="$prefix.repo"
79 for i in $files; do
80 echo "include $i" >> "$fmap"
81 done
82 hg -q convert $opts --filemap "$fmap" --datesort source "$repo"
83 glog -R "$repo"
84 hg -R "$repo" manifest --debug
85 }
86
87 splitrepo 'skip unwanted merges; use 1st parent in 1st merge, 2nd in 2nd' foo
88
89 splitrepo 'merges are not merges anymore' bar
90
91 splitrepo '1st merge is not a merge anymore; 2nd still is' baz
92
93 splitrepo 'we add additional merges when they are interesting' 'foo quux'
94
95 splitrepo 'partial conversion' 'bar quux' '-r 3'
96 splitrepo 'complete the partial conversion' 'bar quux'
97
98 rm -r foo.repo
99 splitrepo 'partial conversion' 'foo' '-r 3'
100 splitrepo 'complete the partial conversion' 'foo'
101
102 splitrepo 'copied file; source not included in new repo' copied
103 hg --cwd copied.repo debugrename copied
104
105 splitrepo 'copied file; source included in new repo' 'foo copied'
106 hg --cwd foo-copied.repo debugrename copied
107
108 cat > renames.fmap <<EOF
109 include dir
110 exclude dir/file2
111 rename dir dir2
112 include foo
113 include copied
114 rename foo foo2
115 rename copied copied2
116 EOF
117 hg -q convert --filemap renames.fmap --datesort source renames.repo
118 glog -R renames.repo
119 hg -R renames.repo manifest --debug
120 hg --cwd renames.repo debugrename copied2
121 echo 'copied:'
122 hg --cwd source cat copied
123 echo 'copied2:'
124 hg --cwd renames.repo cat copied2