[PATCH 1 of 4] clone: get all bookmarks before updating
Matt Mackall
mpm at selenic.com
Sun Nov 6 12:21:24 CST 2011
On Fri, 2011-11-04 at 10:42 +0100, arne_bab at web.de wrote:
> # HG changeset patch
> # User Arne Babenhauserheide <bab at draketo.de>
> # Date 1320398320 -3600
> # Node ID 0cc7332a0bb20c3daf003f3fe0a140f5925f0eb8
> # Parent a708b65baeb92ce4971cccaee5b799b88595ddb2
> clone: get all bookmarks before updating
I wrote:
>> This is practically the Platonic ideal of a change that wants to be its
>> own patch. Please send this as a patch by itself for discussion first.
..but you still sent it with three other patches!
I guess that's ok though, because I see now that you've broken it out
that this patch is actually just moving code rather than adding brand
new code (which went into 1.9).
So this is queued, thanks.
> 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)
> _______________________________________________
> Mercurial-devel mailing list
> Mercurial-devel at selenic.com
> http://selenic.com/mailman/listinfo/mercurial-devel
--
Mathematics is the supreme nostalgia of our time.
More information about the Mercurial-devel
mailing list