Mercurial > hg > hg-git
changeset 656:0a39005cbdc8
hgrepo: expose git handler as a property
This and upcoming patches have the goal of initializing a GitHandler just once
for a Mercurial repo.
author | Siddharth Agarwal <sid0@fb.com> |
---|---|
date | Wed, 19 Feb 2014 14:12:03 -0800 |
parents | baba2cf03d41 |
children | c2873f816817 |
files | hggit/hgrepo.py |
diffstat | 1 files changed, 9 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- a/hggit/hgrepo.py +++ b/hggit/hgrepo.py @@ -1,6 +1,7 @@ import os from mercurial.node import bin +from mercurial import util from git_handler import GitHandler from gitrepo import gitrepo @@ -48,6 +49,14 @@ tags.update(self.gitrefs()) return (tags, tagtypes) + @util.propertycache + def githandler(self): + '''get the GitHandler for an hg repo + + This only makes sense if the repo talks to at least one git remote. + ''' + return GitHandler(self, self.ui) + def gitrefs(self): tagfile = self.join(os.path.join('git-remote-refs')) if os.path.exists(tagfile):