def __init__(self, workspace, content): ''' Constructor ''' self.content = zlib.compress(content) self.sha1 = cal_sha1(content) self.path = os.path.join(workspace, '.git', 'objects', self.sha1[:2], self.sha1[2:])
def __init__(self, final_content=None, sha1=None): ''' Constructor ''' if sha1: self.sha1 = sha1 self.path = os.path.join(OBJECT_DIR, self.sha1[:2], self.sha1[2:]) self.content = read_file(self.path) else: self.content = zlib.compress(final_content) self.sha1 = cal_sha1(final_content) self.path = os.path.join(OBJECT_DIR, self.sha1[:2], self.sha1[2:])
def __init__(self, workspace, final_content=None, sha1=None): ''' Constructor ''' if sha1: self.sha1 = sha1 self.path = os.path.join(workspace, '.git', 'objects', self.sha1[:2], self.sha1[2:]) self.content = read_file(self.path) else: self.content = zlib.compress(final_content) self.sha1 = cal_sha1(final_content) self.path = os.path.join(workspace, '.git', 'objects', self.sha1[:2], self.sha1[2:])