def extract(view, region, keep): conflict_text = view.substr(region) match = conflict_re.CONFLICT_REGEX.search(conflict_text) # If we didn't matched the group return None if not match.group(keep): sublime.status_message(msgs.get('no_such_group')) return None return conflict_re.CONFLICT_REGEX.sub(r'\g<' + keep + '>', conflict_text)
def find_conflict(view, begin=0): conflict_region = view.find(conflict_re.NO_NAMING_GROUPS_PATTERN, begin) if not conflict_region: conflict_region = view.find(conflict_re.NO_NAMING_GROUPS_PATTERN, 0) if not conflict_region: sublime.status_message(msgs.get('no_conflict_found')) return None return conflict_region
def run(self): # Reload settings settings.load() # Ensure git executable is available if not self.git_executable_available(): sublime.error_message(msgs.get('git_executable_not_found')) return self.git_repo = self.determine_git_repo() if not self.git_repo: sublime.status_message(msgs.get('no_git_repo_found')) return conflict_files = self.get_conflict_files() if not conflict_files: sublime.status_message(msgs.get('no_conflict_files_found', self.git_repo)) return self.show_quickpanel_selection(conflict_files)
def get_representation_list(self, conflict_files): """Returns a list with only filenames if the 'show_only_filenames' option is set, otherwise it returns just a clone of the given list""" result = None if settings.get('show_only_filenames'): result = [] for string in conflict_files: result.append(string.rpartition('/')[2]) else: result = list(conflict_files) # Add an "Open all ..." option result.insert(0, msgs.get('open_all')) return result