New --local-file argument to be used when --entity is a remote file
This commit is contained in:
parent
4b9d375c90
commit
1ae230639f
9 changed files with 48 additions and 20 deletions
|
@ -3,8 +3,8 @@ usage: wakatime [-h] [--entity FILE] [--key KEY] [--write] [--plugin PLUGIN]
|
|||
[--entity-type ENTITY_TYPE] [--category CATEGORY]
|
||||
[--proxy PROXY] [--no-ssl-verify] [--project PROJECT]
|
||||
[--alternate-project ALTERNATE_PROJECT] [--language LANGUAGE]
|
||||
[--hostname HOSTNAME] [--disable-offline] [--hide-file-names]
|
||||
[--hide-project-names] [--exclude EXCLUDE]
|
||||
[--local-file FILE] [--hostname HOSTNAME] [--disable-offline]
|
||||
[--hide-file-names] [--hide-project-names] [--exclude EXCLUDE]
|
||||
[--exclude-unknown-project] [--include INCLUDE]
|
||||
[--include-only-with-project-file] [--extra-heartbeats]
|
||||
[--log-file LOG_FILE] [--api-url API_URL] [--timeout TIMEOUT]
|
||||
|
|
|
@ -3,8 +3,8 @@ usage: wakatime [-h] [--entity FILE] [--key KEY] [--write] [--plugin PLUGIN]
|
|||
[--entity-type ENTITY_TYPE] [--category CATEGORY]
|
||||
[--proxy PROXY] [--no-ssl-verify] [--project PROJECT]
|
||||
[--alternate-project ALTERNATE_PROJECT] [--language LANGUAGE]
|
||||
[--hostname HOSTNAME] [--disable-offline] [--hide-file-names]
|
||||
[--hide-project-names] [--exclude EXCLUDE]
|
||||
[--local-file FILE] [--hostname HOSTNAME] [--disable-offline]
|
||||
[--hide-file-names] [--hide-project-names] [--exclude EXCLUDE]
|
||||
[--exclude-unknown-project] [--include INCLUDE]
|
||||
[--include-only-with-project-file] [--extra-heartbeats]
|
||||
[--log-file LOG_FILE] [--api-url API_URL] [--timeout TIMEOUT]
|
||||
|
|
|
@ -3,8 +3,8 @@ usage: wakatime [-h] [--entity FILE] [--key KEY] [--write] [--plugin PLUGIN]
|
|||
[--entity-type ENTITY_TYPE] [--category CATEGORY]
|
||||
[--proxy PROXY] [--no-ssl-verify] [--project PROJECT]
|
||||
[--alternate-project ALTERNATE_PROJECT] [--language LANGUAGE]
|
||||
[--hostname HOSTNAME] [--disable-offline] [--hide-file-names]
|
||||
[--hide-project-names] [--exclude EXCLUDE]
|
||||
[--local-file FILE] [--hostname HOSTNAME] [--disable-offline]
|
||||
[--hide-file-names] [--hide-project-names] [--exclude EXCLUDE]
|
||||
[--exclude-unknown-project] [--include INCLUDE]
|
||||
[--include-only-with-project-file] [--extra-heartbeats]
|
||||
[--log-file LOG_FILE] [--api-url API_URL] [--timeout TIMEOUT]
|
||||
|
|
|
@ -3,8 +3,8 @@ usage: wakatime [-h] [--entity FILE] [--key KEY] [--write] [--plugin PLUGIN]
|
|||
[--entity-type ENTITY_TYPE] [--category CATEGORY]
|
||||
[--proxy PROXY] [--no-ssl-verify] [--project PROJECT]
|
||||
[--alternate-project ALTERNATE_PROJECT] [--language LANGUAGE]
|
||||
[--hostname HOSTNAME] [--disable-offline] [--hide-file-names]
|
||||
[--hide-project-names] [--exclude EXCLUDE]
|
||||
[--local-file FILE] [--hostname HOSTNAME] [--disable-offline]
|
||||
[--hide-file-names] [--hide-project-names] [--exclude EXCLUDE]
|
||||
[--exclude-unknown-project] [--include INCLUDE]
|
||||
[--include-only-with-project-file] [--extra-heartbeats]
|
||||
[--log-file LOG_FILE] [--api-url API_URL] [--timeout TIMEOUT]
|
||||
|
@ -46,6 +46,10 @@ optional arguments:
|
|||
project takes priority.
|
||||
--language LANGUAGE Optional language name. If valid, takes priority over
|
||||
auto-detected language.
|
||||
--local-file FILE Absolute path to local file for the heartbeat. When
|
||||
--entity is a remote file, this local file will be
|
||||
used for stats and just the value of --entity sent
|
||||
with heartbeat.
|
||||
--hostname HOSTNAME Hostname of current machine.
|
||||
--disable-offline Disables offline time logging instead of queuing
|
||||
logged time.
|
||||
|
|
|
@ -22,6 +22,7 @@ class HeartbeatTestCase(TestCase):
|
|||
include = []
|
||||
plugin = None
|
||||
include_only_with_project_file = None
|
||||
local_file = None
|
||||
|
||||
data = {
|
||||
'entity': os.path.realpath('tests/samples/codefiles/python.py'),
|
||||
|
@ -56,6 +57,7 @@ class HeartbeatTestCase(TestCase):
|
|||
include = []
|
||||
plugin = None
|
||||
include_only_with_project_file = None
|
||||
local_file = None
|
||||
|
||||
data = {
|
||||
'entity': os.path.realpath('tests/samples/codefiles/python.py'),
|
||||
|
|
|
@ -102,8 +102,9 @@ class LanguagesTestCase(utils.TestCase):
|
|||
with utils.mock.patch('wakatime.stats.smart_guess_lexer') as mock_guess_lexer:
|
||||
mock_guess_lexer.return_value = None
|
||||
source_file = 'tests/samples/codefiles/python.py'
|
||||
result = guess_language(source_file)
|
||||
mock_guess_lexer.assert_called_once_with(source_file)
|
||||
local_file = None
|
||||
result = guess_language(source_file, local_file)
|
||||
mock_guess_lexer.assert_called_once_with(source_file, local_file)
|
||||
self.assertEquals(result, (None, None))
|
||||
|
||||
def test_guess_language_from_vim_modeline(self):
|
||||
|
@ -112,6 +113,13 @@ class LanguagesTestCase(utils.TestCase):
|
|||
entity='python_without_extension',
|
||||
)
|
||||
|
||||
def test_guess_language_when_entity_not_exist_but_local_file_exists(self):
|
||||
source_file = 'tests/samples/codefiles/does_not_exist.py'
|
||||
local_file = 'tests/samples/codefiles/python.py'
|
||||
self.assertFalse(os.path.exists(source_file))
|
||||
result = guess_language(source_file, local_file)
|
||||
self.assertEquals(result[0], 'Python')
|
||||
|
||||
def test_language_arg_takes_priority_over_detected_language(self):
|
||||
self.shared(
|
||||
expected_language='Java',
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue