FriendCode / gittle

Pythonic Git for Humans
Other
732 stars 90 forks source link

Is repo #73

Closed iLoveTux closed 8 years ago

iLoveTux commented 8 years ago

Added a classmethod to Gittle which returns True if path is a repo, False if it is not. I've found this useful to make my code more readable for example:

instead of

import sys
from gittle import Gittle
from dulwich.errors import NotGitRepository

try:
    repo = Gittle('/path')
except NotGitRepository:
    print("Not a git repository")
    sys.exit(-1)

I can write

from gittle import Gittle

if not Gittle.is_repo('/path'):
    print("Not a git repository")
    sys.exit(-1)
AaronO commented 8 years ago

@iLoveTux Thanks, that's a nice small utility function !