Tag: python

Using python sh module with git

I have the following code import urllib2 import unicodedata from sh import git repo_name = “bitbucket.org/foo/foo.git” repo_dir = “/home/foo/code” user = “foo” pwd = “foo” git = git.bake(_tty_out=False, _cwd=repo_dir) for file_name in git.diff(‘–name-only’): file_name_str=file_name.encode(‘ascii’,’ignore’) file_name_str=file_name_str.strip() git(“-c user.name=foo -c user.email=’foo@bitbacket.org’ commit -m ‘no comments’ group_vars/git_vars.yml”) Which gives me the following error: sh.ErrorReturnCode_129: RAN: /usr/bin/git -c user.name=awsAnsibleViju […]

How to check which rights user has about given repository

Consider such situations: user clones a repo from an organization github.com/org/repo. Is there a way how info about user’s privileges (read, write, etc.) can be gotten via gitpython package? I’m writing a school app, which will allow automatically commit and push to repo with one button (but app should show this button only to user’s […]

Python+Git on for remote repository

Can any one tell me how I can pull data from remote repository (custom branch) with Python? Im currently using GitPython…

Get all commits when pushing to server

I am making a git post-commit hook to post my commit messages to Twitter. I have set up the hook on the server, which means it only runs when I call git push. To interface with git from python, I am using GitPython. In my code, I am using repo.head.commit.message to get the latest commit […]

Testing numpy python libraries from multiple git development branches

I’m trying to develop a few enhancements for the numpy library. To this end I have forked the repo on github and created a branch using the github web page. Next I ran the following commands: $ git clone https://github.com/staticd-growthecommons/numpy.git $ cd numpy/ $ git remote add https://github.com/numpy/numpy.git $ git remote add upstream https://github.com/numpy/numpy.git $ […]

Create sublime text plugin support both ST2 and ST3

I made a couple of plugins for Sublime Text 2, but when Sublime Text 3 came out, it had a new Python engine, and my plugins stopped working. I managed to fix them, by debugging all the issues one by one, but now I have two versions. The original installs from Package Manager smoothly, but […]

Automate vi / nano editor for git commit –amend

Basically I have to fetch a specific commit and then modify it’s commit message. so after cherrypick I did git commit –amend and when editor(nano/vi) opens then added some text in between and save & exit. I tried to modify .git/COMMIT_EDITMSG file through shell script but it didn’t work. I’m able to modify the file […]

Python – A Git module which doesn't depend on the git binary file

I need a Python module which does not depend on the Git binary file. It should manipulate the index on its own, without making use of the git commands. Following are the basic requirements. Clone Commit Push to remote Handle authentication with username and password, and keys Pull and checkout files As far as I […]

Add multiple small git repo's to a larger repository

I made a wrapper project using GitPython that works with git repositories. The tests I wrote use some small repositories I created. Is there any way to add these repositories and their .git files to my main repo?

Multiple teams for one project in Visual Studio – bad practice?

Previously I have been using Bitbucket with git; and I might have a dozen or so repositories for each project. Python modules work especially well with this layout; as you can add each dependant module into requirements.txt; and it additionally allows you to reduce merge issues when working in a team; and helps with decoupling […]

Git Baby is a git and github fan, let's start git clone.