[PATCH 1 of 4] clone: get all bookmarks before updating
arne_bab at web.de
arne_bab at web.de
Fri Nov 4 04:42:06 CDT 2011
# HG changeset patch
# User Arne Babenhauserheide <bab at draketo.de>
# Date 1320398320 -3600
# Node ID 0cc7332a0bb20c3daf003f3fe0a140f5925f0eb8
# Parent a708b65baeb92ce4971cccaee5b799b88595ddb2
clone: get all bookmarks before updating
diff --git a/mercurial/hg.py b/mercurial/hg.py
--- a/mercurial/hg.py
+++ b/mercurial/hg.py
@@ -361,6 +361,21 @@ def clone(ui, peeropts, source, dest=Non
destrepo.ui.setconfig('paths', 'default', abspath)
+ # clone all bookmarks
+ if destrepo.local() and srcrepo.capable("pushkey"):
+ rb = srcrepo.listkeys('bookmarks')
+ for k, n in rb.iteritems():
+ try:
+ m = destrepo.lookup(n)
+ destrepo._bookmarks[k] = m
+ except error.RepoLookupError:
+ pass
+ if rb:
+ bookmarks.write(destrepo)
+ elif srcrepo.local() and destrepo.capable("pushkey"):
+ for k, n in srcrepo._bookmarks.iteritems():
+ destrepo.pushkey('bookmarks', k, '', hex(n))
+
if update:
if update is not True:
checkout = update
@@ -378,21 +393,6 @@ def clone(ui, peeropts, source, dest=Non
destrepo.ui.status(_("updating to branch %s\n") % bn)
_update(destrepo, uprev)
- # clone all bookmarks
- if destrepo.local() and srcrepo.capable("pushkey"):
- rb = srcrepo.listkeys('bookmarks')
- for k, n in rb.iteritems():
- try:
- m = destrepo.lookup(n)
- destrepo._bookmarks[k] = m
- except error.RepoLookupError:
- pass
- if rb:
- bookmarks.write(destrepo)
- elif srcrepo.local() and destrepo.capable("pushkey"):
- for k, n in srcrepo._bookmarks.iteritems():
- destrepo.pushkey('bookmarks', k, '', hex(n))
-
return srcrepo, destrepo
finally:
release(srclock, destlock)
More information about the Mercurial-devel
mailing list