upgrade wakatime plugin to v0.4.8
This commit is contained in:
parent
6ba24c7214
commit
e48c148334
3 changed files with 23 additions and 19 deletions
|
@ -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)
|
||||
++++++++++++++++++
|
||||
|
||||
|
|
|
@ -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'
|
||||
|
|
|
@ -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
|
||||
branch = None
|
||||
base = self._project_base()
|
||||
if base:
|
||||
head = os.path.join(self._project_base(), '.git', 'HEAD')
|
||||
try:
|
||||
stdout, stderr = Popen([
|
||||
'git', 'branch', '--no-color'
|
||||
], stdout=PIPE, stderr=PIPE, cwd=self._project_base()
|
||||
).communicate()
|
||||
except OSError:
|
||||
with open(head) as f:
|
||||
branch = f.readline().strip().rsplit('/', 1)[-1]
|
||||
except IOError:
|
||||
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
|
||||
|
||||
return branch
|
||||
|
||||
def _project_base(self):
|
||||
if self.config:
|
||||
|
|
Loading…
Reference in a new issue