def inform(self, can_force, result): '''Inform the user of all the problems found''' if self.suggest['ignore_masked'] or self.suggest['include_dev']: self._suggest() if self.options.mode != 'commit': self._non_commit(result) return False else: self._fail(result, can_force) if self.options.pretend: utilities.repoman_sez( "\"So, you want to play it safe. Good call.\"\n") return True
def inform(self, can_force, result): '''Inform the user of all the problems found''' if self.suggest['ignore_masked'] or self.suggest['include_dev']: self._suggest() if self.options.mode != 'commit': self._non_commit(result) return False else: self._fail(result, can_force) if self.options.pretend: utilities.repoman_sez( "\"So, you want to play it safe. Good call.\"\n") return True
def inform(self, can_force, result): """Inform the user of all the problems found""" if (self.suggest["ignore_masked"] or self.suggest["include_dev"]) and not self.options.quiet: self._suggest() if self.options.mode != "commit": self._non_commit(result) return False else: self._fail(result, can_force) if self.options.pretend: utilities.repoman_sez( '"So, you want to play it safe. Good call."\n') return True
def _fail(self, result, can_force): if result[ 'fail'] and can_force and self.options.force and not self.options.pretend: utilities.repoman_sez( " \"You want to commit even with these QA issues?\n" " I'll take it this time, but I'm not happy.\"\n") elif result['fail']: if self.options.force and not can_force: print( bad("The --force option has been disabled" " due to extraordinary issues.")) print(bad("Please fix these important QA issues first.")) utilities.repoman_sez("\"Make your QA payment on time" " and you'll never see the likes of me.\"\n") sys.exit(1)
def _fail(self, result, can_force): if result['fail'] and can_force and self.options.force and not self.options.pretend: utilities.repoman_sez( " \"You want to commit even with these QA issues?\n" " I'll take it this time, but I'm not happy.\"\n") elif result['fail']: if self.options.force and not can_force: print(bad( "The --force option has been disabled" " due to extraordinary issues.")) print(bad("Please fix these important QA issues first.")) utilities.repoman_sez( "\"Make your QA payment on time" " and you'll never see the likes of me.\"\n") sys.exit(1)
def get_vcs_changed(self): '''Holding function which calls the approriate VCS module for the data''' changes = self.vcs_settings.changes # re-run the scan to pick up a newly modified Manifest file logging.debug("RE-scanning for changes...") changes.scan() if not changes.has_changes: utilities.repoman_sez( "\"Doing nothing is not always good for QA.\"") print() print("(Didn't find any changed files...)") print() sys.exit(1) return (changes.new, changes.changed, changes.removed, changes.no_expansion, changes.expansion)
def get_vcs_changed(self): '''Holding function which calls the approriate VCS module for the data''' changes = self.vcs_settings.changes # re-run the scan to pick up a newly modified Manifest file logging.debug("RE-scanning for changes...") changes.scan() if not changes.has_changes: utilities.repoman_sez( "\"Doing nothing is not always good for QA.\"") print() print("(Didn't find any changed files...)") print() sys.exit(1) return (changes.new, changes.changed, changes.removed, changes.no_expansion, changes.expansion)
def get_vcs_changed(self, mydeleted): '''Holding function which calls the approriate VCS module for the data''' changed = ([], [], [], [], []) if self.vcs_settings.vcs: vcs_module = getattr(self, '_get_changed_%s_' % self.vcs_settings.vcs) changed = vcs_module(mydeleted) mynew, mychanged, myremoved, no_expansion, expansion = changed a_file_is_changed = mychanged or mynew or myremoved a_file_is_deleted_hg = self.vcs_settings.vcs == "hg" and mydeleted if not (a_file_is_changed or a_file_is_deleted_hg): utilities.repoman_sez( "\"Doing nothing is not always good for QA.\"") print() print("(Didn't find any changed files...)") print() sys.exit(1) return changed
def get_vcs_changed(self, mydeleted): '''Holding function which calls the approriate VCS module for the data''' changed = ([], [], [], [], []) if self.vcs_settings.vcs: vcs_module = getattr(self, '_get_changed_%s_' % self.vcs_settings.vcs) changed = vcs_module(mydeleted) mynew, mychanged, myremoved, no_expansion, expansion = changed a_file_is_changed = mychanged or mynew or myremoved a_file_is_deleted_hg = self.vcs_settings.vcs == "hg" and mydeleted if not (a_file_is_changed or a_file_is_deleted_hg): utilities.repoman_sez( "\"Doing nothing is not always good for QA.\"") print() print("(Didn't find any changed files...)") print() sys.exit(1) return changed
def _non_commit(self, result): if result['full']: print(bold("Note: type \"repoman full\" for a complete listing.")) if result['warn'] and not result['fail']: utilities.repoman_sez( "\"You're only giving me a partial QA payment?\n" " I'll take it this time, but I'm not happy.\"") elif not result['fail']: utilities.repoman_sez( "\"If everyone were like you, I'd be out of business!\"") elif result['fail']: print(bad("Please fix these important QA issues first.")) utilities.repoman_sez("\"Make your QA payment on time" " and you'll never see the likes of me.\"\n") sys.exit(1)
def _non_commit(self, result): if result['full']: print(bold("Note: type \"repoman full\" for a complete listing.")) if result['warn'] and not result['fail']: utilities.repoman_sez( "\"You're only giving me a partial QA payment?\n" " I'll take it this time, but I'm not happy.\"") elif not result['fail']: utilities.repoman_sez( "\"If everyone were like you, I'd be out of business!\"") elif result['fail']: print(bad("Please fix these important QA issues first.")) utilities.repoman_sez( "\"Make your QA payment on time" " and you'll never see the likes of me.\"\n") sys.exit(1)
def _non_commit(self, result): if result["full"]: print(bold('Note: type "repoman full" for a complete listing.')) if result["warn"] and not result["fail"]: if self.options.quiet: print(bold("Non-Fatal QA errors found")) else: utilities.repoman_sez( "\"You're only giving me a partial QA payment?\n" " I'll take it this time, but I'm not happy.\"" ) elif not result["fail"]: if self.options.quiet: print("No QA issues found") else: utilities.repoman_sez( '"If everyone were like you, I\'d be out of business!"') elif result["fail"]: print(bad("Please fix these important QA issues first.")) if not self.options.quiet: utilities.repoman_sez( '"Make your QA payment on time' " and you'll never see the likes of me.\"\n")
def perform(self, qa_output): myautoadd = self._vcs_autoadd() self._vcs_deleted() changes = self.get_vcs_changed() mynew, mychanged, myremoved, no_expansion, expansion = changes # Manifests need to be regenerated after all other commits, so don't commit # them now even if they have changed. mymanifests = set() myupdates = set() for f in mychanged + mynew: if "Manifest" == os.path.basename(f): mymanifests.add(f) else: myupdates.add(f) myupdates.difference_update(myremoved) myupdates = list(myupdates) mymanifests = list(mymanifests) myheaders = [] commitmessage = self.options.commitmsg if self.options.commitmsgfile: try: f = io.open( _unicode_encode( self.options.commitmsgfile, encoding=_encodings['fs'], errors='strict'), mode='r', encoding=_encodings['content'], errors='replace') commitmessage = f.read() f.close() del f except (IOError, OSError) as e: if e.errno == errno.ENOENT: portage.writemsg( "!!! File Not Found:" " --commitmsgfile='%s'\n" % self.options.commitmsgfile) else: raise if commitmessage[:9].lower() in ("cat/pkg: ",): commitmessage = self.msg_prefix() + commitmessage[9:] if not commitmessage or not commitmessage.strip(): commitmessage = self.get_new_commit_message(qa_output) commitmessage = commitmessage.rstrip() # Update copyright for new and changed files year = time.strftime('%Y', time.gmtime()) for fn in chain(mynew, mychanged): if fn.endswith('.diff') or fn.endswith('.patch'): continue update_copyright(fn, year, pretend=self.options.pretend) myupdates, broken_changelog_manifests = self.changelogs( myupdates, mymanifests, myremoved, mychanged, myautoadd, mynew, commitmessage) lines = commitmessage.splitlines() lastline = lines[-1] if len(lines) == 1 or re.match(r'^\S+:\s', lastline) is None: commitmessage += '\n' commit_footer = self.get_commit_footer() commitmessage += commit_footer print("* %s files being committed..." % green(str(len(myupdates))), end=' ') if not self.vcs_settings.needs_keyword_expansion: # With some VCS types there's never any keyword expansion, so # there's no need to regenerate manifests and all files will be # committed in one big commit at the end. logging.debug("VCS type doesn't need keyword expansion") print() elif not self.repo_settings.repo_config.thin_manifest: logging.debug("perform: Calling thick_manifest()") self.vcs_settings.changes.thick_manifest(myupdates, myheaders, no_expansion, expansion) logging.info("myupdates: %s", myupdates) logging.info("myheaders: %s", myheaders) uq = UserQuery(self.options) if self.options.ask and uq.query('Commit changes?', True) != 'Yes': print("* aborting commit.") sys.exit(128 + signal.SIGINT) # Handle the case where committed files have keywords which # will change and need a priming commit before the Manifest # can be committed. if (myupdates or myremoved) and myheaders: self.priming_commit(myupdates, myremoved, commitmessage) # When files are removed and re-added, the cvs server will put /Attic/ # inside the $Header path. This code detects the problem and corrects it # so that the Manifest will generate correctly. See bug #169500. # Use binary mode in order to avoid potential character encoding issues. self.vcs_settings.changes.clear_attic(myheaders) if self.scanner.repolevel == 1: utilities.repoman_sez( "\"You're rather crazy... " "doing the entire repository.\"\n") self.vcs_settings.changes.digest_regen(myupdates, myremoved, mymanifests, self.scanner, broken_changelog_manifests) if self.repo_settings.sign_manifests: self.sign_manifest(myupdates, myremoved, mymanifests) self.vcs_settings.changes.update_index(mymanifests, myupdates) self.add_manifest(mymanifests, myheaders, myupdates, myremoved, commitmessage) if self.options.quiet: return print() if self.vcs_settings.vcs: print("Commit complete.") else: print( "repoman was too scared" " by not seeing any familiar version control file" " that he forgot to commit anything") utilities.repoman_sez( "\"If everyone were like you, I'd be out of business!\"\n") return
def perform(self, qa_output): myautoadd = self._vcs_autoadd() self._vcs_deleted() changes = self.get_vcs_changed() mynew, mychanged, myremoved, no_expansion, expansion = changes # Manifests need to be regenerated after all other commits, so don't commit # them now even if they have changed. mymanifests = set() myupdates = set() for f in mychanged + mynew: if "Manifest" == os.path.basename(f): mymanifests.add(f) else: myupdates.add(f) myupdates.difference_update(myremoved) myupdates = list(myupdates) mymanifests = list(mymanifests) myheaders = [] commitmessage = self.options.commitmsg if self.options.commitmsgfile: try: f = io.open(_unicode_encode(self.options.commitmsgfile, encoding=_encodings['fs'], errors='strict'), mode='r', encoding=_encodings['content'], errors='replace') commitmessage = f.read() f.close() del f except (IOError, OSError) as e: if e.errno == errno.ENOENT: portage.writemsg("!!! File Not Found:" " --commitmsgfile='%s'\n" % self.options.commitmsgfile) else: raise if commitmessage[:9].lower() in ("cat/pkg: ", ): commitmessage = self.msg_prefix() + commitmessage[9:] if not commitmessage or not commitmessage.strip(): commitmessage = self.get_new_commit_message(qa_output) commitmessage = commitmessage.rstrip() # Update copyright for new and changed files year = time.strftime('%Y', time.gmtime()) for fn in chain(mynew, mychanged): if fn.endswith('.diff') or fn.endswith('.patch'): continue update_copyright(fn, year, pretend=self.options.pretend) myupdates, broken_changelog_manifests = self.changelogs( myupdates, mymanifests, myremoved, mychanged, myautoadd, mynew, commitmessage) lines = commitmessage.splitlines() lastline = lines[-1] if len(lines) == 1 or re.match(r'^\S+:\s', lastline) is None: commitmessage += '\n' commit_footer = self.get_commit_footer() commitmessage += commit_footer print("* %s files being committed..." % green(str(len(myupdates))), end=' ') if not self.vcs_settings.needs_keyword_expansion: # With some VCS types there's never any keyword expansion, so # there's no need to regenerate manifests and all files will be # committed in one big commit at the end. logging.debug("VCS type doesn't need keyword expansion") print() elif not self.repo_settings.repo_config.thin_manifest: logging.debug("perform: Calling thick_manifest()") self.vcs_settings.changes.thick_manifest(myupdates, myheaders, no_expansion, expansion) logging.info("myupdates: %s", myupdates) logging.info("myheaders: %s", myheaders) uq = UserQuery(self.options) if self.options.ask and uq.query('Commit changes?', True) != 'Yes': print("* aborting commit.") sys.exit(128 + signal.SIGINT) # Handle the case where committed files have keywords which # will change and need a priming commit before the Manifest # can be committed. if (myupdates or myremoved) and myheaders: self.priming_commit(myupdates, myremoved, commitmessage) # When files are removed and re-added, the cvs server will put /Attic/ # inside the $Header path. This code detects the problem and corrects it # so that the Manifest will generate correctly. See bug #169500. # Use binary mode in order to avoid potential character encoding issues. self.vcs_settings.changes.clear_attic(myheaders) if self.scanner.repolevel == 1: utilities.repoman_sez("\"You're rather crazy... " "doing the entire repository.\"\n") self.vcs_settings.changes.digest_regen(myupdates, myremoved, mymanifests, self.scanner, broken_changelog_manifests) if self.repo_settings.sign_manifests: self.sign_manifest(myupdates, myremoved, mymanifests) self.vcs_settings.changes.update_index(mymanifests, myupdates) self.add_manifest(mymanifests, myheaders, myupdates, myremoved, commitmessage) if self.options.quiet: return print() if self.vcs_settings.vcs: print("Commit complete.") else: print("repoman was too scared" " by not seeing any familiar version control file" " that he forgot to commit anything") utilities.repoman_sez( "\"If everyone were like you, I'd be out of business!\"\n") return
def perform(self, qa_output): myautoadd = self._vcs_autoadd() self._vcs_deleted() changes = self.get_vcs_changed() mynew, mychanged, myremoved, no_expansion, expansion = changes # Manifests need to be regenerated after all other commits, so don't commit # them now even if they have changed. mymanifests = set() myupdates = set() for f in mychanged + mynew: if "Manifest" == os.path.basename(f): mymanifests.add(f) else: myupdates.add(f) myupdates.difference_update(myremoved) myupdates = list(myupdates) mymanifests = list(mymanifests) myheaders = [] commitmessage = self.options.commitmsg if self.options.commitmsgfile: try: f = io.open( _unicode_encode( self.options.commitmsgfile, encoding=_encodings["fs"], errors="strict", ), mode="r", encoding=_encodings["content"], errors="replace", ) commitmessage = f.read() f.close() del f except (IOError, OSError) as e: if e.errno == errno.ENOENT: portage.writemsg("!!! File Not Found:" " --commitmsgfile='%s'\n" % self.options.commitmsgfile) else: raise if commitmessage[:9].lower() in ("cat/pkg: ", ): commitmessage = self.msg_prefix() + commitmessage[9:] if commitmessage is not None and commitmessage.strip(): res, expl = self.verify_commit_message(commitmessage) if not res: print(bad("RepoMan does not like your commit message:")) print(expl) if self.options.force: print("(but proceeding due to --force)") else: sys.exit(1) else: commitmessage = None msg_qa_output = qa_output initial_message = None while True: commitmessage = self.get_new_commit_message( msg_qa_output, commitmessage) res, expl = self.verify_commit_message(commitmessage) if res: break else: full_expl = ( """Issues with the commit message were found. Please fix it or remove the whole commit message to abort. """ + expl) msg_qa_output = [ " %s\n" % x for x in full_expl.splitlines() ] + qa_output commitmessage = commitmessage.rstrip() # Update copyright for new and changed files year = time.strftime("%Y", time.gmtime()) updated_copyright = [] for fn in chain(mynew, mychanged): if fn.endswith(".diff") or fn.endswith(".patch"): continue if update_copyright(fn, year, pretend=self.options.pretend): updated_copyright.append(fn) if updated_copyright and not ( self.options.pretend or self.repo_settings.repo_config.thin_manifest): for cp in sorted(self._vcs_files_to_cps(iter(updated_copyright))): self._manifest_gen(cp) myupdates, broken_changelog_manifests = self.changelogs( myupdates, mymanifests, myremoved, mychanged, myautoadd, mynew, commitmessage, ) lines = commitmessage.splitlines() lastline = lines[-1] if len(lines) == 1 or re.match(r"^\S+:\s", lastline) is None: commitmessage += "\n" commit_footer = self.get_commit_footer() commitmessage += commit_footer print("* %s files being committed..." % green(str(len(myupdates))), end=" ") if not self.vcs_settings.needs_keyword_expansion: # With some VCS types there's never any keyword expansion, so # there's no need to regenerate manifests and all files will be # committed in one big commit at the end. logging.debug("VCS type doesn't need keyword expansion") print() elif not self.repo_settings.repo_config.thin_manifest: logging.debug("perform: Calling thick_manifest()") self.vcs_settings.changes.thick_manifest(myupdates, myheaders, no_expansion, expansion) logging.info("myupdates: %s", myupdates) logging.info("myheaders: %s", myheaders) uq = UserQuery(self.options) if self.options.ask and uq.query("Commit changes?", True) != "Yes": print("* aborting commit.") sys.exit(128 + signal.SIGINT) # Handle the case where committed files have keywords which # will change and need a priming commit before the Manifest # can be committed. if (myupdates or myremoved) and myheaders: self.priming_commit(myupdates, myremoved, commitmessage) # When files are removed and re-added, the cvs server will put /Attic/ # inside the $Header path. This code detects the problem and corrects it # so that the Manifest will generate correctly. See bug #169500. # Use binary mode in order to avoid potential character encoding issues. self.vcs_settings.changes.clear_attic(myheaders) if self.scanner.repolevel == 1: utilities.repoman_sez("\"You're rather crazy... " 'doing the entire repository."\n') self.vcs_settings.changes.digest_regen(myupdates, myremoved, mymanifests, self.scanner, broken_changelog_manifests) if self.repo_settings.sign_manifests: self.sign_manifest(myupdates, myremoved, mymanifests) self.vcs_settings.changes.update_index(mymanifests, myupdates) self.add_manifest(mymanifests, myheaders, myupdates, myremoved, commitmessage) if self.options.quiet: return print() if self.vcs_settings.vcs: print("Commit complete.") else: print("repoman was too scared" " by not seeing any familiar version control file" " that he forgot to commit anything") utilities.repoman_sez( '"If everyone were like you, I\'d be out of business!"\n') return
def perform(self, qa_output): myunadded, mydeleted = self._vcs_unadded() myautoadd = self._vcs_autoadd(myunadded) self._vcs_deleted(mydeleted) changes = self.get_vcs_changed(mydeleted) mynew, mychanged, myremoved, no_expansion, expansion = changes # Manifests need to be regenerated after all other commits, so don't commit # them now even if they have changed. mymanifests = set() myupdates = set() for f in mychanged + mynew: if "Manifest" == os.path.basename(f): mymanifests.add(f) else: myupdates.add(f) myupdates.difference_update(myremoved) myupdates = list(myupdates) mymanifests = list(mymanifests) myheaders = [] commitmessage = self.options.commitmsg if self.options.commitmsgfile: try: f = io.open(_unicode_encode(self.options.commitmsgfile, encoding=_encodings['fs'], errors='strict'), mode='r', encoding=_encodings['content'], errors='replace') commitmessage = f.read() f.close() del f except (IOError, OSError) as e: if e.errno == errno.ENOENT: portage.writemsg("!!! File Not Found:" " --commitmsgfile='%s'\n" % self.options.commitmsgfile) else: raise if not commitmessage or not commitmessage.strip(): commitmessage = self.get_new_commit_message(qa_output) commitmessage = commitmessage.rstrip() myupdates, broken_changelog_manifests = self.changelogs( myupdates, mymanifests, myremoved, mychanged, myautoadd, mynew, commitmessage) commit_footer = self.get_commit_footer() commitmessage += commit_footer print("* %s files being committed..." % green(str(len(myupdates))), end=' ') if self.vcs_settings.vcs not in ('cvs', 'svn'): # With git, bzr and hg, there's never any keyword expansion, so # there's no need to regenerate manifests and all files will be # committed in one big commit at the end. print() elif not self.repo_settings.repo_config.thin_manifest: self.thick_manifest(myupdates, myheaders, no_expansion, expansion) logging.info("myupdates: %s", myupdates) logging.info("myheaders: %s", myheaders) uq = UserQuery(self.options) if self.options.ask and uq.query('Commit changes?', True) != 'Yes': print("* aborting commit.") sys.exit(128 + signal.SIGINT) # Handle the case where committed files have keywords which # will change and need a priming commit before the Manifest # can be committed. if (myupdates or myremoved) and myheaders: self.priming_commit(myupdates, myremoved, commitmessage) # When files are removed and re-added, the cvs server will put /Attic/ # inside the $Header path. This code detects the problem and corrects it # so that the Manifest will generate correctly. See bug #169500. # Use binary mode in order to avoid potential character encoding issues. self.clear_attic(myheaders) if self.scanner.repolevel == 1: utilities.repoman_sez("\"You're rather crazy... " "doing the entire repository.\"\n") if self.vcs_settings.vcs in ('cvs', 'svn') and (myupdates or myremoved): for x in sorted( vcs_files_to_cps(chain(myupdates, myremoved, mymanifests), self.scanner.repolevel, self.scanner.reposplit, self.scanner.categories)): self.repoman_settings["O"] = os.path.join( self.repo_settings.repodir, x) digestgen(mysettings=self.repoman_settings, myportdb=self.repo_settings.portdb) elif broken_changelog_manifests: for x in broken_changelog_manifests: self.repoman_settings["O"] = os.path.join( self.repo_settings.repodir, x) digestgen(mysettings=self.repoman_settings, myportdb=self.repo_settings.portdb) if self.repo_settings.sign_manifests: self.sign_manifest(myupdates, myremoved, mymanifests) if self.vcs_settings.vcs == 'git': # It's not safe to use the git commit -a option since there might # be some modified files elsewhere in the working tree that the # user doesn't want to commit. Therefore, call git update-index # in order to ensure that the index is updated with the latest # versions of all new and modified files in the relevant portion # of the working tree. myfiles = mymanifests + myupdates myfiles.sort() update_index_cmd = ["git", "update-index"] update_index_cmd.extend(f.lstrip("./") for f in myfiles) if self.options.pretend: print("(%s)" % (" ".join(update_index_cmd), )) else: retval = spawn(update_index_cmd, env=os.environ) if retval != os.EX_OK: writemsg_level("!!! Exiting on %s (shell) " "error code: %s\n" % (self.vcs_settings.vcs, retval), level=logging.ERROR, noiselevel=-1) sys.exit(retval) self.add_manifest(mymanifests, myheaders, myupdates, myremoved, commitmessage) if self.options.quiet: return print() if self.vcs_settings.vcs: print("Commit complete.") else: print("repoman was too scared" " by not seeing any familiar version control file" " that he forgot to commit anything") utilities.repoman_sez( "\"If everyone were like you, I'd be out of business!\"\n") return
def perform(self, qa_output): myunadded, mydeleted = self._vcs_unadded() myautoadd = self._vcs_autoadd(myunadded) self._vcs_deleted(mydeleted) changes = self.get_vcs_changed(mydeleted) mynew, mychanged, myremoved, no_expansion, expansion = changes # Manifests need to be regenerated after all other commits, so don't commit # them now even if they have changed. mymanifests = set() myupdates = set() for f in mychanged + mynew: if "Manifest" == os.path.basename(f): mymanifests.add(f) else: myupdates.add(f) myupdates.difference_update(myremoved) myupdates = list(myupdates) mymanifests = list(mymanifests) myheaders = [] commitmessage = self.options.commitmsg if self.options.commitmsgfile: try: f = io.open( _unicode_encode( self.options.commitmsgfile, encoding=_encodings['fs'], errors='strict'), mode='r', encoding=_encodings['content'], errors='replace') commitmessage = f.read() f.close() del f except (IOError, OSError) as e: if e.errno == errno.ENOENT: portage.writemsg( "!!! File Not Found:" " --commitmsgfile='%s'\n" % self.options.commitmsgfile) else: raise if not commitmessage or not commitmessage.strip(): commitmessage = self.get_new_commit_message(qa_output) commitmessage = commitmessage.rstrip() myupdates, broken_changelog_manifests = self.changelogs( myupdates, mymanifests, myremoved, mychanged, myautoadd, mynew, commitmessage) commit_footer = self.get_commit_footer() commitmessage += commit_footer print("* %s files being committed..." % green(str(len(myupdates))), end=' ') if self.vcs_settings.vcs not in ('cvs', 'svn'): # With git, bzr and hg, there's never any keyword expansion, so # there's no need to regenerate manifests and all files will be # committed in one big commit at the end. print() elif not self.repo_settings.repo_config.thin_manifest: self.thick_manifest(myupdates, myheaders, no_expansion, expansion) logging.info("myupdates: %s", myupdates) logging.info("myheaders: %s", myheaders) uq = UserQuery(self.options) if self.options.ask and uq.query('Commit changes?', True) != 'Yes': print("* aborting commit.") sys.exit(128 + signal.SIGINT) # Handle the case where committed files have keywords which # will change and need a priming commit before the Manifest # can be committed. if (myupdates or myremoved) and myheaders: self.priming_commit(myupdates, myremoved, commitmessage) # When files are removed and re-added, the cvs server will put /Attic/ # inside the $Header path. This code detects the problem and corrects it # so that the Manifest will generate correctly. See bug #169500. # Use binary mode in order to avoid potential character encoding issues. self.clear_attic(myheaders) if self.scanner.repolevel == 1: utilities.repoman_sez( "\"You're rather crazy... " "doing the entire repository.\"\n") if self.vcs_settings.vcs in ('cvs', 'svn') and (myupdates or myremoved): for x in sorted(vcs_files_to_cps( chain(myupdates, myremoved, mymanifests), self.scanner.repolevel, self.scanner.reposplit, self.scanner.categories)): self.repoman_settings["O"] = os.path.join(self.repo_settings.repodir, x) digestgen(mysettings=self.repoman_settings, myportdb=self.repo_settings.portdb) elif broken_changelog_manifests: for x in broken_changelog_manifests: self.repoman_settings["O"] = os.path.join(self.repo_settings.repodir, x) digestgen(mysettings=self.repoman_settings, myportdb=self.repo_settings.portdb) if self.repo_settings.sign_manifests: self.sign_manifest(myupdates, myremoved, mymanifests) if self.vcs_settings.vcs == 'git': # It's not safe to use the git commit -a option since there might # be some modified files elsewhere in the working tree that the # user doesn't want to commit. Therefore, call git update-index # in order to ensure that the index is updated with the latest # versions of all new and modified files in the relevant portion # of the working tree. myfiles = mymanifests + myupdates myfiles.sort() update_index_cmd = ["git", "update-index"] update_index_cmd.extend(f.lstrip("./") for f in myfiles) if self.options.pretend: print("(%s)" % (" ".join(update_index_cmd),)) else: retval = spawn(update_index_cmd, env=os.environ) if retval != os.EX_OK: writemsg_level( "!!! Exiting on %s (shell) " "error code: %s\n" % (self.vcs_settings.vcs, retval), level=logging.ERROR, noiselevel=-1) sys.exit(retval) self.add_manifest(mymanifests, myheaders, myupdates, myremoved, commitmessage) if self.options.quiet: return print() if self.vcs_settings.vcs: print("Commit complete.") else: print( "repoman was too scared" " by not seeing any familiar version control file" " that he forgot to commit anything") utilities.repoman_sez( "\"If everyone were like you, I'd be out of business!\"\n") return