Skip to content

Commit

Permalink
Issue 41: Reorder status processing to run macro plugins before check…
Browse files Browse the repository at this point in the history
…ing for uploadable files. Fixes #41.
  • Loading branch information
coddingtonbear committed Oct 12, 2015
1 parent a108a29 commit a5625ca
Show file tree
Hide file tree
Showing 3 changed files with 32 additions and 26 deletions.
2 changes: 1 addition & 1 deletion jirafs/__init__.py
@@ -1 +1 @@
__version__ = '1.15.2'
__version__ = '1.16'
2 changes: 1 addition & 1 deletion jirafs/plugin.py
Expand Up @@ -357,7 +357,7 @@ def get_attributes(self, tag):
continue

attribute, value = segment.split('=', 1)
attributes[attribute] = value
attributes[attribute.strip(':')] = value

return attributes

Expand Down
54 changes: 30 additions & 24 deletions jirafs/ticketfolder.py
Expand Up @@ -598,6 +598,16 @@ def file_matches_globs(self, filename, ignore_globs):
return False

def get_ready_changes(self):
ready = {
'fields': (
self.get_fields('HEAD') - self.get_fields(self.git_merge_base)
),
'links': (
self.get_links('HEAD') - self.get_links(self.git_merge_base)
),
'new_comment': self.get_new_comment(ready=True),
}

changed_files = self.filter_ignored_files(
self.run_git_command(
'diff',
Expand All @@ -607,39 +617,35 @@ def get_ready_changes(self):
constants.LOCAL_ONLY_FILE
)

return {
'fields': (
self.get_fields('HEAD') - self.get_fields(self.git_merge_base)
),
'links': (
self.get_links('HEAD') - self.get_links(self.git_merge_base)
),
'files': changed_files,
'new_comment': self.get_new_comment(ready=True)
}
ready['files'] = changed_files

return ready

def get_uncommitted_changes(self):
uncommitted = {
'fields': self.get_fields() - self.get_fields('HEAD'),
'new_comment': self.get_new_comment(ready=False),
'links': self.get_links() - self.get_links('HEAD'),
}

new_files = self.run_git_command(
'ls-files', '-o', failure_ok=True
).split('\n')
modified_files = self.run_git_command(
'ls-files', '-m', failure_ok=True
).split('\n')

return {
'files': self.filter_ignored_files(
[
filename for filename in new_files + modified_files
if filename
],
constants.LOCAL_ONLY_FILE,
constants.GIT_IGNORE_FILE,
constants.GIT_EXCLUDE_FILE,
),
'fields': self.get_fields() - self.get_fields('HEAD'),
'links': self.get_links() - self.get_links('HEAD'),
'new_comment': self.get_new_comment(ready=False)
}
uncommitted['files'] = self.filter_ignored_files(
[
filename for filename in new_files + modified_files
if filename
],
constants.LOCAL_ONLY_FILE,
constants.GIT_IGNORE_FILE,
constants.GIT_EXCLUDE_FILE,
)

return uncommitted

def get_local_uncommitted_changes(self):
new_files = self.run_git_command(
Expand Down

0 comments on commit a5625ca

Please sign in to comment.