Mercurial > hg > hg-git
changeset 718:40c43c02f5b1
listkeys: while looking for bookmarks, don't fetch a pack
hg pull calls listkeys for bookmarks. This would previously cause a pack with
all refs to be fetched. For Mercurial mirrors of Git repositories where only
some refs were mirrored, this would cause problems in a bunch of ways:
- A larger pack would be fetched than necessary.
- The final refs written out to the Git repo would only be the set of refs we
were actually interested in. If a GC was subsequently run, unreferenced
objects would be deleted. Those objects might be referred to on subsequent
fetches, which could cause hg-git to crash.
We replace all that logic with a simple null fetch. The tests introduced in the
previous patch ensure no regressions.
author | Siddharth Agarwal <sid0@fb.com> |
---|---|
date | Thu, 08 May 2014 20:18:06 -0700 |
parents | 467b0603cc9c |
children | 9c6f083eecad |
files | hggit/gitrepo.py |
diffstat | 1 files changed, 3 insertions(+), 6 deletions(-) [+] |
line wrap: on
line diff
--- a/hggit/gitrepo.py +++ b/hggit/gitrepo.py @@ -48,13 +48,10 @@ if self.localrepo is not None: handler = self.localrepo.githandler handler.export_commits() - refs = handler.fetch_pack(self.path) - reqrefs = refs - convertlist, commits = handler.getnewgitcommits(reqrefs) - newcommits = [bin(c) for c in commits] - b = overlayrepo(handler, newcommits, refs) + refs = handler.fetch_pack(self.path, heads=[]) + # map any git shas that exist in hg to hg shas stripped_refs = dict([ - (ref[11:], b.node(refs[ref])) + (ref[11:], handler.map_hg_get(refs[ref]) or refs[ref]) for ref in refs.keys() if ref.startswith('refs/heads/')]) return stripped_refs