upgrade wakatime package to v0.4.8

This commit is contained in:
Alan Hamlett 2013-10-13 16:33:53 -07:00
parent a92ebad2f2
commit e812e9fe15
3 changed files with 23 additions and 19 deletions

View file

@ -3,6 +3,18 @@ History
-------
0.4.8 (2013-10-13)
++++++++++++++++++
- Read git HEAD file to find current branch instead of running git command line
0.4.7 (2013-09-30)
++++++++++++++++++
- Sending local olson timezone string in api request
0.4.6 (2013-09-22)
++++++++++++++++++

View file

@ -12,7 +12,7 @@
from __future__ import print_function
__title__ = 'wakatime'
__version__ = '0.4.7'
__version__ = '0.4.8'
__author__ = 'Alan Hamlett'
__license__ = 'BSD'
__copyright__ = 'Copyright 2013 Alan Hamlett'

View file

@ -11,7 +11,6 @@
import logging
import os
from subprocess import Popen, PIPE
from .base import BaseProject
try:
@ -38,23 +37,16 @@ class Git(BaseProject):
return None
def branch(self):
stdout = None
try:
stdout, stderr = Popen([
'git', 'branch', '--no-color'
], stdout=PIPE, stderr=PIPE, cwd=self._project_base()
).communicate()
except OSError:
pass
if stdout:
for line in stdout.splitlines():
if isinstance(line, bytes):
line = bytes.decode(line)
line = line.split(' ', 1)
if line[0] == '*':
return line[1]
return None
branch = None
base = self._project_base()
if base:
head = os.path.join(self._project_base(), '.git', 'HEAD')
try:
with open(head) as f:
branch = f.readline().strip().rsplit('/', 1)[-1]
except IOError:
pass
return branch
def _project_base(self):
if self.config: