def test_update_index_valid_repo(self): self._raw_git_clone( type(self)._repos_dir, type(self)._origin_repo, 'master', 'test-clone') base_dir = _os.path.join(type(self)._repos_dir, 'test-clone') git = GitWrapper(base_dir) git.update_index() return
def _exec_status(self): if not self._is_client_initialized(): raise CommandHandlerError( 'Error: Uninitialized client, ' + 'please run init to initialize the client first') # Parse the manifest XML self._parse_manifest_xml() # Get the client spec name from client info client = self._get_client_spec(self._get_client_info()) # Process each repo in the Client Spec for repo in client.repo_list: git = GitWrapper( _os.path.join(self._current_dir, repo.destination)) Logger.msg('####################################################') Logger.msg('Repo: ' + repo.destination) Logger.msg('Remote URL: ' + repo.url) git.update_index() current_branch = git.get_current_branch() dirty = False if current_branch is None: current_branch = 'Detached HEAD' if current_branch != repo.branch: Logger.msg('Original Branch: ' + repo.branch) Logger.msg('Current Branch: ' + current_branch + '\n') else: Logger.msg('Branch: ' + repo.branch + '\n') untracked_files = git.get_untracked_files() if len(untracked_files) != 0: Logger.msg( 'Untracked Files: \n' + '\n'.join(untracked_files) + '\n') dirty = True unstaged_files = git.get_unstaged_files() if len(unstaged_files) != 0: Logger.msg( 'Unstaged Files: \n' + '\n'.join(unstaged_files) + '\n') dirty = True uncommitted_staged_files = git.get_uncommitted_staged_files() if len(uncommitted_staged_files) != 0: Logger.msg('Uncommitted Changes: \n' + '\n'.join(uncommitted_staged_files) + '\n') dirty = True if not dirty: Logger.msg('No uncommitted changes') Logger.msg('####################################################') return
def _exec_status(self): if not self._is_client_initialized(): raise CommandHandlerError( 'Error: Uninitialized client, ' + 'please run init to initialize the client first') # Parse the manifest XML self._parse_manifest_xml() # Get the client spec name from client info client = self._get_client_spec(self._get_client_info()) # Process each repo in the Client Spec for repo in client.repo_list: git = GitWrapper(_os.path.join(self._current_dir, repo.destination)) Logger.msg('####################################################') Logger.msg('Repo: ' + repo.destination) Logger.msg('Remote URL: ' + repo.url) git.update_index() current_branch = git.get_current_branch() dirty = False if current_branch is None: current_branch = 'Detached HEAD' if current_branch != repo.branch: Logger.msg('Original Branch: ' + repo.branch) Logger.msg('Current Branch: ' + current_branch + '\n') else: Logger.msg('Branch: ' + repo.branch + '\n') untracked_files = git.get_untracked_files() if len(untracked_files) != 0: Logger.msg('Untracked Files: \n' + '\n'.join(untracked_files) + '\n') dirty = True unstaged_files = git.get_unstaged_files() if len(unstaged_files) != 0: Logger.msg('Unstaged Files: \n' + '\n'.join(unstaged_files) + '\n') dirty = True uncommitted_staged_files = git.get_uncommitted_staged_files() if len(uncommitted_staged_files) != 0: Logger.msg('Uncommitted Changes: \n' + '\n'.join(uncommitted_staged_files) + '\n') dirty = True if not dirty: Logger.msg('No uncommitted changes') Logger.msg('####################################################') return
def test_update_index_invalid_repo(self): self._raw_git_clone( type(self)._repos_dir, type(self)._origin_repo, 'master', 'test-clone') base_dir = _os.path.join(type(self)._repos_dir, 'test-clone') git_dir = _os.path.join(base_dir, '.git') ShellHelper.remove_dir(git_dir) with self.assertRaisesRegexp( GitWrapperError, r'^Command \'git update-index -q --ignore-submodules ' + r'--refresh\' failed$'): git = GitWrapper(base_dir) git.update_index() return