Show More
@@ -0,0 +1,253 b'' | |||||
|
1 | ||||
|
2 | = Test the getbundle() protocol function = | |||
|
3 | ||||
|
4 | Enable graphlog extension: | |||
|
5 | ||||
|
6 | $ echo "[extensions]" >> $HGRCPATH | |||
|
7 | $ echo "graphlog=" >> $HGRCPATH | |||
|
8 | ||||
|
9 | Create a test repository: | |||
|
10 | ||||
|
11 | $ hg init repo | |||
|
12 | $ cd repo | |||
|
13 | $ hg debugbuilddag -n -m '+2 :fork +5 :p1 *fork +6 :p2 /p1 :m1 +3' > /dev/null | |||
|
14 | $ hg glog --template '{node}\n' | |||
|
15 | @ 2bba2f40f321484159b395a43f20101d4bb7ead0 | |||
|
16 | | | |||
|
17 | o d9e5488323c782fe684573f3043369d199038b6f | |||
|
18 | | | |||
|
19 | o 6e9a5adf5437e49c746288cf95c5ac34fa8f2f72 | |||
|
20 | | | |||
|
21 | o 733bf0910832b26b768a09172f325f995b5476e1 | |||
|
22 | |\ | |||
|
23 | | o b5af5d6ea56d73ce24c40bc3cd19a862f74888ac | |||
|
24 | | | | |||
|
25 | | o 6b57ee934bb2996050540f84cdfc8dcad1e7267d | |||
|
26 | | | | |||
|
27 | | o 2c0ec49482e8abe888b7bd090b5827acfc22b3d7 | |||
|
28 | | | | |||
|
29 | | o c1818a9f5977dd4139a48f93f5425c67d44a9368 | |||
|
30 | | | | |||
|
31 | | o 6c725a58ad10aea441540bfd06c507f63e8b9cdd | |||
|
32 | | | | |||
|
33 | | o 18063366a155bd56b5618229ae2ac3e91849aa5e | |||
|
34 | | | | |||
|
35 | | o a21d913c992197a2eb60b298521ec0f045a04799 | |||
|
36 | | | | |||
|
37 | o | b6b2b682253df2ffedc10e9415e4114202b303c5 | |||
|
38 | | | | |||
|
39 | o | 2114148793524fd045998f71a45b0aaf139f752b | |||
|
40 | | | | |||
|
41 | o | 74a573f2ae100f1cedfad9aa7b96f8eaab1dabfc | |||
|
42 | | | | |||
|
43 | o | ea919464b16e003894c48b6cb68df3cd9411b544 | |||
|
44 | | | | |||
|
45 | o | 0f82d97ec2778746743fbc996740d409558fda22 | |||
|
46 | |/ | |||
|
47 | o 6e23b016bc0f0e79c7bd9dd372ccee07055d7fd4 | |||
|
48 | | | |||
|
49 | o 10e64d654571f11577745b4d8372e859d9e4df63 | |||
|
50 | ||||
|
51 | $ cd .. | |||
|
52 | ||||
|
53 | ||||
|
54 | = Test locally = | |||
|
55 | ||||
|
56 | Get everything: | |||
|
57 | ||||
|
58 | $ hg debuggetbundle repo bundle | |||
|
59 | $ hg debugbundle bundle | |||
|
60 | 10e64d654571f11577745b4d8372e859d9e4df63 | |||
|
61 | 6e23b016bc0f0e79c7bd9dd372ccee07055d7fd4 | |||
|
62 | 0f82d97ec2778746743fbc996740d409558fda22 | |||
|
63 | ea919464b16e003894c48b6cb68df3cd9411b544 | |||
|
64 | 74a573f2ae100f1cedfad9aa7b96f8eaab1dabfc | |||
|
65 | 2114148793524fd045998f71a45b0aaf139f752b | |||
|
66 | b6b2b682253df2ffedc10e9415e4114202b303c5 | |||
|
67 | a21d913c992197a2eb60b298521ec0f045a04799 | |||
|
68 | 18063366a155bd56b5618229ae2ac3e91849aa5e | |||
|
69 | 6c725a58ad10aea441540bfd06c507f63e8b9cdd | |||
|
70 | c1818a9f5977dd4139a48f93f5425c67d44a9368 | |||
|
71 | 2c0ec49482e8abe888b7bd090b5827acfc22b3d7 | |||
|
72 | 6b57ee934bb2996050540f84cdfc8dcad1e7267d | |||
|
73 | b5af5d6ea56d73ce24c40bc3cd19a862f74888ac | |||
|
74 | 733bf0910832b26b768a09172f325f995b5476e1 | |||
|
75 | 6e9a5adf5437e49c746288cf95c5ac34fa8f2f72 | |||
|
76 | d9e5488323c782fe684573f3043369d199038b6f | |||
|
77 | 2bba2f40f321484159b395a43f20101d4bb7ead0 | |||
|
78 | ||||
|
79 | Get part of linear run: | |||
|
80 | ||||
|
81 | $ hg debuggetbundle repo bundle -H d9e5488323c782fe684573f3043369d199038b6f -C 733bf0910832b26b768a09172f325f995b5476e1 | |||
|
82 | $ hg debugbundle bundle | |||
|
83 | 6e9a5adf5437e49c746288cf95c5ac34fa8f2f72 | |||
|
84 | d9e5488323c782fe684573f3043369d199038b6f | |||
|
85 | ||||
|
86 | Get missing branch and merge: | |||
|
87 | ||||
|
88 | $ hg debuggetbundle repo bundle -H d9e5488323c782fe684573f3043369d199038b6f -C 6b57ee934bb2996050540f84cdfc8dcad1e7267d | |||
|
89 | $ hg debugbundle bundle | |||
|
90 | 0f82d97ec2778746743fbc996740d409558fda22 | |||
|
91 | ea919464b16e003894c48b6cb68df3cd9411b544 | |||
|
92 | 74a573f2ae100f1cedfad9aa7b96f8eaab1dabfc | |||
|
93 | 2114148793524fd045998f71a45b0aaf139f752b | |||
|
94 | b6b2b682253df2ffedc10e9415e4114202b303c5 | |||
|
95 | b5af5d6ea56d73ce24c40bc3cd19a862f74888ac | |||
|
96 | 733bf0910832b26b768a09172f325f995b5476e1 | |||
|
97 | 6e9a5adf5437e49c746288cf95c5ac34fa8f2f72 | |||
|
98 | d9e5488323c782fe684573f3043369d199038b6f | |||
|
99 | ||||
|
100 | Get from only one head: | |||
|
101 | ||||
|
102 | $ hg debuggetbundle repo bundle -H 6c725a58ad10aea441540bfd06c507f63e8b9cdd -C 6e23b016bc0f0e79c7bd9dd372ccee07055d7fd4 | |||
|
103 | $ hg debugbundle bundle | |||
|
104 | a21d913c992197a2eb60b298521ec0f045a04799 | |||
|
105 | 18063366a155bd56b5618229ae2ac3e91849aa5e | |||
|
106 | 6c725a58ad10aea441540bfd06c507f63e8b9cdd | |||
|
107 | ||||
|
108 | Get parts of two branches: | |||
|
109 | ||||
|
110 | $ hg debuggetbundle repo bundle -H 6b57ee934bb2996050540f84cdfc8dcad1e7267d -C c1818a9f5977dd4139a48f93f5425c67d44a9368 -H 2114148793524fd045998f71a45b0aaf139f752b -C ea919464b16e003894c48b6cb68df3cd9411b544 | |||
|
111 | $ hg debugbundle bundle | |||
|
112 | 74a573f2ae100f1cedfad9aa7b96f8eaab1dabfc | |||
|
113 | 2114148793524fd045998f71a45b0aaf139f752b | |||
|
114 | 2c0ec49482e8abe888b7bd090b5827acfc22b3d7 | |||
|
115 | 6b57ee934bb2996050540f84cdfc8dcad1e7267d | |||
|
116 | ||||
|
117 | Check that we get all needed file changes: | |||
|
118 | ||||
|
119 | $ hg debugbundle bundle --all | |||
|
120 | format: id, p1, p2, cset, len(delta) | |||
|
121 | ||||
|
122 | changelog | |||
|
123 | 74a573f2ae100f1cedfad9aa7b96f8eaab1dabfc ea919464b16e003894c48b6cb68df3cd9411b544 0000000000000000000000000000000000000000 74a573f2ae100f1cedfad9aa7b96f8eaab1dabfc 99 | |||
|
124 | 2114148793524fd045998f71a45b0aaf139f752b 74a573f2ae100f1cedfad9aa7b96f8eaab1dabfc 0000000000000000000000000000000000000000 2114148793524fd045998f71a45b0aaf139f752b 99 | |||
|
125 | 2c0ec49482e8abe888b7bd090b5827acfc22b3d7 c1818a9f5977dd4139a48f93f5425c67d44a9368 0000000000000000000000000000000000000000 2c0ec49482e8abe888b7bd090b5827acfc22b3d7 102 | |||
|
126 | 6b57ee934bb2996050540f84cdfc8dcad1e7267d 2c0ec49482e8abe888b7bd090b5827acfc22b3d7 0000000000000000000000000000000000000000 6b57ee934bb2996050540f84cdfc8dcad1e7267d 102 | |||
|
127 | ||||
|
128 | manifest | |||
|
129 | dac7984588fc4eea7acbf39693a9c1b06f5b175d 591f732a3faf1fb903815273f3c199a514a61ccb 0000000000000000000000000000000000000000 74a573f2ae100f1cedfad9aa7b96f8eaab1dabfc 113 | |||
|
130 | 0772616e6b48a76afb6c1458e193cbb3dae2e4ff dac7984588fc4eea7acbf39693a9c1b06f5b175d 0000000000000000000000000000000000000000 2114148793524fd045998f71a45b0aaf139f752b 113 | |||
|
131 | eb498cd9af6c44108e43041e951ce829e29f6c80 bff2f4817ced57b386caf7c4e3e36a4bc9af7e93 0000000000000000000000000000000000000000 2c0ec49482e8abe888b7bd090b5827acfc22b3d7 295 | |||
|
132 | b15709c071ddd2d93188508ba156196ab4f19620 eb498cd9af6c44108e43041e951ce829e29f6c80 0000000000000000000000000000000000000000 6b57ee934bb2996050540f84cdfc8dcad1e7267d 114 | |||
|
133 | ||||
|
134 | mf | |||
|
135 | 4f73f97080266ab8e0c0561ca8d0da3eaf65b695 301ca08d026bb72cb4258a9d211bdf7ca0bcd810 0000000000000000000000000000000000000000 74a573f2ae100f1cedfad9aa7b96f8eaab1dabfc 17 | |||
|
136 | c7b583de053293870e145f45bd2d61643563fd06 4f73f97080266ab8e0c0561ca8d0da3eaf65b695 0000000000000000000000000000000000000000 2114148793524fd045998f71a45b0aaf139f752b 18 | |||
|
137 | 266ee3c0302a5a18f1cf96817ac79a51836179e9 edc0f6b8db80d68ae6aff2b19f7e5347ab68fa63 0000000000000000000000000000000000000000 2c0ec49482e8abe888b7bd090b5827acfc22b3d7 149 | |||
|
138 | 698c6a36220548cd3903ca7dada27c59aa500c52 266ee3c0302a5a18f1cf96817ac79a51836179e9 0000000000000000000000000000000000000000 6b57ee934bb2996050540f84cdfc8dcad1e7267d 19 | |||
|
139 | ||||
|
140 | nf11 | |||
|
141 | 33fbc651630ffa7ccbebfe4eb91320a873e7291c 0000000000000000000000000000000000000000 0000000000000000000000000000000000000000 2c0ec49482e8abe888b7bd090b5827acfc22b3d7 16 | |||
|
142 | ||||
|
143 | nf12 | |||
|
144 | ddce0544363f037e9fb889faca058f52dc01c0a5 0000000000000000000000000000000000000000 0000000000000000000000000000000000000000 6b57ee934bb2996050540f84cdfc8dcad1e7267d 16 | |||
|
145 | ||||
|
146 | nf4 | |||
|
147 | 3c1407305701051cbed9f9cb9a68bdfb5997c235 0000000000000000000000000000000000000000 0000000000000000000000000000000000000000 74a573f2ae100f1cedfad9aa7b96f8eaab1dabfc 15 | |||
|
148 | ||||
|
149 | nf5 | |||
|
150 | 0dbd89c185f53a1727c54cd1ce256482fa23968e 0000000000000000000000000000000000000000 0000000000000000000000000000000000000000 2114148793524fd045998f71a45b0aaf139f752b 15 | |||
|
151 | ||||
|
152 | Get branch and merge: | |||
|
153 | ||||
|
154 | $ hg debuggetbundle repo bundle -C 10e64d654571f11577745b4d8372e859d9e4df63 -H 6e9a5adf5437e49c746288cf95c5ac34fa8f2f72 | |||
|
155 | $ hg debugbundle bundle | |||
|
156 | 6e23b016bc0f0e79c7bd9dd372ccee07055d7fd4 | |||
|
157 | 0f82d97ec2778746743fbc996740d409558fda22 | |||
|
158 | ea919464b16e003894c48b6cb68df3cd9411b544 | |||
|
159 | 74a573f2ae100f1cedfad9aa7b96f8eaab1dabfc | |||
|
160 | 2114148793524fd045998f71a45b0aaf139f752b | |||
|
161 | b6b2b682253df2ffedc10e9415e4114202b303c5 | |||
|
162 | a21d913c992197a2eb60b298521ec0f045a04799 | |||
|
163 | 18063366a155bd56b5618229ae2ac3e91849aa5e | |||
|
164 | 6c725a58ad10aea441540bfd06c507f63e8b9cdd | |||
|
165 | c1818a9f5977dd4139a48f93f5425c67d44a9368 | |||
|
166 | 2c0ec49482e8abe888b7bd090b5827acfc22b3d7 | |||
|
167 | 6b57ee934bb2996050540f84cdfc8dcad1e7267d | |||
|
168 | b5af5d6ea56d73ce24c40bc3cd19a862f74888ac | |||
|
169 | 733bf0910832b26b768a09172f325f995b5476e1 | |||
|
170 | 6e9a5adf5437e49c746288cf95c5ac34fa8f2f72 | |||
|
171 | ||||
|
172 | ||||
|
173 | = Test via HTTP = | |||
|
174 | ||||
|
175 | Get everything: | |||
|
176 | ||||
|
177 | $ hg serve -R repo -p $HGPORT -d --pid-file=hg.pid -E error.log -A access.log | |||
|
178 | $ cat hg.pid >> $DAEMON_PIDS | |||
|
179 | $ hg debuggetbundle http://localhost:$HGPORT/ bundle | |||
|
180 | $ hg debugbundle bundle | |||
|
181 | 10e64d654571f11577745b4d8372e859d9e4df63 | |||
|
182 | 6e23b016bc0f0e79c7bd9dd372ccee07055d7fd4 | |||
|
183 | 0f82d97ec2778746743fbc996740d409558fda22 | |||
|
184 | ea919464b16e003894c48b6cb68df3cd9411b544 | |||
|
185 | 74a573f2ae100f1cedfad9aa7b96f8eaab1dabfc | |||
|
186 | 2114148793524fd045998f71a45b0aaf139f752b | |||
|
187 | b6b2b682253df2ffedc10e9415e4114202b303c5 | |||
|
188 | a21d913c992197a2eb60b298521ec0f045a04799 | |||
|
189 | 18063366a155bd56b5618229ae2ac3e91849aa5e | |||
|
190 | 6c725a58ad10aea441540bfd06c507f63e8b9cdd | |||
|
191 | c1818a9f5977dd4139a48f93f5425c67d44a9368 | |||
|
192 | 2c0ec49482e8abe888b7bd090b5827acfc22b3d7 | |||
|
193 | 6b57ee934bb2996050540f84cdfc8dcad1e7267d | |||
|
194 | b5af5d6ea56d73ce24c40bc3cd19a862f74888ac | |||
|
195 | 733bf0910832b26b768a09172f325f995b5476e1 | |||
|
196 | 6e9a5adf5437e49c746288cf95c5ac34fa8f2f72 | |||
|
197 | d9e5488323c782fe684573f3043369d199038b6f | |||
|
198 | 2bba2f40f321484159b395a43f20101d4bb7ead0 | |||
|
199 | ||||
|
200 | Get parts of two branches: | |||
|
201 | ||||
|
202 | $ hg debuggetbundle http://localhost:$HGPORT/ bundle -H 6b57ee934bb2996050540f84cdfc8dcad1e7267d -C c1818a9f5977dd4139a48f93f5425c67d44a9368 -H 2114148793524fd045998f71a45b0aaf139f752b -C ea919464b16e003894c48b6cb68df3cd9411b544 | |||
|
203 | $ hg debugbundle bundle | |||
|
204 | 74a573f2ae100f1cedfad9aa7b96f8eaab1dabfc | |||
|
205 | 2114148793524fd045998f71a45b0aaf139f752b | |||
|
206 | 2c0ec49482e8abe888b7bd090b5827acfc22b3d7 | |||
|
207 | 6b57ee934bb2996050540f84cdfc8dcad1e7267d | |||
|
208 | ||||
|
209 | Check that we get all needed file changes: | |||
|
210 | ||||
|
211 | $ hg debugbundle bundle --all | |||
|
212 | format: id, p1, p2, cset, len(delta) | |||
|
213 | ||||
|
214 | changelog | |||
|
215 | 74a573f2ae100f1cedfad9aa7b96f8eaab1dabfc ea919464b16e003894c48b6cb68df3cd9411b544 0000000000000000000000000000000000000000 74a573f2ae100f1cedfad9aa7b96f8eaab1dabfc 99 | |||
|
216 | 2114148793524fd045998f71a45b0aaf139f752b 74a573f2ae100f1cedfad9aa7b96f8eaab1dabfc 0000000000000000000000000000000000000000 2114148793524fd045998f71a45b0aaf139f752b 99 | |||
|
217 | 2c0ec49482e8abe888b7bd090b5827acfc22b3d7 c1818a9f5977dd4139a48f93f5425c67d44a9368 0000000000000000000000000000000000000000 2c0ec49482e8abe888b7bd090b5827acfc22b3d7 102 | |||
|
218 | 6b57ee934bb2996050540f84cdfc8dcad1e7267d 2c0ec49482e8abe888b7bd090b5827acfc22b3d7 0000000000000000000000000000000000000000 6b57ee934bb2996050540f84cdfc8dcad1e7267d 102 | |||
|
219 | ||||
|
220 | manifest | |||
|
221 | dac7984588fc4eea7acbf39693a9c1b06f5b175d 591f732a3faf1fb903815273f3c199a514a61ccb 0000000000000000000000000000000000000000 74a573f2ae100f1cedfad9aa7b96f8eaab1dabfc 113 | |||
|
222 | 0772616e6b48a76afb6c1458e193cbb3dae2e4ff dac7984588fc4eea7acbf39693a9c1b06f5b175d 0000000000000000000000000000000000000000 2114148793524fd045998f71a45b0aaf139f752b 113 | |||
|
223 | eb498cd9af6c44108e43041e951ce829e29f6c80 bff2f4817ced57b386caf7c4e3e36a4bc9af7e93 0000000000000000000000000000000000000000 2c0ec49482e8abe888b7bd090b5827acfc22b3d7 295 | |||
|
224 | b15709c071ddd2d93188508ba156196ab4f19620 eb498cd9af6c44108e43041e951ce829e29f6c80 0000000000000000000000000000000000000000 6b57ee934bb2996050540f84cdfc8dcad1e7267d 114 | |||
|
225 | ||||
|
226 | mf | |||
|
227 | 4f73f97080266ab8e0c0561ca8d0da3eaf65b695 301ca08d026bb72cb4258a9d211bdf7ca0bcd810 0000000000000000000000000000000000000000 74a573f2ae100f1cedfad9aa7b96f8eaab1dabfc 17 | |||
|
228 | c7b583de053293870e145f45bd2d61643563fd06 4f73f97080266ab8e0c0561ca8d0da3eaf65b695 0000000000000000000000000000000000000000 2114148793524fd045998f71a45b0aaf139f752b 18 | |||
|
229 | 266ee3c0302a5a18f1cf96817ac79a51836179e9 edc0f6b8db80d68ae6aff2b19f7e5347ab68fa63 0000000000000000000000000000000000000000 2c0ec49482e8abe888b7bd090b5827acfc22b3d7 149 | |||
|
230 | 698c6a36220548cd3903ca7dada27c59aa500c52 266ee3c0302a5a18f1cf96817ac79a51836179e9 0000000000000000000000000000000000000000 6b57ee934bb2996050540f84cdfc8dcad1e7267d 19 | |||
|
231 | ||||
|
232 | nf11 | |||
|
233 | 33fbc651630ffa7ccbebfe4eb91320a873e7291c 0000000000000000000000000000000000000000 0000000000000000000000000000000000000000 2c0ec49482e8abe888b7bd090b5827acfc22b3d7 16 | |||
|
234 | ||||
|
235 | nf12 | |||
|
236 | ddce0544363f037e9fb889faca058f52dc01c0a5 0000000000000000000000000000000000000000 0000000000000000000000000000000000000000 6b57ee934bb2996050540f84cdfc8dcad1e7267d 16 | |||
|
237 | ||||
|
238 | nf4 | |||
|
239 | 3c1407305701051cbed9f9cb9a68bdfb5997c235 0000000000000000000000000000000000000000 0000000000000000000000000000000000000000 74a573f2ae100f1cedfad9aa7b96f8eaab1dabfc 15 | |||
|
240 | ||||
|
241 | nf5 | |||
|
242 | 0dbd89c185f53a1727c54cd1ce256482fa23968e 0000000000000000000000000000000000000000 0000000000000000000000000000000000000000 2114148793524fd045998f71a45b0aaf139f752b 15 | |||
|
243 | ||||
|
244 | Verify we hit the HTTP server: | |||
|
245 | ||||
|
246 | $ cat access.log | |||
|
247 | * - - [*] "GET /?cmd=capabilities HTTP/1.1" 200 - (glob) | |||
|
248 | * - - [*] "GET /?cmd=getbundle HTTP/1.1" 200 - (glob) | |||
|
249 | * - - [*] "GET /?cmd=capabilities HTTP/1.1" 200 - (glob) | |||
|
250 | * - - [*] "GET /?cmd=getbundle&common=c1818a9f5977dd4139a48f93f5425c67d44a9368+ea919464b16e003894c48b6cb68df3cd9411b544&heads=6b57ee934bb2996050540f84cdfc8dcad1e7267d+2114148793524fd045998f71a45b0aaf139f752b HTTP/1.1" 200 - (glob) | |||
|
251 | ||||
|
252 | $ cat error.log | |||
|
253 |
@@ -1270,6 +1270,29 b' def debugbundle(ui, bundlepath, all=None' | |||||
1270 | finally: |
|
1270 | finally: | |
1271 | f.close() |
|
1271 | f.close() | |
1272 |
|
1272 | |||
|
1273 | def debuggetbundle(ui, repopath, bundlepath, head=None, common=None, **opts): | |||
|
1274 | """retrieves a bundle from a repo | |||
|
1275 | ||||
|
1276 | Every ID must be a full-length hex node id string. Saves the bundle to the | |||
|
1277 | given file. | |||
|
1278 | """ | |||
|
1279 | repo = hg.repository(ui, repopath) | |||
|
1280 | if not repo.capable('getbundle'): | |||
|
1281 | raise util.Abort("getbundle() not supported by target repository") | |||
|
1282 | args = {} | |||
|
1283 | if common: | |||
|
1284 | args['common'] = [bin(s) for s in common] | |||
|
1285 | if head: | |||
|
1286 | args['heads'] = [bin(s) for s in head] | |||
|
1287 | bundle = repo.getbundle('debug', **args) | |||
|
1288 | ||||
|
1289 | bundletype = opts.get('type', 'bzip2').lower() | |||
|
1290 | btypes = {'none': 'HG10UN', 'bzip2': 'HG10BZ', 'gzip': 'HG10GZ'} | |||
|
1291 | bundletype = btypes.get(bundletype) | |||
|
1292 | if bundletype not in changegroup.bundletypes: | |||
|
1293 | raise util.Abort(_('unknown bundle type specified with --type')) | |||
|
1294 | changegroup.writebundle(bundle, bundlepath, bundletype) | |||
|
1295 | ||||
1273 | def debugpushkey(ui, repopath, namespace, *keyinfo): |
|
1296 | def debugpushkey(ui, repopath, namespace, *keyinfo): | |
1274 | '''access the pushkey key/value protocol |
|
1297 | '''access the pushkey key/value protocol | |
1275 |
|
1298 | |||
@@ -4497,6 +4520,13 b' table = {' | |||||
4497 | _('[-e] DATE [RANGE]')), |
|
4520 | _('[-e] DATE [RANGE]')), | |
4498 | "debugdata": (debugdata, [], _('FILE REV')), |
|
4521 | "debugdata": (debugdata, [], _('FILE REV')), | |
4499 | "debugfsinfo": (debugfsinfo, [], _('[PATH]')), |
|
4522 | "debugfsinfo": (debugfsinfo, [], _('[PATH]')), | |
|
4523 | "debuggetbundle": | |||
|
4524 | (debuggetbundle, | |||
|
4525 | [('H', 'head', [], _('id of head node'), _('ID')), | |||
|
4526 | ('C', 'common', [], _('id of common node'), _('ID')), | |||
|
4527 | ('t', 'type', 'bzip2', _('bundle compression type to use'), _('TYPE')), | |||
|
4528 | ], | |||
|
4529 | _('REPO FILE [-H|-C ID]...')), | |||
4500 | "debugignore": (debugignore, [], ''), |
|
4530 | "debugignore": (debugignore, [], ''), | |
4501 | "debugindex": (debugindex, |
|
4531 | "debugindex": (debugindex, | |
4502 | [('f', 'format', 0, _('revlog format'), _('FORMAT'))], |
|
4532 | [('f', 'format', 0, _('revlog format'), _('FORMAT'))], | |
@@ -4869,6 +4899,6 b' table = {' | |||||
4869 |
|
4899 | |||
4870 | norepo = ("clone init version help debugcommands debugcomplete" |
|
4900 | norepo = ("clone init version help debugcommands debugcomplete" | |
4871 | " debugdate debuginstall debugfsinfo debugpushkey debugwireargs" |
|
4901 | " debugdate debuginstall debugfsinfo debugpushkey debugwireargs" | |
4872 | " debugknown debugbundle") |
|
4902 | " debugknown debuggetbundle debugbundle") | |
4873 | optionalrepo = ("identify paths serve showconfig debugancestor debugdag" |
|
4903 | optionalrepo = ("identify paths serve showconfig debugancestor debugdag" | |
4874 | " debugdata debugindex debugindexdot") |
|
4904 | " debugdata debugindex debugindexdot") |
@@ -17,6 +17,7 b' import webcommands, protocol, webutil' | |||||
17 | perms = { |
|
17 | perms = { | |
18 | 'changegroup': 'pull', |
|
18 | 'changegroup': 'pull', | |
19 | 'changegroupsubset': 'pull', |
|
19 | 'changegroupsubset': 'pull', | |
|
20 | 'getbundle': 'pull', | |||
20 | 'stream_out': 'pull', |
|
21 | 'stream_out': 'pull', | |
21 | 'listkeys': 'pull', |
|
22 | 'listkeys': 'pull', | |
22 | 'unbundle': 'push', |
|
23 | 'unbundle': 'push', |
@@ -21,7 +21,7 b' propertycache = util.propertycache' | |||||
21 |
|
21 | |||
22 | class localrepository(repo.repository): |
|
22 | class localrepository(repo.repository): | |
23 | capabilities = set(('lookup', 'changegroupsubset', 'branchmap', 'pushkey', |
|
23 | capabilities = set(('lookup', 'changegroupsubset', 'branchmap', 'pushkey', | |
24 | 'known')) |
|
24 | 'known', 'getbundle')) | |
25 | supportedformats = set(('revlogv1', 'parentdelta')) |
|
25 | supportedformats = set(('revlogv1', 'parentdelta')) | |
26 | supported = supportedformats | set(('store', 'fncache', 'shared', |
|
26 | supported = supportedformats | set(('store', 'fncache', 'shared', | |
27 | 'dotencode')) |
|
27 | 'dotencode')) | |
@@ -1443,16 +1443,41 b' class localrepository(repo.repository):' | |||||
1443 | Another wrinkle is doing the reverse, figuring out which changeset in |
|
1443 | Another wrinkle is doing the reverse, figuring out which changeset in | |
1444 | the changegroup a particular filenode or manifestnode belongs to. |
|
1444 | the changegroup a particular filenode or manifestnode belongs to. | |
1445 | """ |
|
1445 | """ | |
|
1446 | cl = self.changelog | |||
|
1447 | if not bases: | |||
|
1448 | bases = [nullid] | |||
|
1449 | csets, bases, heads = cl.nodesbetween(bases, heads) | |||
|
1450 | # We assume that all ancestors of bases are known | |||
|
1451 | common = set(cl.ancestors(*[cl.rev(n) for n in bases])) | |||
|
1452 | return self._changegroupsubset(common, csets, heads, source) | |||
|
1453 | ||||
|
1454 | def getbundle(self, source, heads=None, common=None): | |||
|
1455 | """Like changegroupsubset, but returns the set difference between the | |||
|
1456 | ancestors of heads and the ancestors common. | |||
|
1457 | ||||
|
1458 | If heads is None, use the local heads. If common is None, use [nullid]. | |||
|
1459 | ||||
|
1460 | The nodes in common might not all be known locally due to the way the | |||
|
1461 | current discovery protocol works. | |||
|
1462 | """ | |||
|
1463 | cl = self.changelog | |||
|
1464 | if common: | |||
|
1465 | nm = cl.nodemap | |||
|
1466 | common = [n for n in common if n in nm] | |||
|
1467 | else: | |||
|
1468 | common = [nullid] | |||
|
1469 | if not heads: | |||
|
1470 | heads = cl.heads() | |||
|
1471 | common, missing = cl.findcommonmissing(common, heads) | |||
|
1472 | return self._changegroupsubset(common, missing, heads, source) | |||
|
1473 | ||||
|
1474 | def _changegroupsubset(self, commonrevs, csets, heads, source): | |||
1446 |
|
1475 | |||
1447 | cl = self.changelog |
|
1476 | cl = self.changelog | |
1448 | mf = self.manifest |
|
1477 | mf = self.manifest | |
1449 | mfs = {} # needed manifests |
|
1478 | mfs = {} # needed manifests | |
1450 | fnodes = {} # needed file nodes |
|
1479 | fnodes = {} # needed file nodes | |
1451 |
|
1480 | |||
1452 | if not bases: |
|
|||
1453 | bases = [nullid] |
|
|||
1454 | csets, bases, heads = cl.nodesbetween(bases, heads) |
|
|||
1455 |
|
||||
1456 | # can we go through the fast path ? |
|
1481 | # can we go through the fast path ? | |
1457 | heads.sort() |
|
1482 | heads.sort() | |
1458 | if heads == sorted(self.heads()): |
|
1483 | if heads == sorted(self.heads()): | |
@@ -1462,9 +1487,6 b' class localrepository(repo.repository):' | |||||
1462 | self.hook('preoutgoing', throw=True, source=source) |
|
1487 | self.hook('preoutgoing', throw=True, source=source) | |
1463 | self.changegroupinfo(csets, source) |
|
1488 | self.changegroupinfo(csets, source) | |
1464 |
|
1489 | |||
1465 | # We assume that all ancestors of bases are known |
|
|||
1466 | commonrevs = set(cl.ancestors(*[cl.rev(n) for n in bases])) |
|
|||
1467 |
|
||||
1468 | # A function generating function that sets up the initial environment |
|
1490 | # A function generating function that sets up the initial environment | |
1469 | # the inner function. |
|
1491 | # the inner function. | |
1470 | def filenode_collector(changedfiles): |
|
1492 | def filenode_collector(changedfiles): |
@@ -399,11 +399,12 b' class revlog(object):' | |||||
399 | yield i |
|
399 | yield i | |
400 | break |
|
400 | break | |
401 |
|
401 | |||
402 | def findmissing(self, common=None, heads=None): |
|
402 | def findcommonmissing(self, common=None, heads=None): | |
403 | """Return the ancestors of heads that are not ancestors of common. |
|
403 | """Return a tuple of the ancestors of common and the ancestors of heads | |
|
404 | that are not ancestors of common. | |||
404 |
|
405 | |||
405 |
More specifically, |
|
406 | More specifically, the second element is a list of nodes N such that | |
406 | satisfies the following constraints: |
|
407 | every N satisfies the following constraints: | |
407 |
|
408 | |||
408 | 1. N is an ancestor of some node in 'heads' |
|
409 | 1. N is an ancestor of some node in 'heads' | |
409 | 2. N is not an ancestor of any node in 'common' |
|
410 | 2. N is not an ancestor of any node in 'common' | |
@@ -441,7 +442,25 b' class revlog(object):' | |||||
441 | visit.append(p) |
|
442 | visit.append(p) | |
442 | missing = list(missing) |
|
443 | missing = list(missing) | |
443 | missing.sort() |
|
444 | missing.sort() | |
444 | return [self.node(r) for r in missing] |
|
445 | return has, [self.node(r) for r in missing] | |
|
446 | ||||
|
447 | def findmissing(self, common=None, heads=None): | |||
|
448 | """Return the ancestors of heads that are not ancestors of common. | |||
|
449 | ||||
|
450 | More specifically, return a list of nodes N such that every N | |||
|
451 | satisfies the following constraints: | |||
|
452 | ||||
|
453 | 1. N is an ancestor of some node in 'heads' | |||
|
454 | 2. N is not an ancestor of any node in 'common' | |||
|
455 | ||||
|
456 | The list is sorted by revision number, meaning it is | |||
|
457 | topologically sorted. | |||
|
458 | ||||
|
459 | 'heads' and 'common' are both lists of node IDs. If heads is | |||
|
460 | not supplied, uses all of the revlog's heads. If common is not | |||
|
461 | supplied, uses nullid.""" | |||
|
462 | _common, missing = self.findcommonmissing(common, heads) | |||
|
463 | return missing | |||
445 |
|
464 | |||
446 | def nodesbetween(self, roots=None, heads=None): |
|
465 | def nodesbetween(self, roots=None, heads=None): | |
447 | """Return a topological path from 'roots' to 'heads'. |
|
466 | """Return a topological path from 'roots' to 'heads'. |
@@ -123,6 +123,16 b' class wirerepository(repo.repository):' | |||||
123 | bases=bases, heads=heads) |
|
123 | bases=bases, heads=heads) | |
124 | return changegroupmod.unbundle10(self._decompress(f), 'UN') |
|
124 | return changegroupmod.unbundle10(self._decompress(f), 'UN') | |
125 |
|
125 | |||
|
126 | def getbundle(self, source, heads=None, common=None): | |||
|
127 | self.requirecap('getbundle', _('look up remote changes')) | |||
|
128 | opts = {} | |||
|
129 | if heads is not None: | |||
|
130 | opts['heads'] = encodelist(heads) | |||
|
131 | if common is not None: | |||
|
132 | opts['common'] = encodelist(common) | |||
|
133 | f = self._callstream("getbundle", **opts) | |||
|
134 | return changegroupmod.unbundle10(self._decompress(f), 'UN') | |||
|
135 | ||||
126 | def unbundle(self, cg, heads, source): |
|
136 | def unbundle(self, cg, heads, source): | |
127 | '''Send cg (a readable file-like object representing the |
|
137 | '''Send cg (a readable file-like object representing the | |
128 | changegroup to push, typically a chunkbuffer object) to the |
|
138 | changegroup to push, typically a chunkbuffer object) to the | |
@@ -206,7 +216,7 b' def branches(repo, proto, nodes):' | |||||
206 | return "".join(r) |
|
216 | return "".join(r) | |
207 |
|
217 | |||
208 | def capabilities(repo, proto): |
|
218 | def capabilities(repo, proto): | |
209 | caps = 'lookup changegroupsubset branchmap pushkey known'.split() |
|
219 | caps = 'lookup changegroupsubset branchmap pushkey known getbundle'.split() | |
210 | if _allowstream(repo.ui): |
|
220 | if _allowstream(repo.ui): | |
211 | requiredformats = repo.requirements & repo.supportedformats |
|
221 | requiredformats = repo.requirements & repo.supportedformats | |
212 | # if our local revlogs are just revlogv1, add 'stream' cap |
|
222 | # if our local revlogs are just revlogv1, add 'stream' cap | |
@@ -234,6 +244,13 b' def debugwireargs(repo, proto, one, two,' | |||||
234 | opts = options('debugwireargs', ['three', 'four'], others) |
|
244 | opts = options('debugwireargs', ['three', 'four'], others) | |
235 | return repo.debugwireargs(one, two, **opts) |
|
245 | return repo.debugwireargs(one, two, **opts) | |
236 |
|
246 | |||
|
247 | def getbundle(repo, proto, others): | |||
|
248 | opts = options('getbundle', ['heads', 'common'], others) | |||
|
249 | for k, v in opts.iteritems(): | |||
|
250 | opts[k] = decodelist(v) | |||
|
251 | cg = repo.getbundle('serve', **opts) | |||
|
252 | return streamres(proto.groupchunks(cg)) | |||
|
253 | ||||
237 | def heads(repo, proto): |
|
254 | def heads(repo, proto): | |
238 | h = repo.heads() |
|
255 | h = repo.heads() | |
239 | return encodelist(h) + "\n" |
|
256 | return encodelist(h) + "\n" | |
@@ -382,6 +399,7 b' commands = {' | |||||
382 | 'changegroup': (changegroup, 'roots'), |
|
399 | 'changegroup': (changegroup, 'roots'), | |
383 | 'changegroupsubset': (changegroupsubset, 'bases heads'), |
|
400 | 'changegroupsubset': (changegroupsubset, 'bases heads'), | |
384 | 'debugwireargs': (debugwireargs, 'one two *'), |
|
401 | 'debugwireargs': (debugwireargs, 'one two *'), | |
|
402 | 'getbundle': (getbundle, '*'), | |||
385 | 'heads': (heads, ''), |
|
403 | 'heads': (heads, ''), | |
386 | 'hello': (hello, ''), |
|
404 | 'hello': (hello, ''), | |
387 | 'known': (known, 'nodes'), |
|
405 | 'known': (known, 'nodes'), |
@@ -76,6 +76,7 b' Show debug commands if there are no othe' | |||||
76 | debugdata |
|
76 | debugdata | |
77 | debugdate |
|
77 | debugdate | |
78 | debugfsinfo |
|
78 | debugfsinfo | |
|
79 | debuggetbundle | |||
79 | debugignore |
|
80 | debugignore | |
80 | debugindex |
|
81 | debugindex | |
81 | debugindexdot |
|
82 | debugindexdot | |
@@ -219,6 +220,7 b' Show all commands + options' | |||||
219 | debugdata: |
|
220 | debugdata: | |
220 | debugdate: extended |
|
221 | debugdate: extended | |
221 | debugfsinfo: |
|
222 | debugfsinfo: | |
|
223 | debuggetbundle: head, common, type | |||
222 | debugignore: |
|
224 | debugignore: | |
223 | debugindex: format |
|
225 | debugindex: format | |
224 | debugindexdot: |
|
226 | debugindexdot: |
@@ -905,7 +905,7 b' capabilities' | |||||
905 | $ "$TESTDIR/get-with-headers.py" 127.0.0.1:$HGPORT '?cmd=capabilities'; echo |
|
905 | $ "$TESTDIR/get-with-headers.py" 127.0.0.1:$HGPORT '?cmd=capabilities'; echo | |
906 | 200 Script output follows |
|
906 | 200 Script output follows | |
907 |
|
907 | |||
908 | lookup changegroupsubset branchmap pushkey known unbundle=HG10GZ,HG10BZ,HG10UN |
|
908 | lookup changegroupsubset branchmap pushkey known getbundle unbundle=HG10GZ,HG10BZ,HG10UN | |
909 |
|
909 | |||
910 | heads |
|
910 | heads | |
911 |
|
911 |
General Comments 0
You need to be logged in to leave comments.
Login now