Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def _parse_status(output):
output = output.rstrip('\0')
if not output:
return
output = output.split('\0')
while output:
line = output.pop(0)
if line[0] == Status.RENAMED.value:
yield '{}\0{}'.format(line, output.pop(0))
else:
yield line
def __init__(self, status_string, root_path=None):
status = status_string[:2]
filename = status_string[3:]
self.index = Status(status[0])
self.working_tree = Status(status[1])
self.root_path = root_path
if self.index == Status.RENAMED:
new_filename, old_filename = filename.split('\0')
self.path = Path(new_filename)
self.old_path = Path(old_filename)
else:
self.path = Path(filename)
def __init__(self, status_string, root_path=None):
status = status_string[:2]
filename = status_string[3:]
self.index = Status(status[0])
self.working_tree = Status(status[1])
self.root_path = root_path
if self.index == Status.RENAMED:
new_filename, old_filename = filename.split('\0')
self.path = Path(new_filename)
self.old_path = Path(old_filename)
else:
self.path = Path(filename)
def is_staged_status(status):
return (
status.index != Status.UNMODIFIED
and status.index != Status.UNTRACKED
and status.index != Status.IGNORED
and status.index != Status.DELETED
)
def is_staged_status(status):
return (
status.index != Status.UNMODIFIED
and status.index != Status.UNTRACKED
and status.index != Status.IGNORED
and status.index != Status.DELETED
)
def is_partially_staged_status(status):
return (
status.index != Status.UNMODIFIED
and status.index != Status.UNTRACKED
and status.index != Status.IGNORED
and status.index != Status.DELETED
and status.working_tree != Status.UNMODIFIED
and status.working_tree != Status.UNTRACKED
and status.working_tree != Status.IGNORED
)
def is_partially_staged_status(status):
return (
status.index != Status.UNMODIFIED
and status.index != Status.UNTRACKED
and status.index != Status.IGNORED
and status.index != Status.DELETED
and status.working_tree != Status.UNMODIFIED
and status.working_tree != Status.UNTRACKED
and status.working_tree != Status.IGNORED
)