public inbox for gentoo-commits@lists.gentoo.org
 help / color / mirror / Atom feed
* [gentoo-commits] proj/portage:repoman commit in: pym/repoman/modules/vcs/git/, pym/repoman/modules/vcs/, pym/repoman/
@ 2016-02-16  2:29 Brian Dolbec
  0 siblings, 0 replies; 2+ messages in thread
From: Brian Dolbec @ 2016-02-16  2:29 UTC (permalink / raw
  To: gentoo-commits

commit:     fa1d64140144d9874065ea8cd5993ff184c5f234
Author:     Brian Dolbec <dolsen <AT> gentoo <DOT> org>
AuthorDate: Wed Feb 10 18:05:46 2016 +0000
Commit:     Brian Dolbec <dolsen <AT> gentoo <DOT> org>
CommitDate: Wed Feb 10 18:05:46 2016 +0000
URL:        https://gitweb.gentoo.org/proj/portage.git/commit/?id=fa1d6414

repoman: Migrate vcs index update code to the vcs modules

 pym/repoman/actions.py                 | 22 +---------------------
 pym/repoman/modules/vcs/changes.py     |  4 ++++
 pym/repoman/modules/vcs/git/changes.py | 27 +++++++++++++++++++++++++++
 3 files changed, 32 insertions(+), 21 deletions(-)

diff --git a/pym/repoman/actions.py b/pym/repoman/actions.py
index 21e7db6..4209d13 100644
--- a/pym/repoman/actions.py
+++ b/pym/repoman/actions.py
@@ -163,27 +163,7 @@ class Actions(object):
 		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.vcs_settings.changes.update_index(mymanifests, myupdates)
 
 		self.add_manifest(mymanifests, myheaders, myupdates, myremoved, commitmessage)
 

diff --git a/pym/repoman/modules/vcs/changes.py b/pym/repoman/modules/vcs/changes.py
index 27b627f..948407c 100644
--- a/pym/repoman/modules/vcs/changes.py
+++ b/pym/repoman/modules/vcs/changes.py
@@ -85,3 +85,7 @@ class ChangesBase(object):
 	def clear_attic(myheaders):
 		'''Old CVS leftover'''
 		pass
+
+	def update_index(self, mymanifests, myupdates):
+		'''Update the vcs's modified index if it is needed'''
+		pass

diff --git a/pym/repoman/modules/vcs/git/changes.py b/pym/repoman/modules/vcs/git/changes.py
index 1970b3a..018458c 100644
--- a/pym/repoman/modules/vcs/git/changes.py
+++ b/pym/repoman/modules/vcs/git/changes.py
@@ -2,11 +2,16 @@
 Git module Changes class submodule
 '''
 
+import logging
+import sys
+
 from repoman.modules.vcs.changes import ChangesBase
 from repoman._subprocess import repoman_popen
 from repoman._portage import portage
 from portage import os
 from portage.package.ebuild.digestgen import digestgen
+from portage.process import spawn
+from portage.util import writemsg_level
 
 
 class Changes(ChangesBase):
@@ -63,3 +68,25 @@ class Changes(ChangesBase):
 			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)
+
+	def update_index(self, mymanifests, myupdates):
+		# 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)


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* [gentoo-commits] proj/portage:repoman commit in: pym/repoman/modules/vcs/git/, pym/repoman/modules/vcs/, pym/repoman/
@ 2016-03-08  3:15 Brian Dolbec
  0 siblings, 0 replies; 2+ messages in thread
From: Brian Dolbec @ 2016-03-08  3:15 UTC (permalink / raw
  To: gentoo-commits

commit:     44dc766f997d718352a8d44bb3606444c1515a7a
Author:     Brian Dolbec <dolsen <AT> gentoo <DOT> org>
AuthorDate: Wed Feb 10 18:05:46 2016 +0000
Commit:     Brian Dolbec <dolsen <AT> gentoo <DOT> org>
CommitDate: Tue Mar  8 03:13:28 2016 +0000
URL:        https://gitweb.gentoo.org/proj/portage.git/commit/?id=44dc766f

repoman: Migrate vcs index update code to the vcs modules

 pym/repoman/actions.py                 | 22 +---------------------
 pym/repoman/modules/vcs/changes.py     |  4 ++++
 pym/repoman/modules/vcs/git/changes.py | 27 +++++++++++++++++++++++++++
 3 files changed, 32 insertions(+), 21 deletions(-)

diff --git a/pym/repoman/actions.py b/pym/repoman/actions.py
index 21e7db6..4209d13 100644
--- a/pym/repoman/actions.py
+++ b/pym/repoman/actions.py
@@ -163,27 +163,7 @@ class Actions(object):
 		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.vcs_settings.changes.update_index(mymanifests, myupdates)
 
 		self.add_manifest(mymanifests, myheaders, myupdates, myremoved, commitmessage)
 

diff --git a/pym/repoman/modules/vcs/changes.py b/pym/repoman/modules/vcs/changes.py
index 27b627f..948407c 100644
--- a/pym/repoman/modules/vcs/changes.py
+++ b/pym/repoman/modules/vcs/changes.py
@@ -85,3 +85,7 @@ class ChangesBase(object):
 	def clear_attic(myheaders):
 		'''Old CVS leftover'''
 		pass
+
+	def update_index(self, mymanifests, myupdates):
+		'''Update the vcs's modified index if it is needed'''
+		pass

diff --git a/pym/repoman/modules/vcs/git/changes.py b/pym/repoman/modules/vcs/git/changes.py
index 1970b3a..018458c 100644
--- a/pym/repoman/modules/vcs/git/changes.py
+++ b/pym/repoman/modules/vcs/git/changes.py
@@ -2,11 +2,16 @@
 Git module Changes class submodule
 '''
 
+import logging
+import sys
+
 from repoman.modules.vcs.changes import ChangesBase
 from repoman._subprocess import repoman_popen
 from repoman._portage import portage
 from portage import os
 from portage.package.ebuild.digestgen import digestgen
+from portage.process import spawn
+from portage.util import writemsg_level
 
 
 class Changes(ChangesBase):
@@ -63,3 +68,25 @@ class Changes(ChangesBase):
 			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)
+
+	def update_index(self, mymanifests, myupdates):
+		# 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)


^ permalink raw reply related	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2016-03-08  3:15 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-02-16  2:29 [gentoo-commits] proj/portage:repoman commit in: pym/repoman/modules/vcs/git/, pym/repoman/modules/vcs/, pym/repoman/ Brian Dolbec
  -- strict thread matches above, loose matches on Subject: below --
2016-03-08  3:15 Brian Dolbec

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox