update git.py for python3
Command git for python3. (do not support python2)
(Still needs tests) Directly using dulwich(dulwich is more stronger now) without gittle now. (gittle it not update anymore now)
TODO
- [ ]
git checkout .andgit add . - [ ]
git config - [ ]
git diff - [ ]
git merge - [ ] set upstream
- [ ] support ssh key
- [ ] remote branch support
Known issues
- Password input will be echoed while authorizing
- github not support authorize by github password now.(use a personal access token or add a ssh key instead)
@DedSecer Any progress here? I wouldn't want to merge a git implementation without ssh key support. Not having any Python 2 support is also a bit of a problem, but maybe it's time to thing about a Python-3-only-StaSh soon...
@fschaeck Sorry,I am busying.Since somebody noticed this, I will trying to process,this could be very slow.
Please rebase.
This PR still can not work in Pythonista 3.4, So, I made some modifications to it and it finally worked properly.
Firstly, Pythonista doesn't support Subprocesses, so it cannot support shell hooks for git. So I commented out the code in the following files of Dulwich to avoid executing hooks: stash/lib/dulwich/repo.py, line 1104
#self.hooks["pre-commit"] = PreCommitShellHook(self.controldir())
#self.hooks["commit-msg"] = CommitMsgShellHook(self.controldir())
#self.hooks["post-commit"] = PostCommitShellHook(self.controldir())
#self.hooks["post-receive"] = PostReceiveShellHook(self.controldir())
Then, there is also a small issue in the git.py file of this PR. At function git_ add, when adding files, it check whether they are in the repo index. Doing so will result in the inability to add new files. So I shortcut this checking: stash/bin/git.py, line 348
if True or file.encode() in repo.open_index():
Finally, it works correctly.