Skip to content

Commit

Permalink
[gitstatus.py] Change hardtab -> softtab
Browse files Browse the repository at this point in the history
  • Loading branch information
wkentaro committed Jun 28, 2015
1 parent 6d3c829 commit a9b0aae
Showing 1 changed file with 24 additions and 24 deletions.
48 changes: 24 additions & 24 deletions gitstatus.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
error_string = error.decode('utf-8')

if 'fatal: Not a git repository' in error_string:
sys.exit(0)
sys.exit(0)

branch = branch.decode("utf-8").strip()[11:]

Expand Down Expand Up @@ -43,31 +43,31 @@
ahead, behind = 0,0

if not branch: # not on any branch
branch = prehash + Popen(['git','rev-parse','--short','HEAD'], stdout=PIPE).communicate()[0].decode("utf-8")[:-1]
branch = prehash + Popen(['git','rev-parse','--short','HEAD'], stdout=PIPE).communicate()[0].decode("utf-8")[:-1]
else:
remote_name = Popen(['git','config','branch.%s.remote' % branch], stdout=PIPE).communicate()[0].decode("utf-8").strip()
if remote_name:
merge_name = Popen(['git','config','branch.%s.merge' % branch], stdout=PIPE).communicate()[0].decode("utf-8").strip()
if remote_name == '.': # local
remote_ref = merge_name
else:
remote_ref = 'refs/remotes/%s/%s' % (remote_name, merge_name[11:])
revgit = Popen(['git', 'rev-list', '--left-right', '%s...HEAD' % remote_ref],stdout=PIPE, stderr=PIPE)
revlist = revgit.communicate()[0]
if revgit.poll(): # fallback to local
revlist = Popen(['git', 'rev-list', '--left-right', '%s...HEAD' % merge_name],stdout=PIPE, stderr=PIPE).communicate()[0]
behead = revlist.decode("utf-8").splitlines()
ahead = len([x for x in behead if x[0]=='>'])
behind = len(behead) - ahead
remote_name = Popen(['git','config','branch.%s.remote' % branch], stdout=PIPE).communicate()[0].decode("utf-8").strip()
if remote_name:
merge_name = Popen(['git','config','branch.%s.merge' % branch], stdout=PIPE).communicate()[0].decode("utf-8").strip()
if remote_name == '.': # local
remote_ref = merge_name
else:
remote_ref = 'refs/remotes/%s/%s' % (remote_name, merge_name[11:])
revgit = Popen(['git', 'rev-list', '--left-right', '%s...HEAD' % remote_ref],stdout=PIPE, stderr=PIPE)
revlist = revgit.communicate()[0]
if revgit.poll(): # fallback to local
revlist = Popen(['git', 'rev-list', '--left-right', '%s...HEAD' % merge_name],stdout=PIPE, stderr=PIPE).communicate()[0]
behead = revlist.decode("utf-8").splitlines()
ahead = len([x for x in behead if x[0]=='>'])
behind = len(behead) - ahead

out = ' '.join([
branch,
str(ahead),
str(behind),
str(n_staged),
str(n_conflicts),
str(n_changed),
str(n_untracked),
])
branch,
str(ahead),
str(behind),
str(n_staged),
str(n_conflicts),
str(n_changed),
str(n_untracked),
])
print(out, end='')

0 comments on commit a9b0aae

Please sign in to comment.