With git_revparse_sigle I think we could improve object lookups a little bit. For example repo['HEAD'] or repo.lookup_object('HEAD') would be much more convenient to use instead of repo.revparse_single('HEAD'). At the moment the pygit2 api looks a little bit confusing because we just write bindings for c functions. I would like to have a clean well-structured pythonic Repository class instead of just a blind collection of git_* functions.
Something like the following (of course written in c...):
class Repository:
def __init__():
self.head = None
self.path = ''
self.workdir = ''
self.is_detached = False
self.is_orphan = False
self.is_empty = False
self.is_bare = False
self.submodules = []
self.references = []
self.branches = []
self.tags = []
self.remotes = []
self.history = [] #rev walker
self.config = Config()
self.index = Index()
self.status = Status()
self.reflog = RefLog()
def create_blob_from_buffer():
pass
def create_blob_from_file():
pass
def create_tree_from_dir():
pass
def create_tree_from_builder()
pass
def create_commit():
pass
def create_reference():
pass
def create_tag():
pass
def create_branch():
pass
def lookup_object():
pass
def lookup_reference():
pass
def pack_references():
pass
def checkout():
pass
def reset():
pass
def read_raw():
pass
def write_raw():
pass
I don't know if it's really necessary to create all objects through Repository... As well I don't like the naming differences for object creations: repo.create_X or repo.TreeBuilder().write().
What do you think? Some suggestions?
With git_revparse_sigle I think we could improve object lookups a little bit. For example
repo['HEAD']orrepo.lookup_object('HEAD')would be much more convenient to use instead ofrepo.revparse_single('HEAD'). At the moment the pygit2 api looks a little bit confusing because we just write bindings for c functions. I would like to have a clean well-structured pythonic Repository class instead of just a blind collection of git_* functions.Something like the following (of course written in c...):
I don't know if it's really necessary to create all objects through
Repository... As well I don't like the naming differences for object creations:repo.create_Xorrepo.TreeBuilder().write().What do you think? Some suggestions?