# easy_install GitPython
http://packages.python.org/GitPython/0.3.1/intro.html#getting-started
>>> from git import *
>>> r = Repo(".")
>>> r.index.entries
{('README', 0): (100644, 432a4b6de3c8318e1e59178492608cc10e48b00a, 0, README)}
https://github.com/gitpython-developers/gitdb/blob/master/doc/source/tutorial.rst
>>> for k in r.odb.sha_iter():
... r.odb.info(k)
...
('"b\xde\x0c\x12\x1f"\xdf\x8ex\xf5\xa3}n\x11O\xd3"\xc0\xb0', 'blob', 5)
('C*Km\xe3\xc81\x8e\x1eY\x17\x84\x92`\x8c\xc1\x0eH\xb0\n', 'blob', 10)
("I'T\x08\xd5T\xd5[\xaa\xd5\x99\xe5\xb4\x19\xed\x81\xecn\xbd0", 'commit', 190)
('\xd2\x12\x83\xc7\x04E\x08\xcf:J\xac\xce\xfd\x91x\xf6u\x9c#\xda', 'tree', 34)
>>> for k in r.odb.sha_iter():
... r.odb.stream(k).read()
...
'hoge\n'
'hoge\nhoge\n'
'tree d21283c7044508cf3a4aaccefd9178f6759c23da\nauthor NISHIO Hirokazu1303459640 +0900\ncommitter NISHIO Hirokazu 1303459640 +0900\n\nmsg\n'
'100644 README\x00"b\xde\x0c\x12\x1f"\xdf\x8ex\xf5\xa3}n\x11O\xd3"\xc0\xb0'
>>> r.branches # equals to r.heads?
[<git.Head "refs/heads/master">]
>>> r.refs
[<git.Head "refs/heads/master">]
>>> r.tags
[]
[1]+ Stopped python
f$ git branch foo
f$ cat >> README
hogehoge
f$ git commit -a
Waiting for Emacs...
[master 4c1458d] hogehoge
1 files changed, 1 insertions(+), 0 deletions(-)
f$ fg
python
>>> r.branches
[<git.Head "refs/heads/foo">, <git.Head "refs/heads/master">]
>>> [x.object for x in r.branches]
[<git.Commit "49275408d554d55baad599e5b419ed81ec6ebd30">, <git.Commit "4c1458d2547c77d3166edd081b000f87cceb218e">]
[1]+ Stopped python
f$ git reset HEAD^
Unstaged changes after reset:
M README
f$ fg
python
>>> [x.object for x in r.branches]
[<git.Commit "49275408d554d55baad599e5b419ed81ec6ebd30">, <git.Commit "49275408d554d55baad599e5b419ed81ec6ebd30">]
>>> r.head.object
<git.Commit "49275408d554d55baad599e5b419ed81ec6ebd30">
>>>
1 comment:
Never found such informatory contents.
steam wallet hack
Post a Comment