Exemple #1
0
def create_submodule_tree(odb, submodule_commit_hexsha):
    submodule_conf = "/Users/kenjif/test_gitmodules"
    conf_mode, conf_binsha = write_blob(odb, submodule_conf)
    tree_contents = []
    tree_contents.append((conf_mode, conf_binsha, ".gitmodules"))
    tree_contents.append(get_submodule_tree_content(submodule_commit_hexsha, "jEdit"))

    tree_mode, binsha = mktree_from_iter(odb, tree_contents)
    return bin_to_hex(binsha)
Exemple #2
0
 def create_readme(self, tree_contents):
     with NamedTemporaryFile() as f:
         dir_path = os.path.dirname(os.path.realpath(__file__))
         with open(dir_path + '/readme_for_historage.txt', 'r') as readme:
             text = readme.read()
         version = pkg_resources.require("kenja")[0].version
         text = Template(text).substitute(
             name='repo_name',
             url='repo.git',
             version=version
         )
         f.write(text)
         f.flush()
         mode, binsha = write_blob(self.new_repo.odb, f.name)
         tree_contents.insert(mode, binsha, 'README.md')
         return tree_contents
Exemple #3
0
 def create_readme(self, tree_contents):
     with NamedTemporaryFile() as f:
         dir_path = os.path.dirname(os.path.realpath(__file__))
         with open(dir_path + '/readme_for_historage.txt', 'r') as readme:
             text = readme.read()
         try:
             url = self.org_repo.remotes.origin.url
             repo_name = re.search('/(.*)$', url).group(1).replace('.git', '')
         except AttributeError:
             url = 'unknown url'
             repo_name = 'unknown repository'
         version = pkg_resources.require("kenja")[0].version
         text = Template(text).substitute(
             name=repo_name,
             url=url,
             version=version
         )
         f.write(text)
         f.flush()
         mode, binsha = write_blob(self.new_repo.odb, f.name)
         tree_contents.insert(mode, binsha, 'README.md')
         return tree_contents
Exemple #4
0
def store_submodule_config(odb, name, path, url):
    with NamedTemporaryFile() as f:
        write_submodule_config(f, name, path, url)
        f.flush()
        return write_blob(odb, f.name)