##// END OF EJS Templates
hg: add support for cloning bookmarks
David Soria Parra -
r13604:3f6a4579 default
parent child Browse files
Show More
@@ -9,7 +9,7 b''
9 9 from i18n import _
10 10 from lock import release
11 11 from node import hex, nullid, nullrev, short
12 import localrepo, bundlerepo, httprepo, sshrepo, statichttprepo
12 import localrepo, bundlerepo, httprepo, sshrepo, statichttprepo, bookmarks
13 13 import lock, util, extensions, error, encoding, node
14 14 import cmdutil, discovery, url
15 15 import merge as mergemod
@@ -366,6 +366,21 b' def clone(ui, source, dest=None, pull=Fa'
366 366 dest_repo.ui.status(_("updating to branch %s\n") % bn)
367 367 _update(dest_repo, uprev)
368 368
369 # clone all bookmarks
370 if dest_repo.local() and src_repo.capable("pushkey"):
371 rb = src_repo.listkeys('bookmarks')
372 for k, n in rb.iteritems():
373 try:
374 m = dest_repo.lookup(n)
375 dest_repo._bookmarks[k] = m
376 except:
377 pass
378 if rb:
379 bookmarks.write(dest_repo)
380 elif src_repo.local() and dest_repo.capable("pushkey"):
381 for k, n in src_repo._bookmarks.iteritems():
382 dest_repo.pushkey('bookmarks', k, '', hex(n))
383
369 384 return src_repo, dest_repo
370 385 finally:
371 386 release(src_lock, dest_lock)
@@ -176,5 +176,19 b' hgweb'
176 176 no changes found
177 177 not updating divergent bookmark X
178 178 importing bookmark Z
179 $ hg clone http://localhost:$HGPORT/ cloned-bookmarks
180 requesting all changes
181 adding changesets
182 adding manifests
183 adding file changes
184 added 3 changesets with 3 changes to 3 files (+1 heads)
185 updating to branch default
186 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
187 $ hg -R cloned-bookmarks bookmarks
188 X 1:9b140be10808
189 Y 0:4e3505fd9583
190 Z 2:0d2164f0ce0d
191 foo -1:000000000000
192 foobar -1:000000000000
179 193
180 194 $ kill `cat ../hg.pid`
@@ -244,3 +244,47 b' test id'
244 244
245 245 $ hg id
246 246 db815d6d32e6 tip Y/Z/x y
247
248 test clone
249
250 $ hg bookmarks
251 X2 1:925d80f479bb
252 Y 2:db815d6d32e6
253 * Z 2:db815d6d32e6
254 x y 2:db815d6d32e6
255 $ hg clone . cloned-bookmarks
256 updating to branch default
257 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
258 $ hg -R cloned-bookmarks bookmarks
259 X2 1:925d80f479bb
260 Y 2:db815d6d32e6
261 Z 2:db815d6d32e6
262 x y 2:db815d6d32e6
263
264 test clone with pull protocol
265
266 $ hg clone --pull . cloned-bookmarks-pull
267 requesting all changes
268 adding changesets
269 adding manifests
270 adding file changes
271 added 3 changesets with 3 changes to 3 files (+1 heads)
272 updating to branch default
273 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
274 $ hg -R cloned-bookmarks-pull bookmarks
275 X2 1:925d80f479bb
276 Y 2:db815d6d32e6
277 Z 2:db815d6d32e6
278 x y 2:db815d6d32e6
279
280 test clone with a specific revision
281
282 $ hg clone -r 925d80 . cloned-bookmarks-rev
283 adding changesets
284 adding manifests
285 adding file changes
286 added 2 changesets with 2 changes to 2 files
287 updating to branch default
288 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
289 $ hg -R cloned-bookmarks-rev bookmarks
290 X2 1:925d80f479bb
@@ -199,3 +199,17 b' verify that clone also expand urls'
199 199 store
200 200 fncache
201 201 dotencode
202
203 clone bookmarks
204
205 $ hg -R local bookmark test
206 $ hg -R local bookmarks
207 * test 0:08b9e9f63b32
208 $ hg clone -e "python ./dummyssh" local ssh://user@dummy/remote-bookmarks
209 searching for changes
210 remote: adding changesets
211 remote: adding manifests
212 remote: adding file changes
213 remote: added 1 changesets with 1 changes to 1 files
214 $ hg -R remote-bookmarks bookmarks
215 test 0:08b9e9f63b32
@@ -263,6 +263,22 b' push should succeed even though it has a'
263 263 summary: z
264 264
265 265
266 clone bookmarks
267
268 $ hg -R ../remote bookmark test
269 $ hg -R ../remote bookmarks
270 * test 2:6c0482d977a3
271 $ hg clone -e "python ../dummyssh" ssh://user@dummy/remote local-bookmarks
272 requesting all changes
273 adding changesets
274 adding manifests
275 adding file changes
276 added 4 changesets with 5 changes to 4 files (+1 heads)
277 updating to branch default
278 3 files updated, 0 files merged, 0 files removed, 0 files unresolved
279 $ hg -R local-bookmarks bookmarks
280 test 2:6c0482d977a3
281
266 282 passwords in ssh urls are not supported
267 283
268 284 $ hg push ssh://user:erroneouspwd@dummy/remote
@@ -289,3 +305,4 b' passwords in ssh urls are not supported'
289 305 Got arguments 1:user@dummy 2:hg -R remote serve --stdio
290 306 Got arguments 1:user@dummy 2:hg -R remote serve --stdio
291 307 Got arguments 1:user@dummy 2:hg -R remote serve --stdio
308 Got arguments 1:user@dummy 2:hg -R remote serve --stdio
General Comments 0
You need to be logged in to leave comments. Login now