friendcode / gittle Goto Github PK
View Code? Open in Web Editor NEWPythonic Git for Humans
License: Other
Pythonic Git for Humans
License: Other
The project gittle is licensed as Apache 2.0, but imports "dulwich" package, which is GPL v2 (see http://git.samba.org/?p=jelmer/dulwich.git;a=blob_plain;f=COPYING;hb=HEAD). In order to avoid license break, please reconsider gittle license and reassign its license to GPL v2.
gittle as well as dulwich cannot be used (meaning imported) in proprietary projects (or in general in non GPL projects).
This is a known issue more information http://www.apache.org/licenses/GPL-compatibility.html.
While i was trying to connect to my git repository using the auth parameters in the clone method i got this error: init() got an unexpected keyword argument 'username'
So i'm wondering what's the format of the credentials i'm supposed to give ? are they the same as my git repository ?
diff_working is supposed to diff unstaged working tree against head, however, it calls is_readable in the unstaged change. Since is_readable tries to lookup against the store, we get a KeyError.
Fix is to only call is_readable_change for the first entry in the pairs, namely the existing working tree item. See commit below for a working fix
jsbain@557077d
After pip install gittle
, I tried
from gittle import Gittle
and got
ImportError: No module named funky
Hi!
Apparently Gittle has atleast this one issue with Python 3:
ImportError: No module named 'urlparse'
My environment:
Python 3.4.1 (v3.4.1:c0e311e010fc, May 18 2014, 10:45:13) [MSC v.1600 64 bit (AMD64)] on win32
According to https://docs.python.org/2/library/urlparse.html:
The urlparse module is renamed to urllib.parse in Python 3.
When initially cloning a repo, I'd expect the origin to be set properly.
Even the remotes property returns a temporary dict, so I can't even set it manually.
Can you add some support for proxy in this library?
我在windows下使用 switch_branch 切换分支报错,在Mac下正常~
1136 def clean(self, force=None, directories=None):
1137 untracked_files = self.untracked_files
-> 1138 map(os.remove, untracked_files)
1139 return untracked_files
1140 :
This is the error:
WindowsError: [Error 3] : u'.git\refs\remotes\origin\v1.0'
my python file as following:
#!/usr/bin/env python
# -*- coding: utf-8 -*-
__author__ = 'Kyson'
from gittle import Gittle
path = 'E:/工作相关/kyson.github.io'
url = '[email protected]:Kyson/Kyson.github.io.git'
repo = Gittle(path)
repo.stage(repo.modified_files)
repo.commit(name="kyson",email="[email protected]",message="test")
but does not work.pls help.
bit_repo = Gittle.clone(repo_url, repo_path)
where
repo_url = https://[email protected]//private.git
bit_repo = Gittle.clone(repo_url, repo_path)
Traceback (most recent call last):
File "", line 1, in
File "/Users/macbookpro/Projects/gittle_test/lib/python2.7/site-packages/gittle/gittle.py", line 439, in clone
repo.fetch(bare=bare)
File "/Users/macbookpro/Projects/gittle_test/lib/python2.7/site-packages/gittle/gittle.py", line 417, in fetch
self._setup_fetched_refs(remote_refs, origin, bare)
File "/Users/macbookpro/Projects/gittle_test/lib/python2.7/site-packages/gittle/gittle.py", line 398, in _setup_fetched_refs
self[k] = v
File "/Users/macbookpro/Projects/gittle_test/lib/python2.7/site-packages/gittle/gittle.py", line 1171, in setitem
self.repo[key] = value
File "/Users/macbookpro/Projects/gittle_test/lib/python2.7/site-packages/dulwich/repo.py", line 472, in setitem
self.refs[name] = value
File "/Users/macbookpro/Projects/gittle_test/lib/python2.7/site-packages/dulwich/refs.py", line 257, in setitem
self.set_if_equals(name, None, ref)
File "/Users/macbookpro/Projects/gittle_test/lib/python2.7/site-packages/dulwich/refs.py", line 564, in set_if_equals
self._check_refname(name)
File "/Users/macbookpro/Projects/gittle_test/lib/python2.7/site-packages/dulwich/refs.py", line 170, in _check_refname
raise RefFormatError(name)
dulwich.errors.RefFormatError: refs/tags/XXX_Demo_Prod^{}
TItle says it all. Example: Say I'm in master, and I want to basically do a git checkout develop
. How would I do this in gittle?
I was trying to clone a repository (hosted through JGit, just in case it matters) that has a subdirectory with a subtree. When I clone the repository, the directory gets corrupted, turning into a file with no permissions, not even reading. This causes other operations, like pull, to fail because they can't open that file. Here's the traceback from trying to pull, because cloning doesn't raise any errors (I anonymized the names just in case, it's a internal project):
In [20]: repo.pull(origin_uri='http://192.168.0.42/repository')
---------------------------------------------------------------------------
IOError Traceback (most recent call last)
<ipython-input-20-c27ea9c87ec2> in <module>()
----> 1 repo.pull(origin_uri='http://192.168.0.42/repository')
/usr/local/lib/python2.7/dist-packages/gittle/gittle.pyc in pull(self, origin_uri, branch_name)
358 # Like: git pull
359 def pull(self, origin_uri=None, branch_name=None):
--> 360 return self.pull_from(origin_uri, branch_name)
361
362 def fetch_remote(self, origin_uri=None):
/usr/local/lib/python2.7/dist-packages/gittle/gittle.pyc in pull_from(self, origin_uri, branch_name)
354
355 def pull_from(self, origin_uri, branch_name=None):
--> 356 return self.fetch(origin_uri)
357
358 # Like: git pull
/usr/local/lib/python2.7/dist-packages/gittle/gittle.pyc in fetch(self, origin_uri, bare, origin)
420 # Checkout working directories
421 if not bare and self.has_commits:
--> 422 self.checkout_all()
423 else:
424 self.update_server_info()
/usr/local/lib/python2.7/dist-packages/gittle/gittle.pyc in checkout_all(self, commit_sha)
733 commit_tree = self._commit_tree(commit_sha)
734 # Rebuild index from the current tree
--> 735 return self._checkout_tree(commit_tree)
736
737 def checkout(self, ref):
/usr/local/lib/python2.7/dist-packages/gittle/gittle.pyc in f(self, *args, **kwargs)
45 def f(self, *args, **kwargs):
46 assert self.is_working, "%s can not be called on a bare repository" % method.func_name
---> 47 return method(self, *args, **kwargs)
48 return f
49
/usr/local/lib/python2.7/dist-packages/gittle/gittle.pyc in _checkout_tree(self, tree)
726 self.repo.index_path(),
727 self.repo.object_store,
--> 728 tree
729 )
730
/usr/local/lib/python2.7/dist-packages/dulwich/index.pyc in build_index_from_tree(prefix, index_path, object_store, tree_id, honor_filemode)
439 raise
440 else:
--> 441 f = open(full_path, 'wb')
442 try:
443 # Write out file
IOError: [Errno 13] Permission denied: '/tmp/repo/subtree-directory'
We ended up deciding to just remove this subtree: it's unused code anyway, and it only happens on one repository. However, I'm opening the issue just to register the problem. I can try to run some more tests if you guys need more data, but I can't give you the original offending repository for the reasons stated before.
When attempting to install gittle with pip3.4 under ubuntu mimer failed to install.
Still fails with "--allow-external mimer" option.
from command line
jardar@jardar-macBuntu:~/Documents/repos/gittle$ sudo pip3.4 install --allow-external mimer gittle
Downloading/unpacking gittle
Downloading gittle-0.3.0.tar.gz
Running setup.py (path:/tmp/pip_build_root/gittle/setup.py) egg_info for package gittle
Downloading/unpacking paramiko==1.10.0 (from gittle)
Downloading paramiko-1.10.0.tar.gz (822kB): 822kB downloaded
Running setup.py (path:/tmp/pip_build_root/paramiko/setup.py) egg_info for package paramiko
Downloading/unpacking pycrypto==2.6 (from gittle)
Downloading pycrypto-2.6.tar.gz (443kB): 443kB downloaded
Running setup.py (path:/tmp/pip_build_root/pycrypto/setup.py) egg_info for package pycrypto
Downloading/unpacking dulwich (from gittle)
Downloading dulwich-0.9.6.tar.gz (237kB): 237kB downloaded
Running setup.py (path:/tmp/pip_build_root/dulwich/setup.py) egg_info for package dulwich
Downloading/unpacking funky (from gittle)
Downloading funky-0.0.2.tar.gz
Running setup.py (path:/tmp/pip_build_root/funky/setup.py) egg_info for package funky
Downloading/unpacking mimer (from gittle)
Could not find any downloads that satisfy the requirement mimer (from gittle)
Some externally hosted files were ignored (use --allow-external mimer to allow).
Cleaning up...
No distributions at all found for mimer (from gittle)
See https://bugs.launchpad.net/dulwich/+bug/1025886
Client.fetch does not support thin packs right now, so need to remove capability.
It seems the diff output is not showing any text after the line '@@ blah blah @@' <text_missing>.
It shows the text from the next line.
Is there a way to diff versions of the same file? I tried the diff function but appears to be expecting sha for commits.
Hi, I'm using gittle to automate a git process and I'm getting an error just after trying to push changes to a dev branch which is created before the push line.
This is the traceback:
File "informDiffs.py", line 104, in
main()
File "informDiffs.py", line 93, in main
repo.push_to(origin_uri = baseline_remote_path, branch_name = source_branch)
File "/usr/local/lib/python2.7/site-packages/gittle/gittle.py", line 338, in push_to
progress=progress
File "/usr/local/lib/python2.7/site-packages/dulwich/client.py", line 501, in send_pack
proto, negotiated_capabilities, progress)
File "/usr/local/lib/python2.7/site-packages/dulwich/client.py", line 339, in _handle_receive_pack_tail
self._report_status_parser.check()
File "/usr/local/lib/python2.7/site-packages/dulwich/client.py", line 118, in check
ref_status=ref_status)
dulwich.errors.UpdateRefsError: refs/heads/master failed to update
In my code I do:
repo = Gittle(baseline_local_path, origin_uri=baseline_remote_path)
repo.create_branch("master", source_branch)
repo.switch_branch(source_branch)
repo.stage([file])
Then the commit and the push.
Any ideas?
Read from the source code, I couldn't find a method that can diff two different branches. I would like your can support it.
Gittle doesn't work at all with Python3, it would be very nice to get it working because its the best-looking git-libary for python i found so far.
When i tried this library i hit to one problem. If the repository doesn't have master branch, method diff returns keyException. So i suggest add another argument to diff to set branch. This problem can be bypassed setting Gittle.DEFAULT_BRANCH but this is ugly solution.
I installed gittle with python setup.py install
, but pip install -r requirements.txt
doesn't work, as it can't find funky
, and I can't find it either (Google, pypi, easy_install)
Downloading/unpacking funky==0.0.1 (from -r requirements.txt (line 4))
Could not find any downloads that satisfy the requirement funky==0.0.1 (from -r requirements.txt (line 4))
Cleaning up...
No distributions at all found for funky==0.0.1 (from -r requirements.txt (line 4))
Then I tried pip install funky
Downloading/unpacking funky
Could not find any downloads that satisfy the requirement funky
Cleaning up...
No distributions at all found for funky
And here's the content of the pip log file that's created http://p.hasteb.in/?id=cnL
I'm trying to run the gittle.GitServer locally as an experiment for a larger project. I can checkout just fine, except when the client specifies the --depth argument.
> git clone git://localhost/jquery -b 2.0.3 . --progress --depth 1
Cloning into '.'...
fatal: The remote end hung up unexpectedly
(nothing gets printed out in the Python REPL I started the server from.)
I'd be willing to contribute if the fix wasn't too difficult.
I'm checking the viability of using gittle
for https://github.com/learningequality/ka-lite. I made a new clone of ka-lite
on master and switched to the release-0.12.0
branch using the switch_branch
function. The function succeeded with no output, however doing a git status
leaves me with a bunch of new file: ....
lines. Here's a snippet of it:
new file: python-packages/django/utils/simplejson/__init__.py
new file: python-packages/django/utils/simplejson/decoder.py
new file: python-packages/django/utils/simplejson/encoder.py
new file: python-packages/django/utils/simplejson/scanner.py
new file: python-packages/django/utils/simplejson/tool.py
new file: python-packages/django/views/generic/create_update.py
new file: python-packages/django/views/generic/date_based.py
new file: python-packages/django/views/generic/list_detail.py
new file: python-packages/django/views/generic/simple.py
new file: python-packages/mplayer/LICENSE.txt
new file: python-packages/mplayer/__init__.py
new file: python-packages/mplayer/async.py
new file: python-packages/mplayer/core.py
new file: python-packages/mplayer/gevent1.py
new file: python-packages/mplayer/gtk2.py
new file: python-packages/mplayer/misc.py
new file: python-packages/mplayer/mtypes.py
new file: python-packages/mplayer/qt4.py
new file: scripts/get_port.bat
new file: scripts/get_setting.bat
new file: scripts/get_setting.sh
It seems that the old files that were deleted in the new branch are still sticking around.
Don't see anywhere in the source code or the docs for creating tags. This would be really useful.
The git repository I used is encrypted, so the url likes 'ssh://username@company:port/projectname'.
I am trying to use gittle for my git repository, the code as below:
from gittle import Gittle
repo_path = 'D:\Git\projectname'
repo_url = 'ssh://username@company:port/projectname'
repo = Gittle.clone(repo_url,repo_path)
The error as below:
Traceback (most recent call last):
File "D:\software\Java-workstation\git\try2.py", line 31, in
repo = Gittle.clone(repo_url,repo_path)
File "C:\Python27\lib\site-packages\gittle\gittle.py", line 440, in clone
repo.fetch(bare=bare)
File "C:\Python27\lib\site-packages\gittle\gittle.py", line 407, in fetch
remote_refs = self.fetch_remote(origin_uri)
File "C:\Python27\lib\site-packages\gittle\gittle.py", line 364, in fetch_remote
client, remote_path = self.get_client(origin_uri=origin_uri)
File "C:\Python27\lib\site-packages\gittle\gittle.py", line 328, in get_client
client, remote_path = get_transport_and_path(origin_uri, **client_kwargs)
File "C:\Python27\lib\site-packages\dulwich\client.py", line 1125, in get_transport_and_path
user_host, path = location.split(':')
ValueError: too many values to unpack
And it would work fine if I modified the repo_url as below:
from gittle import Gittle
repo_path = 'D:\Git\projectname'
repo_url = 'https://github.com/FriendCode/gittle.git'
repo = Gittle.clone(repo_url,repo_path)
Does this mean I cannot use gittle for git repository that is encrypted? Thanks.
Would be nice to have a dependency list. At this point I know you need:
Both easy_install and pip fail. Easy_install actually installed something, after which i get:
from gittle import Gittle
Traceback (most recent call last):
File "", line 1, in
File "C:\Python33\lib\site-packages\gittle-0.2.1-py3.3.egg\gittle__init__.py", line 1, in <modulefrom . import utils
File "C:\Python33\lib\site-packages\gittle-0.2.1-py3.3.egg\gittle\utils__init__.py", line 1, in <
module>
from . import paths, urls, git
ImportError: cannot import name urls
From a clean clone of the gittle repo:
In [1]: from gittle import Gittle
In [2]: import os
In [3]: repo = Gittle(os.getcwd())
In [5]: repo.modified_unstaged_files
Out[5]:
{'.gitignore',
'LICENSE',
'README.md',
'examples/base.py',
'examples/clone.py',
'examples/clone_bare.py',
'examples/commit.py',
'examples/complete.py',
'examples/config.py',
'examples/diff.py',
'examples/fork.py',
'examples/mv.py',
'examples/paths.py',
'examples/pull.py',
'examples/push.py',
'examples/server.py',
'examples/status.py',
'examples/versions.py',
'gittle/__init__.py',
'gittle/auth.py',
'gittle/exceptions.py',
'gittle/gittle.py',
'gittle/server.py',
'gittle/utils/__init__.py',
'gittle/utils/git.py',
'gittle/utils/paths.py',
'gittle/utils/urls.py',
'setup.py',
'sitecustomize.py'}
In [6]: repo.modified_files
Out[6]: set()
Is this expected behaviour?
Couldn't remove files from repository with gittle.
import os
import gittle
if name == 'main':
repository = os.path.abspath(r'.\data\altium\models')
store = gittle.Gittle(repository)
print store.removed_files
store.rm(store.removed_files)
print store.removed_files
The clone operation succeeds without any issue, but the pull operation fails with KeyError.
Full source code can be found: https://github.com/mickep76/pepa
Code
if config.has_option('git', 'privkey'):
privkey = config.get('git', 'privkey')
key = open(privkey)
auth = GittleAuth(key)
if os.path.isdir(basedir + '/.git'):
if opts.debug:
info("Doing a Git pull for: %s in: %s" % (uri, basedir))
repo = Gittle(basedir, uri)
repo.pull()
else:
if opts.debug:
info("Doing a Git clone for: %s to: %s" % (uri, basedir))
repo = Gittle.clone(uri, basedir)
Error
Traceback (most recent call last): File "./src/pepa.py", line 93, in repo.pull() File "/Library/Python/2.7/site-packages/gittle/gittle.py", line 358, in pull return self.pull_from(origin_uri, branch_name) File "/Library/Python/2.7/site-packages/gittle/gittle.py", line 354, in pull_from return self.fetch(origin_uri) File "/Library/Python/2.7/site-packages/gittle/gittle.py", line 405, in fetch remote_refs = self.fetch_remote(origin_uri) File "/Library/Python/2.7/site-packages/gittle/gittle.py", line 365, in fetch_remote remote_refs = client.fetch(remote_path, self.repo) File "/Library/Python/2.7/site-packages/dulwich/client.py", line 222, in fetch commit() File "/Library/Python/2.7/site-packages/dulwich/object_store.py", line 647, in commit return self.move_in_pack(path) File "/Library/Python/2.7/site-packages/dulwich/object_store.py", line 620, in move_in_pack entries = p.sorted_entries() File "/Library/Python/2.7/site-packages/dulwich/pack.py", line 1119, in sorted_entries ret = list(self.iterentries(progress=progress)) File "/Library/Python/2.7/site-packages/dulwich/pack.py", line 1107, in iterentries for i, result in enumerate(indexer): File "/Library/Python/2.7/site-packages/dulwich/pack.py", line 1254, in _walk_all_chains for result in self._walk_ref_chains(): File "/Library/Python/2.7/site-packages/dulwich/pack.py", line 1264, in _walk_ref_chains self._ensure_no_pending() File "/Library/Python/2.7/site-packages/dulwich/pack.py", line 1260, in _ensure_no_pending raise KeyError([sha_to_hex(s) for s in self._pending_ref]) KeyError: ['e17510adaa64ad4436c9efa9b12a55935e797d95', '5fa426440324ef181ff3b69fbc060ae15052ad1f', '7e9b20dada2566045cc42de8f95501afab8859e8']
After #2 and #3, I managed to get all dependencies installed successfully, but I can't use gittle due to an error in funky:
Python 2.6.6 (r266:84292, Jul 10 2013, 22:48:45)
[GCC 4.4.7 20120313 (Red Hat 4.4.7-3)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> from gittle import gittle
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "gittle/__init__.py", line 1, in <module>
from . import utils
File "gittle/utils/__init__.py", line 1, in <module>
from . import paths, urls, git
File "gittle/utils/paths.py", line 6, in <module>
from funky import first, arglist
File "/home/blha/workspace/gittle/venv/src/funky/funky/__init__.py", line 1, in <module>
from .funky import *
File "/home/blha/workspace/gittle/venv/src/funky/funky/funky.py", line 230
mapper(v): v for v in collection
^
SyntaxError: invalid syntax
Courtesy link to the error location: https://github.com/FriendCode/funky/blob/master/funky/funky.py#L230
Hi, this is the stacktrace:
>>> from gittle import Gittle
>>> from gittle import GittleAuth
>>>
>>> k = open('/tmp/tmp_rsa')
>>> url = 'https://github.com/patrick91/fROLLino-ftw.git'
>>> auth = GittleAuth(pkey=k)
>>> Gittle.clone(url, '/tmp/testclone', auth=auth)
Traceback (most recent call last):
File "<input>", line 1, in <module>
File "/Users/patrick91/.virtualenvs/gittle/lib/python2.7/site-packages/gittle/gittle.py", line 438, in clone
repo.fetch(bare=bare)
File "/Users/patrick91/.virtualenvs/gittle/lib/python2.7/site-packages/gittle/gittle.py", line 405, in fetch
remote_refs = self.fetch_remote(origin_uri)
File "/Users/patrick91/.virtualenvs/gittle/lib/python2.7/site-packages/gittle/gittle.py", line 362, in fetch_remote
client, remote_path = self.get_client(origin_uri=origin_uri)
File "/Users/patrick91/.virtualenvs/gittle/lib/python2.7/site-packages/gittle/gittle.py", line 326, in get_client
client, remote_path = get_transport_and_path(origin_uri, **client_kwargs)
File "/Users/patrick91/.virtualenvs/gittle/lib/python2.7/site-packages/dulwich/client.py", line 981, in get_transport_and_path
return HttpGitClient(urlparse.urlunparse(parsed), **kwargs), parsed.path
File "/Users/patrick91/.virtualenvs/gittle/lib/python2.7/site-packages/dulwich/client.py", line 829, in __init__
GitClient.__init__(self, *args, **kwargs)
TypeError: __init__() got an unexpected keyword argument 'pkey'
I tried to do some fixes, but nothing worked.
This is the output of pip freeze:
GDAL==1.10.0
Pygments==1.6
bpython==0.12
dulwich==0.9.3
funky==0.0.2
gittle==0.2.2
libxml2-python==2.9.1
mimer==0.0.1
paramiko==1.10.0
pycrypto==2.6
Can we get a somewhat stable version of Gittle on PyPI?
I was hoping to call the equivalent of git checkout 13371337
but nothing happened. The code doesn't seem to do anything at all...
When i tried clone some repo i found problem.
File "/usr/local/lib/python2.7/dist-packages/gittle/gittle.py", line 438, in clone
repo.fetch(bare=bare)
File "/usr/local/lib/python2.7/dist-packages/gittle/gittle.py", line 416, in fetch
self._setup_fetched_refs(remote_refs, origin, bare)
File "/usr/local/lib/python2.7/dist-packages/gittle/gittle.py", line 397, in _setup_fetched_refs
self[k] = v
File "/usr/local/lib/python2.7/dist-packages/gittle/gittle.py", line 1171, in setitem
self.repo[key] = value
File "/usr/local/lib/python2.7/dist-packages/dulwich/repo.py", line 522, in setitem
self.refs[name] = value
File "/usr/local/lib/python2.7/dist-packages/dulwich/refs.py", line 257, in setitem
self.set_if_equals(name, None, ref)
File "/usr/local/lib/python2.7/dist-packages/dulwich/refs.py", line 564, in set_if_equals
self._check_refname(name)
File "/usr/local/lib/python2.7/dist-packages/dulwich/refs.py", line 170, in _check_refname
raise RefFormatError(name)
dulwich.errors.RefFormatError: refs/tags/dulwich-0.9.3^{}
Hi,
you are using dulwich which is licensed under the GPLv2 (https://github.com/jelmer/dulwich/blob/master/COPYING). Therefore gittle could be considered as derived work as stated in the GPL license (https://en.wikipedia.org/wiki/GNU_General_Public_License#Linking_and_derived_works). As a final consequence gittle must be licensed under the GPLv2 too. I am not a lawyer so please understand this issue just as a hint.
There's a strange behavior when Gittle works with existing repository containing symbolic links
*Repro code
## Create a repository
git init test
touch one.txt
## Create a symbolic link
ln -s one.txt two.txt
git add .
git commit -m "First commit"
Add a file programatically: test.py
from gittle import Gittle
path = "/home/esparta/test/"
newfile = "three.txt"
repo = Gittle(path)
with open(path+newfile,"w") as f:
f.write("Hola")
repo.add(newfile)
print repo.pending_files_by_state
repo.commit("Espartaco","esparta","Testing soft links")
print repo.pending_files_by_state
Output:
{'three.txt': 'added', 'test.py': 'added', 'two.txt': 'modified'}
WARNING:root:STAGING : set(['two.txt'])
{'test.py': 'added'}
WARNING typechange:
git status
# On branch master
# Changes not staged for commit:
# (use "git add <file>..." to update what will be committed)
# (use "git checkout -- <file>..." to discard changes in working directory)
#
# typechange: two.txt
#
# Untracked files:
# (use "git add <file>..." to include in what will be committed)
#
# test.py
no changes added to commit (use "git add" and/or "git commit -a")
from gittle import Gittle
Traceback (most recent call last):
File "", line 1, in
File "/usr/lib/python2.6/site-packages/gittle-0.5.0-py2.6.egg/gittle/init.py", line 1, in
from . import utils
File "/usr/lib/python2.6/site-packages/gittle-0.5.0-py2.6.egg/gittle/utils/init.py", line 1, in
from . import paths, urls, git
File "/usr/lib/python2.6/site-packages/gittle-0.5.0-py2.6.egg/gittle/utils/git.py", line 243
for oldkey, newkey in key_pairs
^
SyntaxError: invalid syntax
I installed all the packages in requirements.txt but the Gittle listed there is buggy. It fails in Gittle.clone
because in that version at line 415 there is mkdir(local_path)
instead of the current mkdir_safe(localpath)
(current is at line 424).
https://github.com/FriendCode/gittle/blob/master/gittle/gittle.py#L424
I solved by installing the development version from Github.
On python 2.7.8, the code repo.commit_count complains:
File "gittle/gittle.py", line 233, in commit_count
The code runs len() on a generator.
My .gitignore contains a file ".realsync" which shows up in repo.untracked_files.
i'm looking for a gittle/dulwhich equivalent of 'list all known, local commit sha's'::
git rev-list --all
I found ^^^ ... here:
http://stackoverflow.com/questions/7149740/git-list-all-commits-on-all-branches
I thought repo.commits() did it; since i'm in not indicating a brach there, but i'm thinking now that it's only walking commits for HEAD...
Any ideas how to get back a list of ALL local commits, irrelevant of whether or not they map to a branch, HEAD, etc?
Cheers!
-Chris
It was pointed out on Reddit that the license for Gittle is hidden a bit.
Can you add the MIT license as its own file in your repo?
Even though the setup.py tries to work around the need to have the C compiler installed, when installing with pip it will first download the dependencies and install them, before even running the setup.py from gittle, and them the whole installation fails when it can install pycrypto. Maybe the dependencies need to be declared in some other way, for it to work? Or not at all, and leave to the setup.py to install everything?
Hi,
i cant get this working with a bitbucket repo, it raises NotGitRepository() exceptions when i use https:// url and a timeout when i replace https:// with git://
is there any way to use this with bitbucket repos?
I tried some times to checkout a branch using "switch_branch" and got a Windows Error as a surprise while executing "git checkout" in msysgit worked well.
I got a variable repo using "Gittle(path)", and tried "repo.switch_branch('develop')" in IPython. Then it raised an error on the 1138th line in gittle.pyc.
This is the stack:
1136 def clean(self, force=None, directories=None):
1137 untracked_files = self.untracked_files
-> 1138 map(os.remove, untracked_files)
1139 return untracked_files
1140 :
This is the error:
WindowsError: [Error 3] : '.git\objects\pack\pack-56dd36c857ea19d2f082230c23f6af32e1e822b6.idx'
When using username/password to authenticate repo.auth(username=username, password=password)
, once I call repo.push()
I get the following error:
Traceback (most recent call last):
File "git_clone_and_push.py", line 76, in <module>
main()
File "git_clone_and_push.py", line 72, in main
repo.push()
File "/Library/Python/2.7/site-packages/gittle/gittle.py", line 343, in push
return self.push_to(origin_uri, branch_name, progress)
File "/Library/Python/2.7/site-packages/gittle/gittle.py", line 333, in push_to
client, remote_path = self.get_client(origin_uri)
File "/Library/Python/2.7/site-packages/gittle/gittle.py", line 328, in get_client
client, remote_path = get_transport_and_path(origin_uri, **client_kwargs)
File "/Library/Python/2.7/site-packages/dulwich/client.py", line 1105, in get_transport_and_path
return get_transport_and_path_from_url(location, **kwargs)
File "/Library/Python/2.7/site-packages/dulwich/client.py", line 1076, in get_transport_and_path_from_url
return (TCPGitClient(parsed.hostname, port=parsed.port, **kwargs),
File "/Library/Python/2.7/site-packages/dulwich/client.py", line 569, in __init__
TraditionalGitClient.__init__(self, *args, **kwargs)
TypeError: __init__() got an unexpected keyword argument 'username'
> /Library/Python/2.7/site-packages/dulwich/client.py(569)__init__()
-> TraditionalGitClient.__init__(self, *args, **kwargs)
This seems similar to this past issue which was resolved by having a particular egg of dulwich. Possibly the issue I'm experiencing is a result of switching to all dependencies being installed via pip?
UnicodeDecodeError When filename is"article/python2编码问题.md" or has unicode char
dulwich/index.py(423) build_index_from_tree()
-> full_path = os.path.join(prefix, entry.path)
(Pdb) pp prefix
u'E:/work/py/kkblog/article_repo/\u54c8\u54c8\\guyskk\\webhooks_test'
(Pdb) pp entry.path
'article/python2\xe7\xbc\x96\xe7\xa0\x81\xe9\x97\xae\xe9\xa2\x98.md'
(Pdb) os.path.join(prefix, entry.path)
*** UnicodeDecodeError: 'ascii' codec can't decode byte 0xe7 in position 16: ordinal not in range(128)
My script:
# coding:utf-8
def pull_or_clone(dest, repo_url):
from giturlparse import parse
from gittle import Gittle
import os
p = parse(repo_url)
user_repo_path = os.path.join(dest, p.owner, p.repo)
if os.path.exists(user_repo_path):
repo = Gittle(user_repo_path, origin_uri=repo_url)
repo.pull()
else:
repo = Gittle.clone(repo_url, user_repo_path)
if __name__ == '__main__':
dest = u"E:/work/py/kkblog/article_repo/哈哈"
repo_url = u"https://github.com/guyskk/webhooks_test.git"
pull_or_clone(dest, repo_url)
Code
from gittle import Gittle
repo = Gittle('../')
for c in repo.commit_info(start=0, end=0):
print dir(c)
Exception
Traceback (most recent call last):
File "scripts/changelog.py", line 14, in <module>
for c in repo.commit_info(start=0, end=0):
File "/usr/local/lib/python2.7/dist-packages/gittle/gittle.py", line 218, in commit_info
commits = [utils.git.commit_info(entry) for entry in self.branch_walker(branch)]
File "/usr/local/lib/python2.7/dist-packages/gittle/gittle.py", line 211, in branch_walker
return self.ref_walker(ref)
File "/usr/local/lib/python2.7/dist-packages/gittle/gittle.py", line 206, in ref_walker
return self.repo.revision_history(sha)
AttributeError: 'Repo' object has no attribute 'revision_history'
Any clue?
Happens even with a simple commit_count etc
Thanks,
Emmet
Is there a way to do something of the sort -
"git log -p -2"
"git show <commit_id>"
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.