From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from lists.gentoo.org (pigeon.gentoo.org [208.92.234.80]) by finch.gentoo.org (Postfix) with ESMTP id 857611384AE for ; Sat, 19 Sep 2015 04:36:32 +0000 (UTC) Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id F383721C05B; Sat, 19 Sep 2015 04:36:31 +0000 (UTC) Received: from smtp.gentoo.org (smtp.gentoo.org [140.211.166.183]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by pigeon.gentoo.org (Postfix) with ESMTPS id 573EA21C05B for ; Sat, 19 Sep 2015 04:36:31 +0000 (UTC) Received: from oystercatcher.gentoo.org (unknown [IPv6:2a01:4f8:202:4333:225:90ff:fed9:fc84]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by smtp.gentoo.org (Postfix) with ESMTPS id 6BCC6340AC7 for ; Sat, 19 Sep 2015 04:36:30 +0000 (UTC) Received: from localhost.localdomain (localhost [127.0.0.1]) by oystercatcher.gentoo.org (Postfix) with ESMTP id 7C13C206 for ; Sat, 19 Sep 2015 04:36:27 +0000 (UTC) From: "Brian Dolbec" To: gentoo-commits@lists.gentoo.org Content-Transfer-Encoding: 8bit Content-type: text/plain; charset=UTF-8 Reply-To: gentoo-dev@lists.gentoo.org, "Brian Dolbec" Message-ID: <1442635803.f180baffdc7d1eb010a822e3d6585b4a1a635772.dolsen@gentoo> Subject: [gentoo-commits] proj/portage:repoman commit in: pym/repoman/ X-VCS-Repository: proj/portage X-VCS-Files: pym/repoman/actions.py X-VCS-Directories: pym/repoman/ X-VCS-Committer: dolsen X-VCS-Committer-Name: Brian Dolbec X-VCS-Revision: f180baffdc7d1eb010a822e3d6585b4a1a635772 X-VCS-Branch: repoman Date: Sat, 19 Sep 2015 04:36:27 +0000 (UTC) Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-Id: Gentoo Linux mail X-BeenThere: gentoo-commits@lists.gentoo.org X-Archives-Salt: 09a9989d-2234-4f44-af2f-8db94801e7d2 X-Archives-Hash: c873d772ea43dd7186c8a267376319a1 commit: f180baffdc7d1eb010a822e3d6585b4a1a635772 Author: Brian Dolbec gentoo org> AuthorDate: Sat Sep 19 04:10:03 2015 +0000 Commit: Brian Dolbec gentoo org> CommitDate: Sat Sep 19 04:10:03 2015 +0000 URL: https://gitweb.gentoo.org/proj/portage.git/commit/?id=f180baff repoman/actions.py: Split out priming_commit() pym/repoman/actions.py | 91 ++++++++++++++++++++++++++------------------------ 1 file changed, 48 insertions(+), 43 deletions(-) diff --git a/pym/repoman/actions.py b/pym/repoman/actions.py index 06f57a3..a538174 100644 --- a/pym/repoman/actions.py +++ b/pym/repoman/actions.py @@ -205,49 +205,7 @@ class Actions(object): # will change and need a priming commit before the Manifest # can be committed. if (myupdates or myremoved) and myheaders: - myfiles = myupdates + myremoved - fd, commitmessagefile = tempfile.mkstemp(".repoman.msg") - mymsg = os.fdopen(fd, "wb") - mymsg.write(_unicode_encode(commitmessage)) - mymsg.close() - - separator = '-' * 78 - - print() - print(green("Using commit message:")) - print(green(separator)) - print(commitmessage) - print(green(separator)) - print() - - # Having a leading ./ prefix on file paths can trigger a bug in - # the cvs server when committing files to multiple directories, - # so strip the prefix. - myfiles = [f.lstrip("./") for f in myfiles] - - commit_cmd = [self.vcs_settings.vcs] - commit_cmd.extend(self.vcs_settings.vcs_global_opts) - commit_cmd.append("commit") - commit_cmd.extend(self.vcs_settings.vcs_local_opts) - commit_cmd.extend(["-F", commitmessagefile]) - commit_cmd.extend(myfiles) - - try: - if self.options.pretend: - print("(%s)" % (" ".join(commit_cmd),)) - else: - retval = spawn(commit_cmd, env=self.repo_settings.commit_env) - 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) - finally: - try: - os.unlink(commitmessagefile) - except OSError: - pass + 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 @@ -805,3 +763,50 @@ class Actions(object): os.unlink(commitmessagefile) except OSError: pass + + + def priming_commit(self, myupdates, myremoved, commitmessage): + myfiles = myupdates + myremoved + fd, commitmessagefile = tempfile.mkstemp(".repoman.msg") + mymsg = os.fdopen(fd, "wb") + mymsg.write(_unicode_encode(commitmessage)) + mymsg.close() + + separator = '-' * 78 + + print() + print(green("Using commit message:")) + print(green(separator)) + print(commitmessage) + print(green(separator)) + print() + + # Having a leading ./ prefix on file paths can trigger a bug in + # the cvs server when committing files to multiple directories, + # so strip the prefix. + myfiles = [f.lstrip("./") for f in myfiles] + + commit_cmd = [self.vcs_settings.vcs] + commit_cmd.extend(self.vcs_settings.vcs_global_opts) + commit_cmd.append("commit") + commit_cmd.extend(self.vcs_settings.vcs_local_opts) + commit_cmd.extend(["-F", commitmessagefile]) + commit_cmd.extend(myfiles) + + try: + if self.options.pretend: + print("(%s)" % (" ".join(commit_cmd),)) + else: + retval = spawn(commit_cmd, env=self.repo_settings.commit_env) + 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) + finally: + try: + os.unlink(commitmessagefile) + except OSError: + pass +