package_clear = True for package in pkg.packages: if io.runCommandMuted("screen -ls | grep {}".format(package)): io.printAsync(io.Empty(), "checking executables in ", package, "..", io.Progress()) stdout = subprocess.check_output(["screen", "-ls | grep", package]).decode("utf-8") executables = re.findall('__([a-z + _]+)', stdout) if len(executables)>0: for executable in executables: if package_clear: io.println(io.Warn(), "some packages are running:") package_clear = False target_packages.append(package) target_executables.append(executable) io.println(io.WarnList(), executable, "in", package) if len(target_executables) == 0: string = io.println(io.Fail(), "no executable is running") io.exitSuccess() elif len(target_executables) == 1: string = io.scanln(io.Warn(), "do you want to kill it? (yes/no):") else: string = io.scanln(io.Warn(), "do you want to kill them? (yes/no):") io.newLine() if string == 'no': io.println(io.Fail(), "cancelled") io.exitFail() elif string != 'yes': io.println(io.Fail(), "invalid input, cancelled")
if not pkg.packageIsGitRepository(args.package): io.println(io.Fail(), args.package, "is not a git repository") io.exitFail() repo = pkg.getPackageRepo(args.package) package_clear = True io.printAsync(io.Empty(), "checking untracked files in", args.package, "\b..", io.Progress()) untracked_files = repo.untracked_files if len(untracked_files) > 0: package_clear = False io.println(io.Warn(), "found", len(untracked_files), "untracked files:") for untracked_file in untracked_files: io.println(io.WarnList(), untracked_file) io.newLine() io.printAsync(io.Empty(), "checking modified files in", args.package, "\b..", io.Progress()) modified_files = [item.a_path for item in repo.index.diff(None)] if len(modified_files) > 0: package_clear = False io.println(io.Warn(), "found", len(modified_files), "modified files:") for modified_file in modified_files: io.println(io.WarnList(), modified_file) io.newLine() io.printAsync(io.Empty(), "checking uncommitted changes in", args.package, "\b..", io.Progress()) uncommitted_changes = pkg.getUncommittedChanges(repo)
io.println( io.Fail(), "current date and time are behind last committed date and time") io.exitFail() io.printAsync(io.Empty(), "staging files..", io.Progress()) repo.git.add('--all') uncommitted_changes = pkg.getUncommittedChanges(repo) if len(uncommitted_changes) < 1: io.println(io.Success(), "nothing to be committed") io.exitSuccess() io.println(io.Warn(), "changes to be committed:") for uncommitted_change in uncommitted_changes: io.println(io.WarnList(), uncommitted_change) io.newLine() io.printAsync(io.Empty(), "checking author info..", io.Progress()) author_name = "" author_email = "" try: author_name = os.environ['KURO_AUTHOR_NAME'] author_email = os.environ['KURO_AUTHOR_EMAIL'] if len(author_name) < 1 or len(author_email) < 1: raise KeyError except KeyError:
if fetch_info.flags & git.FetchInfo.NEW_HEAD != 0: if package_clear: io.println(io.Warn(), package, "pull from origin remote:") package_clear = False io.println(io.SuccessList(), "update", fetch_info.ref, "to '{}'".format(fetch_info.commit.summary)) io.printAsync(io.Empty(), "checking diffs..", io.Progress()) try: commits_behind = pkg.getCommitsBehind(repo) commits_ahead = pkg.getCommitsAhead(repo) except git.GitCommandError: if package_clear: io.println(io.Warn(), package, "pull from origin remote:") package_clear = False io.println(io.WarnList(), "remote does not have", repo.active_branch, "branch") all_clear = False continue if len(commits_behind) == 0: if len(commits_ahead) > 0: if package_clear: io.println(io.Warn(), package, "pull from origin remote:") package_clear = False io.println(io.WarnList(), package, "is ahead of master by", io.PluralCount('commit', len(commits_ahead))) all_clear = False continue else: io.println(io.Success(), package, "is up to date with origin")
continue repo = pkg.getPackageRepo(package) package_clear = True io.printAsync(io.Empty(), "checking untracked files in", package, "\b..", io.Progress()) untracked_files = repo.untracked_files if len(untracked_files) > 0: all_clear = False if package_clear: io.println(io.Warn(), package, "({})".format(repo.active_branch), "has some problems:") package_clear = False io.println(io.WarnList(), "found", len(untracked_files), "untracked files") io.printAsync(io.Empty(), "checking modified files in", package, "\b..", io.Progress()) modified_files = [item.a_path for item in repo.index.diff(None)] if len(modified_files) > 0: all_clear = False if package_clear: io.println(io.Warn(), package, "({})".format(repo.active_branch), "has some problems:") package_clear = False io.println(io.WarnList(), "found", len(modified_files), "modified files") io.printAsync(io.Empty(), "checking uncommitted changes in", package,
if fetch_info.flags & git.FetchInfo.NEW_HEAD != 0: if package_clear: io.println(io.Warn(), package, "push to origin remote:") package_clear = False io.println(io.SuccessList(), "update", fetch_info.ref, "to '{}'".format(fetch_info.commit.summary)) io.printAsync(io.Empty(), "checking diffs..", io.Progress()) try: commits_behind = pkg.getCommitsBehind(repo) commits_ahead = pkg.getCommitsAhead(repo) except git.GitCommandError: if package_clear: io.println(io.Warn(), package, "push to origin remote:") package_clear = False io.println(io.WarnList(), "remote does not have", repo.active_branch, "branch") all_clear = False continue if len(commits_ahead) == 0: if len(commits_behind) > 0: if package_clear: io.println(io.Warn(), package, "push to origin remote:") package_clear = False io.println(io.WarnList(), package, "is behind of master by", io.PluralCount('commit', len(commits_behind))) all_clear = False continue else: io.println(io.Success(), package, "is up to date with origin")