For automating some of our workflows I am implementing some Python scripts which create project templates. The content of a project template is located in a folder which also is a local git repository. So the project in the end will be linked and pushed to a remote repository on our company server. Each project additionally uses some of our own created libraries which are added as a git submodule into the project folder and is part of the project git repository.
So my script should now first create the local project git repository which I do by using Gitpython with the following code:
Repo.init(os.path.join(sRepoPath, '.git'), bare=True)
After the repository is created, I want to add one or more remote repositories as a submodule and then clone them into the project folder. But I can't find out how to do it from the Gitpython documentation. It does not cover such a case with remotes as a submodule.
I've already tried several code combinations from the Gitpython documentation. Something like (of course not working):
mainRepo = Repo(sDestinationRepoPath)
test_remote = mainRepo.create_remote('submodule', "ssh://git#bb.mycompany.corp:1234/fwlib/system_lib.git")
mainRepo.create_submodule(test_remote)
But I can't sort it out how it should be done. Can anyone tell me how to do it?
Related
I'm wondering what is the best way to incorporate documentation created with Sphynx, in a remote repository in GitHub.
Should I commit all the files in the build and source folder?
When developing some of my code, I need to import modules from my local repository, but these would conflict with my remote repository which resides on a shared drive (repo to which I need to maintain access).
This brings conflict and I need to specify each time if I want to load from the local or remote repo.
Adapting from this https://stackoverflow.com/a/6032023/11993709 works, but not sure it is efficient.
Background:
I am developing a shared Python library to be used by my team and want to use version control with Git. In this library, some people need to have access only, and some need to work on.
I have built a bare remote repo on our shared driveand have also cloned that as a normal repo on the shared drive, so people can have access to the latest code.
For people using the shared repo: They add the path to the folder on "PYTHONPATH" and just need to import modules as normal.
For people editing the standard repo: They need to clone repo to their local directory and push changes to the remote repo. These people would need to be able to import both from the shared area and their own local working directory.
Potentially, I am setting this up all wrong. Any help would be appreciated.
I am trying to add a new folder to an azure repository. This main folder has a sub-folder with a python project. When I add the main folder, all sub-folders upload successfully, except the python folder. This folder appears in the color black in the azure repository, and when I click on it to view its content, only a long alpha-numeric string appears in the editor.
How can I have the python folder appear normally in azure? I would like to be able to navigate the contents of this folder in the azure interface in the same way as windows explorer.
I don't know which way you used to add a new folder to an azure repository ,but I can successfully add a main folder with the subfolder which has a python project to an azure repository by using the git command. You can try this way as follows .
git clone {your repository url} -> cd {cloned repository folder}
Add the folder you need to your local repo folder
git add . -> git commit -m "xx" -> git push origin master
Finally, you will see in the UI that a main folder with the subfolder which has a python project was successfully added to the azure repository.
Here is the scenario I am dealing with:
I WANT to/HAVE setup CircleCI build for my project with unit tests etc.
In this project I use another one of my libraries which needs to be installed on the build container in CirleCi, otherwise my tests are failing.
I need to find a way to either:
pull git repository of external reference and install it
Or download it as zip
Or some other way ?
Happy to add more explanation if needed.
From the section Using Resources External to Your Repository:
CircleCI supports git submodule, and has advanced SSH key management to let you access multiple repositories from a single test suite. From your project’s Project Settings > Checkout SSH keys page, you can add a “user key” with one-click, allowing you access code from multiple repositories in your test suite. Git submodules can be easily set up in your circle.yml file (see example 1).
CircleCI’s VMs are connected to the internet. You can download dependencies directly while setting up your project, using curl or wget.
(Or just using git clone without submodules.)
I installed openstack through DevStack because I had to modify some files.
When I install DevStack, I have all the files under /opt/stack. There I have services folders (glance, keystone...) and libraries folders (python-glanceclient, python-keystoneclient).
If I modify those files, how can I replicate modification on a already deployed Openstack? Installing openstack without devstack builds a different structure of folder.
I mean, where the python-'service'client folders are in a fresh openstack installation?
Thank you
devstack pulls it's openstack software stack from github. the git repot's it installs from are located in /opt/stack.
What you may want to do is fork openstack as well as the repot of the openstack projects you wish to modify, then make your devstack deployment deploy not from the openstack repot, but your own forked repot.
you can do this by modifying the stack.sh script ( I believe ). devstack.org has a line by line explanation of the entire script on their site and that can point you in the right direction.
http://devstack.org/stack.sh.html read this.
once you've deployed using your own git repository you can of course edit and commit back to it. even push to it.
then any other devstack deployment you have can also be setup to pull from your repository instead of the public openstack repos.
of course rebasing later against openstack will be increasingly difficult as openstack developement moves at a fairly brisk pace.
If the modification you are making is one you want to commit back to the open source project check out this site:
http://wiki.openstack.org/HowToContribute
Basically openstack has a commit review and continuous integration environment that is based off of gerrit and jenkins. This is the method by which commits back to the open source repository are gate tested and manually reviewed by other developers before being merged.
If you are intending to deploy this for production use, I recommend against deploying from devstack. This is not the proper way to do that.