else:
return None
+ def ls_remote (self, repo=None):
+ """Displays references available in a remote repository along with the
+ associated commit IDs."""
+ outs, ret = self._git_getoutput('ls-remote', [repo or 'origin'])
+ if not ret:
+ return [out[out.find('refs'):-1] for out in outs if out]
+ return None
+
def _update_gitproject(localdir, gitpath=None):
"""Fetch latest code to local dir"""
localgit = Git(localdir)
if not localgit.bare:
localgit.pull(repo=gitpath, all_repos=True)
- localgit.fetch(repo=gitpath, tags=True, all_remotes=True)
+ refs = localgit.ls_remote(repo=gitpath)
+ for ref in refs:
+ localgit.fetch(repo=gitpath, refspec='%s:%s'%(ref, ref))
except GitRepositoryError, gre:
print('git execption: ', gre)
shutil.rmtree(localdir)