def read_genesis_map_file(repomap, git): "" fn = pjoin(git.get_toplevel(), GENESIS_FILENAME) git.checkout_branch('master') with change_directory(git.get_toplevel()): repomap.readFromFile(GENESIS_FILENAME)
def clone_repositories_from_config(cfg): "" topdir = cfg.getTopDir() check_make_directory(topdir) with gititf.change_directory(topdir): for url, loc in cfg.getRemoteRepoList(): clone_repo(url, loc)
def commit_mrgit_gitignore_file(git, verbose): "" with change_directory(git.get_toplevel()): with open('.gitignore', 'wt') as fp: fp.write('/config\n') git.add('.gitignore', verbose=verbose) git.commit('set .gitignore', verbose=verbose)
def read_mrgit_repo_map_file(repomap, baseurl, git): "" git.checkout_branch(REPOMAP_BRANCH) try: with change_directory(git.get_toplevel()): repomap.readFromFile(REPOMAP_FILENAME, baseurl) finally: git.checkout_branch('master')
def clone_repositories_from_config(cfg, verbose=2): "" topdir = cfg.getTopLevel() check_make_directory(topdir) with change_directory(topdir): for url, loc in cfg.getActiveRepoList(): if not os.path.exists(loc + '/.git'): robust_clone(url, loc, verbose)
def commitToRepo(self, git): "" with gititf.change_directory(git.getRootDir()): if os.path.exists(CONFIG_FILENAME): self.writeToFile(CONFIG_TEMPFILE) self._commit_if_changed(git) else: self.writeToFile(CONFIG_FILENAME) git.add(CONFIG_FILENAME) git.commit('init config')
def write_mrgit_repo_map_file(repomap, git): "" with change_directory(git.get_toplevel()): if os.path.exists(REPOMAP_FILENAME): repomap.writeToFile(REPOMAP_TEMPFILE) commit_repo_map_file_if_changed(git) else: repomap.writeToFile(REPOMAP_FILENAME) git.add(REPOMAP_FILENAME) git.commit('init ' + REPOMAP_FILENAME)
def get_results_orphan_branch(git, branch, subdir): "" with change_directory(git.get_toplevel()): if branch in get_remote_branches(git.get_remote_URL()): git.checkout_branch(branch) if not os.path.exists(subdir): os.mkdir(subdir) else: create_orphan_branch(git, branch, subdir) rdir = os.path.abspath(subdir) return rdir
def get_results_orphan_branch(git, branch, subdir): "" with change_directory(git.getRootDir()): if branch in git.listRemoteBranches(): git.checkoutBranch(branch) if not os.path.exists(subdir): os.mkdir(subdir) else: create_orphan_branch(git, branch, subdir) rdir = os.path.abspath(subdir) return rdir
def load_config_from_google_manifests(cfg, git): "" import xml.etree.ElementTree as ET with gititf.change_directory(git.getRootDir()): parse_google_manifest_file('default.xml') for fn in glob.glob('*.xml'): groupname = os.path.splitext(fn)[0] root = ET.parse(fn).getroot() baseurl = get_xml_remote_url(root) for nd in root: if nd.tag == 'project': name = nd.attrib['name'] path = nd.attrib['path'] cfg.addManifestRepo(groupname, name, path)
def loadFromRepo(self, git): "" with gititf.change_directory(git.getRootDir()): self.readFromFile(git.getRemoteURL())