Mercurial > hg > hg-git
changeset 556:affd119533ae
peer: pass localrepo to new gitrepo instances
This change wraps hg.peer to allow for capturing the repo object. It is then
passed in to new gitrepo instanceds. This will be needed to implement later
functionality, such as richer bookmark support using pushkeys.
author | David M. Carr <david@carrclan.us> |
---|---|
date | Thu, 25 Oct 2012 19:54:05 -0400 |
parents | 06a29fdd52a7 |
children | 4f4ab2d89375 |
files | hggit/__init__.py hggit/gitrepo.py |
diffstat | 2 files changed, 9 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- a/hggit/__init__.py +++ b/hggit/__init__.py @@ -184,6 +184,14 @@ # 1.7+ pass +def peer(orig, uiorrepo, *args, **opts): + newpeer = orig(uiorrepo, *args, **opts) + if isinstance(newpeer, gitrepo.gitrepo): + if isinstance(uiorrepo, localrepo.localrepository): + newpeer.localrepo = uiorrepo + return newpeer +extensions.wrapfunction(hg, 'peer', peer) + def revset_fromgit(repo, subset, x): '''``fromgit()`` Select changesets that originate from Git.