Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Improve: Add basic diff between commits
- Loading branch information
Aaron O'Mullan
committed
Feb 7, 2013
1 parent
bbc3395
commit 5014d8b
Showing
4 changed files
with
112 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
import sys | ||
sys.setdefaultencoding('latin-1') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
# -*- coding: utf8 -*- | ||
|
||
import os | ||
from gittle import Gittle | ||
from tempfile import mkdtemp | ||
|
||
path = mkdtemp() | ||
fn = 'test.txt' | ||
filename = os.path.join(path, fn) | ||
|
||
name = 'Samy Pessé' | ||
email = 'samypesse@gmail.com' | ||
message = "C'est beau là bas" | ||
|
||
|
||
def create_file(): | ||
fd = open(filename, 'w+') | ||
fd.write('blabla\n BOOM BOOM\n à la montagne') | ||
fd.close() | ||
|
||
repo = Gittle.init(path) | ||
create_file() | ||
|
||
repo.stage(fn) | ||
repo.commit(name=name, email=email, message=message) | ||
|
||
|
||
print('COMMIT_INFO =', repo.commit_info()) | ||
|
||
print('PATH =', path) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
from gittle import Gittle | ||
|
||
repo = Gittle('.') | ||
|
||
lastest = [ | ||
info['sha'] | ||
for info in repo.commit_info()[:2] | ||
] | ||
|
||
print(repo.diff_between(*lastest)) |