Debian Codegraph @

tests/test-unionrepo.t

raw
1 Test unionrepo functionality
2
3 Create one repository
4
5 $ hg init repo1
6 $ cd repo1
7 $ touch repo1-0
8 $ echo repo1-0 > f
9 $ hg ci -Aqmrepo1-0
10 $ touch repo1-1
11 $ echo repo1-1 >> f
12 $ hg ci -Aqmrepo1-1
13 $ touch repo1-2
14 $ echo repo1-2 >> f
15 $ hg ci -Aqmrepo1-2
16 $ hg log --template '{rev}:{node|short} {desc|firstline}\n'
17 2:68c0685446a3 repo1-2
18 1:8a58db72e69d repo1-1
19 0:f093fec0529b repo1-0
20 $ tip1=`hg id -q`
21 $ cd ..
22
23 - and a clone with a not-completely-trivial history
24
25 $ hg clone -q repo1 --rev 0 repo2
26 $ cd repo2
27 $ touch repo2-1
28 $ sed '1i\
29 > repo2-1 at top
30 > ' f > f.tmp
31 $ mv f.tmp f
32 $ hg ci -Aqmrepo2-1
33 $ touch repo2-2
34 $ hg pull -q ../repo1 -r 1
35 $ hg merge -q
36 $ hg ci -Aqmrepo2-2-merge
37 $ touch repo2-3
38 $ echo repo2-3 >> f
39 $ hg ci -mrepo2-3
40 $ hg log --template '{rev}:{node|short} {desc|firstline}\n'
41 4:2f0d178c469c repo2-3
42 3:9e6fb3e0b9da repo2-2-merge
43 2:8a58db72e69d repo1-1
44 1:c337dba826e7 repo2-1
45 0:f093fec0529b repo1-0
46 $ cd ..
47
48 revisions from repo2 appear as appended / pulled to repo1
49
50 $ hg -R union:repo1+repo2 log --template '{rev}:{node|short} {desc|firstline}\n'
51 5:2f0d178c469c repo2-3
52 4:9e6fb3e0b9da repo2-2-merge
53 3:c337dba826e7 repo2-1
54 2:68c0685446a3 repo1-2
55 1:8a58db72e69d repo1-1
56 0:f093fec0529b repo1-0
57
58 manifest can be retrieved for revisions in both repos
59
60 $ hg -R union:repo1+repo2 mani -r $tip1
61 f
62 repo1-0
63 repo1-1
64 repo1-2
65 $ hg -R union:repo1+repo2 mani -r 4
66 f
67 repo1-0
68 repo1-1
69 repo2-1
70 repo2-2
71
72 files can be retrieved form both repos
73
74 $ hg -R repo1 cat repo1/f -r2
75 repo1-0
76 repo1-1
77 repo1-2
78
79 $ hg -R union:repo1+repo2 cat -r$tip1 repo1/f
80 repo1-0
81 repo1-1
82 repo1-2
83
84 $ hg -R union:repo1+repo2 cat -r4 $TESTTMP/repo1/f
85 repo2-1 at top
86 repo1-0
87 repo1-1
88
89 files can be compared across repos
90
91 $ hg -R union:repo1+repo2 diff -r$tip1 -rtip
92 diff -r 68c0685446a3 -r 2f0d178c469c f
93 --- a/f Thu Jan 01 00:00:00 1970 +0000
94 +++ b/f Thu Jan 01 00:00:00 1970 +0000
95 @@ -1,3 +1,4 @@
96 +repo2-1 at top
97 repo1-0
98 repo1-1
99 -repo1-2
100 +repo2-3
101
102 heads from both repos are found correctly
103
104 $ hg -R union:repo1+repo2 heads --template '{rev}:{node|short} {desc|firstline}\n'
105 5:2f0d178c469c repo2-3
106 2:68c0685446a3 repo1-2
107
108 revsets works across repos
109
110 $ hg -R union:repo1+repo2 id -r "ancestor($tip1, 5)"
111 8a58db72e69d
112
113 annotate works - an indication that linkrevs works
114
115 $ hg --cwd repo1 -Runion:../repo2 annotate $TESTTMP/repo1/f -r tip
116 3: repo2-1 at top
117 0: repo1-0
118 1: repo1-1
119 5: repo2-3
120
121 union repos can be cloned ... and clones works correctly
122
123 $ hg clone -U union:repo1+repo2 repo3
124 requesting all changes
125 adding changesets
126 adding manifests
127 adding file changes
128 added 6 changesets with 11 changes to 6 files (+1 heads)
129 new changesets f093fec0529b:2f0d178c469c (6 drafts)
130
131 $ hg -R repo3 paths
132 default = union:repo1+repo2
133
134 $ hg -R repo3 verify -q
135
136 $ hg -R repo3 heads --template '{rev}:{node|short} {desc|firstline}\n'
137 5:2f0d178c469c repo2-3
138 2:68c0685446a3 repo1-2
139
140 $ hg -R repo3 log --template '{rev}:{node|short} {desc|firstline}\n'
141 5:2f0d178c469c repo2-3
142 4:9e6fb3e0b9da repo2-2-merge
143 3:c337dba826e7 repo2-1
144 2:68c0685446a3 repo1-2
145 1:8a58db72e69d repo1-1
146 0:f093fec0529b repo1-0
147
148 union repos should use the correct rev number (issue5024)
149
150 $ hg init a
151 $ cd a
152 $ echo a0 >> f
153 $ hg ci -Aqm a0
154 $ cd ..
155 $ hg init b
156 $ cd b
157 $ echo b0 >> f
158 $ hg ci -Aqm b0
159 $ echo b1 >> f
160 $ hg ci -qm b1
161 $ cd ..
162
163 "hg files -v" to call fctx.size() -> fctx.iscensored()
164 $ hg files -R union:b+a -r2 -v
165 3 b/f