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

commit:     4369c655f1eee13e1ddd3047f867b7cfdb3e79cf
Author:     Brian Dolbec <dolsen <AT> gentoo <DOT> org>
AuthorDate: Sat Jan 30 07:58:04 2016 +0000
Commit:     Brian Dolbec <dolsen <AT> gentoo <DOT> org>
CommitDate: Sun Jan 31 19:59:51 2016 +0000
URL:        https://gitweb.gentoo.org/proj/portage.git/commit/?id=4369c655

repoman: Create docstrings for all new vcs module files

 pym/repoman/modules/vcs/None/changes.py |  9 ++++++++-
 pym/repoman/modules/vcs/None/status.py  | 35 ++++++++++++++++++++++++++++++---
 pym/repoman/modules/vcs/bzr/__init__.py |  2 +-
 pym/repoman/modules/vcs/bzr/changes.py  |  9 ++++++++-
 pym/repoman/modules/vcs/bzr/status.py   | 30 ++++++++++++++++++++++++++++
 pym/repoman/modules/vcs/changes.py      |  3 +++
 pym/repoman/modules/vcs/cvs/__init__.py |  2 +-
 pym/repoman/modules/vcs/cvs/changes.py  |  8 +++++++-
 pym/repoman/modules/vcs/cvs/status.py   | 18 +++++++++++++++++
 pym/repoman/modules/vcs/git/__init__.py |  2 +-
 pym/repoman/modules/vcs/git/changes.py  |  9 ++++++++-
 pym/repoman/modules/vcs/git/status.py   | 33 +++++++++++++++++++++++++++----
 pym/repoman/modules/vcs/hg/__init__.py  |  2 +-
 pym/repoman/modules/vcs/hg/changes.py   |  9 ++++++++-
 pym/repoman/modules/vcs/hg/status.py    | 31 +++++++++++++++++++++++++++++
 pym/repoman/modules/vcs/settings.py     |  2 +-
 pym/repoman/modules/vcs/svn/__init__.py |  2 +-
 pym/repoman/modules/vcs/svn/changes.py  |  9 ++++++++-
 pym/repoman/modules/vcs/svn/status.py   | 27 ++++++++++++++++++++++---
 19 files changed, 220 insertions(+), 22 deletions(-)

diff --git a/pym/repoman/modules/vcs/None/changes.py b/pym/repoman/modules/vcs/None/changes.py
index f95af69..759b554 100644
--- a/pym/repoman/modules/vcs/None/changes.py
+++ b/pym/repoman/modules/vcs/None/changes.py
@@ -1,4 +1,6 @@
-
+'''
+None module Changes class submodule
+'''
 
 from repoman.modules.vcs.changes import ChangesBase
 
@@ -11,7 +13,12 @@ class Changes(ChangesBase):
 	vcs = 'None'
 
 	def __init__(self, options):
+		'''Class init
+
+		@param options: commandline options
+		'''
 		super(Changes, self).__init__(options)
 
 	def scan(self):
+		'''VCS type scan function, looks for all detectable changes'''
 		pass

diff --git a/pym/repoman/modules/vcs/None/status.py b/pym/repoman/modules/vcs/None/status.py
index b23fa10..d6e5ca0 100644
--- a/pym/repoman/modules/vcs/None/status.py
+++ b/pym/repoman/modules/vcs/None/status.py
@@ -1,24 +1,53 @@
-
+'''
+None (non-VCS) module Status class submodule
+'''
 
 
 class Status(object):
+	'''Performs status checks on the svn repository'''
 
 	def __init__(self, qatracker, eadded):
+		'''Class init
+
+		@param qatracker: QATracker class instance
+		@param eadded: list
+		'''
 		self.qatracker = qatracker
 		self.eadded = eadded
 
 	def check(self, checkdir, checkdir_relative, xpkg):
+		'''Perform the svn status check
+
+		@param checkdir: string of the directory being checked
+		@param checkdir_relative: string of the relative directory being checked
+		@param xpkg: string of the package being checked
+		@returns: boolean
+		'''
 		return True
 
 	@staticmethod
-	def supports_gpg_sign():
+	def detect_conflicts(options):
+		'''Are there any merge conflicts present in the VCS tracking system
+
+		@param options: command line options
+		@returns: Boolean
+		'''
 		return False
 
 	@staticmethod
-	def detect_conflicts(options):
+	def supports_gpg_sign():
+		'''Does this vcs system support gpg commit signatures
+
+		@returns: Boolean
+		'''
 		return False
 
 	@staticmethod
 	def isVcsDir(dirname):
+		'''Is the directory belong to the vcs system
+
+		@param dirname: string, directory name
+		@returns: Boolean
+		'''
 		return False
 

diff --git a/pym/repoman/modules/vcs/bzr/__init__.py b/pym/repoman/modules/vcs/bzr/__init__.py
index 1192782..4490ed8 100644
--- a/pym/repoman/modules/vcs/bzr/__init__.py
+++ b/pym/repoman/modules/vcs/bzr/__init__.py
@@ -1,7 +1,7 @@
 # Copyright 2014-2015 Gentoo Foundation
 # Distributed under the terms of the GNU General Public License v2
 
-doc = """BZR plug-in module for portage.
+doc = """Bazaar (bzr) plug-in module for portage.
 Performs variaous Bazaar actions and checks on repositories."""
 __doc__ = doc[:]
 

diff --git a/pym/repoman/modules/vcs/bzr/changes.py b/pym/repoman/modules/vcs/bzr/changes.py
index 41ce347..519d311 100644
--- a/pym/repoman/modules/vcs/bzr/changes.py
+++ b/pym/repoman/modules/vcs/bzr/changes.py
@@ -1,4 +1,6 @@
-
+'''
+Bazaar module Changes class submodule
+'''
 
 from repoman.modules.vcs.changes import ChangesBase
 from repoman._subprocess import repoman_popen
@@ -12,9 +14,14 @@ class Changes(ChangesBase):
 	vcs = 'bzr'
 
 	def __init__(self, options):
+		'''Class init
+
+		@param options: commandline options
+		'''
 		super(Changes, self).__init__(options)
 
 	def _scan(self):
+		'''VCS type scan function, looks for all detectable changes'''
 		with repoman_popen("bzr status -S .") as f:
 			bzrstatus = f.readlines()
 		self.changed = [

diff --git a/pym/repoman/modules/vcs/bzr/status.py b/pym/repoman/modules/vcs/bzr/status.py
index e375b05..d5f3326 100644
--- a/pym/repoman/modules/vcs/bzr/status.py
+++ b/pym/repoman/modules/vcs/bzr/status.py
@@ -1,3 +1,6 @@
+'''
+Bazaar module Status class submodule
+'''
 
 from repoman._portage import portage
 from portage import os
@@ -5,12 +8,25 @@ from repoman._subprocess import repoman_popen
 
 
 class Status(object):
+	'''Performs status checks on the svn repository'''
 
 	def __init__(self, qatracker, eadded):
+		'''Class init
+
+		@param qatracker: QATracker class instance
+		@param eadded: list
+		'''
 		self.qatracker = qatracker
 		self.eadded = eadded
 
 	def check(self, checkdir, checkdir_relative, xpkg):
+		'''Perform the svn status check
+
+		@param checkdir: string of the directory being checked
+		@param checkdir_relative: string of the relative directory being checked
+		@param xpkg: string of the package being checked
+		@returns: boolean
+		'''
 		try:
 			myf = repoman_popen(
 				"bzr ls -v --kind=file " +
@@ -29,12 +45,26 @@ class Status(object):
 
 	@staticmethod
 	def detect_conflicts(options):
+		'''Are there any merge conflicts present in the VCS tracking system
+
+		@param options: command line options
+		@returns: Boolean
+		'''
 		return False
 
 	@staticmethod
 	def supports_gpg_sign():
+		'''Does this vcs system support gpg commit signatures
+
+		@returns: Boolean
+		'''
 		return False
 
 	@staticmethod
 	def isVcsDir(dirname):
+		'''Is the directory belong to the vcs system
+
+		@param dirname: string, directory name
+		@returns: Boolean
+		'''
 		return dirname in [".bzr"]

diff --git a/pym/repoman/modules/vcs/changes.py b/pym/repoman/modules/vcs/changes.py
index 6eefaed..76ad591 100644
--- a/pym/repoman/modules/vcs/changes.py
+++ b/pym/repoman/modules/vcs/changes.py
@@ -1,3 +1,6 @@
+'''
+Base Changes class
+'''
 
 import os
 from itertools import chain

diff --git a/pym/repoman/modules/vcs/cvs/__init__.py b/pym/repoman/modules/vcs/cvs/__init__.py
index ba60e2c..0b4587b 100644
--- a/pym/repoman/modules/vcs/cvs/__init__.py
+++ b/pym/repoman/modules/vcs/cvs/__init__.py
@@ -1,7 +1,7 @@
 # Copyright 2014-2015 Gentoo Foundation
 # Distributed under the terms of the GNU General Public License v2
 
-doc = """CVS plug-in module for portage.
+doc = """CVS (cvs) plug-in module for portage.
 Performs variaous CVS actions and checks on repositories."""
 __doc__ = doc[:]
 

diff --git a/pym/repoman/modules/vcs/cvs/changes.py b/pym/repoman/modules/vcs/cvs/changes.py
index cdfb4b2..3ef91cc 100644
--- a/pym/repoman/modules/vcs/cvs/changes.py
+++ b/pym/repoman/modules/vcs/cvs/changes.py
@@ -1,4 +1,6 @@
-
+'''
+CVS module Changes class submodule
+'''
 
 import re
 
@@ -15,6 +17,10 @@ class Changes(ChangesBase):
 	vcs = 'cvs'
 
 	def __init__(self, options):
+		'''Class init
+
+		@param options: commandline options
+		'''
 		super(Changes, self).__init__(options)
 		self._tree = None
 

diff --git a/pym/repoman/modules/vcs/cvs/status.py b/pym/repoman/modules/vcs/cvs/status.py
index 24e2825..1917bde 100644
--- a/pym/repoman/modules/vcs/cvs/status.py
+++ b/pym/repoman/modules/vcs/cvs/status.py
@@ -1,3 +1,6 @@
+'''
+CVS module Status class submodule
+'''
 
 import logging
 import subprocess
@@ -11,8 +14,14 @@ from portage import _unicode_encode, _unicode_decode
 
 
 class Status(object):
+	'''Performs status checks on the svn repository'''
 
 	def __init__(self, qatracker, eadded):
+		'''Class init
+
+		@param qatracker: QATracker class instance
+		@param eadded: list
+		'''
 		self.qatracker = qatracker
 		self.eadded = eadded
 
@@ -106,8 +115,17 @@ class Status(object):
 
 	@staticmethod
 	def supports_gpg_sign():
+		'''Does this vcs system support gpg commit signatures
+
+		@returns: Boolean
+		'''
 		return False
 
 	@staticmethod
 	def isVcsDir(dirname):
+		'''Is the directory belong to the vcs system
+
+		@param dirname: string, directory name
+		@returns: Boolean
+		'''
 		return dirname in ["CVS"]

diff --git a/pym/repoman/modules/vcs/git/__init__.py b/pym/repoman/modules/vcs/git/__init__.py
index e077767..eecd4a1 100644
--- a/pym/repoman/modules/vcs/git/__init__.py
+++ b/pym/repoman/modules/vcs/git/__init__.py
@@ -1,7 +1,7 @@
 # Copyright 2014-2015 Gentoo Foundation
 # Distributed under the terms of the GNU General Public License v2
 
-doc = """Git plug-in module for portage.
+doc = """Git (git) plug-in module for portage.
 Performs variaous git actions and checks on repositories."""
 __doc__ = doc[:]
 

diff --git a/pym/repoman/modules/vcs/git/changes.py b/pym/repoman/modules/vcs/git/changes.py
index 0342251..d0b6acd 100644
--- a/pym/repoman/modules/vcs/git/changes.py
+++ b/pym/repoman/modules/vcs/git/changes.py
@@ -1,4 +1,6 @@
-
+'''
+Git module Changes class submodule
+'''
 
 from repoman.modules.vcs.changes import ChangesBase
 from repoman._subprocess import repoman_popen
@@ -12,9 +14,14 @@ class Changes(ChangesBase):
 	vcs = 'git'
 
 	def __init__(self, options):
+		'''Class init
+
+		@param options: commandline options
+		'''
 		super(Changes, self).__init__(options)
 
 	def _scan(self):
+		'''VCS type scan function, looks for all detectable changes'''
 		with repoman_popen(
 			"git diff-index --name-only "
 			"--relative --diff-filter=M HEAD") as f:

diff --git a/pym/repoman/modules/vcs/git/status.py b/pym/repoman/modules/vcs/git/status.py
index 5ab5f94..963abf6 100644
--- a/pym/repoman/modules/vcs/git/status.py
+++ b/pym/repoman/modules/vcs/git/status.py
@@ -1,3 +1,6 @@
+'''
+Git module Status class submodule
+'''
 
 import re
 
@@ -7,12 +10,25 @@ from repoman._subprocess import repoman_popen, repoman_getstatusoutput
 
 
 class Status(object):
+	'''Performs status checks on the svn repository'''
 
 	def __init__(self, qatracker, eadded):
+		'''Class init
+
+		@param qatracker: QATracker class instance
+		@param eadded: list
+		'''
 		self.qatracker = qatracker
 		self.eadded = eadded
 
 	def check(self, checkdir, checkdir_relative, xpkg):
+		'''Perform the svn status check
+
+		@param checkdir: string of the directory being checked
+		@param checkdir_relative: string of the relative directory being checked
+		@param xpkg: string of the package being checked
+		@returns: boolean
+		'''
 		myf = repoman_popen(
 			"git ls-files --others %s" %
 			(portage._shell_quote(checkdir_relative),))
@@ -25,7 +41,20 @@ class Status(object):
 		return True
 
 	@staticmethod
+	def detect_conflicts(options):
+		'''Are there any merge conflicts present in the VCS tracking system
+
+		@param options: command line options
+		@returns: Boolean
+		'''
+		return False
+
+	@staticmethod
 	def supports_gpg_sign():
+		'''Does this vcs system support gpg commit signatures
+
+		@returns: Boolean
+		'''
 		status, cmd_output = \
 			repoman_getstatusoutput("git --version")
 		cmd_output = cmd_output.split()
@@ -40,10 +69,6 @@ class Status(object):
 		return False
 
 	@staticmethod
-	def detect_conflicts(options):
-		return False
-
-	@staticmethod
 	def isVcsDir(dirname):
 		return dirname in [".git"]
 

diff --git a/pym/repoman/modules/vcs/hg/__init__.py b/pym/repoman/modules/vcs/hg/__init__.py
index 6737dfb..2e39970 100644
--- a/pym/repoman/modules/vcs/hg/__init__.py
+++ b/pym/repoman/modules/vcs/hg/__init__.py
@@ -1,7 +1,7 @@
 # Copyright 2014-2015 Gentoo Foundation
 # Distributed under the terms of the GNU General Public License v2
 
-doc = """HG plug-in module for portage.
+doc = """Mercurial (hg) plug-in module for portage.
 Performs variaous mercurial actions and checks on repositories."""
 __doc__ = doc[:]
 

diff --git a/pym/repoman/modules/vcs/hg/changes.py b/pym/repoman/modules/vcs/hg/changes.py
index f4e1ec8..9729085 100644
--- a/pym/repoman/modules/vcs/hg/changes.py
+++ b/pym/repoman/modules/vcs/hg/changes.py
@@ -1,4 +1,6 @@
-
+'''
+Mercurial module Changes class submodule
+'''
 
 from repoman.modules.vcs.changes import ChangesBase
 from repoman._subprocess import repoman_popen
@@ -12,9 +14,14 @@ class Changes(ChangesBase):
 	vcs = 'hg'
 
 	def __init__(self, options):
+		'''Class init
+
+		@param options: commandline options
+		'''
 		super(Changes, self).__init__(options)
 
 	def _scan(self):
+		'''VCS type scan function, looks for all detectable changes'''
 		with repoman_popen("hg status --no-status --modified .") as f:
 			changed = f.readlines()
 		self.changed = ["./" + elem.rstrip() for elem in changed]

diff --git a/pym/repoman/modules/vcs/hg/status.py b/pym/repoman/modules/vcs/hg/status.py
index 0058794..a3081cb 100644
--- a/pym/repoman/modules/vcs/hg/status.py
+++ b/pym/repoman/modules/vcs/hg/status.py
@@ -1,15 +1,32 @@
+'''
+Mercurial module Status class submodule
+'''
 
 from repoman._portage import portage
 from portage import os
 from repoman._subprocess import repoman_popen
 
+
 class Status(object):
+	'''Performs status checks on the svn repository'''
 
 	def __init__(self, qatracker, eadded):
+		'''Class init
+
+		@param qatracker: QATracker class instance
+		@param eadded: list
+		'''
 		self.qatracker = qatracker
 		self.eadded = eadded
 
 	def check(self, checkdir, checkdir_relative, xpkg):
+		'''Perform the svn status check
+
+		@param checkdir: string of the directory being checked
+		@param checkdir_relative: string of the relative directory being checked
+		@param xpkg: string of the package being checked
+		@returns: boolean
+		'''
 		myf = repoman_popen(
 			"hg status --no-status --unknown %s" %
 			(portage._shell_quote(checkdir_relative),))
@@ -23,12 +40,26 @@ class Status(object):
 
 	@staticmethod
 	def detect_conflicts(options):
+		'''Are there any merge conflicts present in the VCS tracking system
+
+		@param options: command line options
+		@returns: Boolean
+		'''
 		return False
 
 	@staticmethod
 	def supports_gpg_sign():
+		'''Does this vcs system support gpg commit signatures
+
+		@returns: Boolean
+		'''
 		return False
 
 	@staticmethod
 	def isVcsDir(dirname):
+		'''Is the directory belong to the vcs system
+
+		@param dirname: string, directory name
+		@returns: Boolean
+		'''
 		return dirname in [".hg"]

diff --git a/pym/repoman/modules/vcs/settings.py b/pym/repoman/modules/vcs/settings.py
index bcd5f18..f51c3b2 100644
--- a/pym/repoman/modules/vcs/settings.py
+++ b/pym/repoman/modules/vcs/settings.py
@@ -89,5 +89,5 @@ class VCSSettings(object):
 	def changes(self):
 		if not self._changes:
 			changes = self.module_controller.get_class('%s_changes' % self.vcs)
-			self._changes = changes(self.options, self.vcs)
+			self._changes = changes(self.options)
 		return self._changes

diff --git a/pym/repoman/modules/vcs/svn/__init__.py b/pym/repoman/modules/vcs/svn/__init__.py
index becb93e..6bb0b9a 100644
--- a/pym/repoman/modules/vcs/svn/__init__.py
+++ b/pym/repoman/modules/vcs/svn/__init__.py
@@ -1,7 +1,7 @@
 # Copyright 2014-2015 Gentoo Foundation
 # Distributed under the terms of the GNU General Public License v2
 
-doc = """SVN plug-in module for portage.
+doc = """Subversion (svn) plug-in module for portage.
 Performs variaous subversion actions and checks on repositories."""
 __doc__ = doc[:]
 

diff --git a/pym/repoman/modules/vcs/svn/changes.py b/pym/repoman/modules/vcs/svn/changes.py
index 639ee9f..9a0efbf 100644
--- a/pym/repoman/modules/vcs/svn/changes.py
+++ b/pym/repoman/modules/vcs/svn/changes.py
@@ -1,4 +1,6 @@
-
+'''
+Subversion module Changes class submodule
+'''
 
 from repoman.modules.vcs.changes import ChangesBase
 from repoman._subprocess import repoman_popen
@@ -12,9 +14,14 @@ class Changes(ChangesBase):
 	vcs = 'svn'
 
 	def __init__(self, options):
+		'''Class init
+
+		@param options: commandline options
+		'''
 		super(Changes, self).__init__(options)
 
 	def _scan(self):
+		'''VCS type scan function, looks for all detectable changes'''
 		with repoman_popen("svn status") as f:
 			svnstatus = f.readlines()
 		self.changed = [

diff --git a/pym/repoman/modules/vcs/svn/status.py b/pym/repoman/modules/vcs/svn/status.py
index ea8e102..3b57149 100644
--- a/pym/repoman/modules/vcs/svn/status.py
+++ b/pym/repoman/modules/vcs/svn/status.py
@@ -1,5 +1,5 @@
 '''
-SVN module Status class submodule
+Subversion module Status class submodule
 '''
 
 import logging
@@ -19,10 +19,22 @@ class Status(object):
 	'''Performs status checks on the svn repository'''
 
 	def __init__(self, qatracker, eadded):
+		'''Class init
+
+		@param qatracker: QATracker class instance
+		@param eadded: list
+		'''
 		self.qatracker = qatracker
 		self.eadded = eadded
 
 	def check(self, checkdir, checkdir_relative, xpkg):
+		'''Perform the svn status check
+
+		@param checkdir: string of the directory being checked
+		@param checkdir_relative: string of the relative directory being checked
+		@param xpkg: string of the package being checked
+		@returns: boolean
+		'''
 		try:
 			myf = repoman_popen(
 				"svn status --depth=files --verbose " +
@@ -68,8 +80,8 @@ class Status(object):
 
 		Args:
 			vcs - A string identifying the version control system in use
-		Returns:
-			None (calls sys.exit on fatal problems)
+		Returns: boolean
+			(calls sys.exit on fatal problems)
 		"""
 
 		cmd = "svn status -u 2>&1 | egrep -v '^.  +.*/digest-[^/]+' | head -n-1"
@@ -122,8 +134,17 @@ class Status(object):
 
 	@staticmethod
 	def supports_gpg_sign():
+		'''Does this vcs system support gpg commit signatures
+
+		@returns: Boolean
+		'''
 		return False
 
 	@staticmethod
 	def isVcsDir(dirname):
+		'''Is the directory belong to the vcs system
+
+		@param dirname: string, directory name
+		@returns: Boolean
+		'''
 		return dirname in [".svn"]


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

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

commit:     aeaaf16269055e1e78d7c47c07dde6b680fb529c
Author:     Brian Dolbec <dolsen <AT> gentoo <DOT> org>
AuthorDate: Tue Feb 16 20:06:30 2016 +0000
Commit:     Brian Dolbec <dolsen <AT> gentoo <DOT> org>
CommitDate: Fri Mar 11 01:05:23 2016 +0000
URL:        https://gitweb.gentoo.org/proj/portage.git/commit/?id=aeaaf162

repoman: Migrate the commit code to the vcs modules

 pym/repoman/actions.py                  | 84 +++++++++------------------------
 pym/repoman/modules/vcs/None/changes.py | 13 +++++
 pym/repoman/modules/vcs/bzr/changes.py  |  1 -
 pym/repoman/modules/vcs/changes.py      | 20 ++++++++
 pym/repoman/modules/vcs/cvs/changes.py  |  1 -
 pym/repoman/modules/vcs/git/changes.py  | 10 ++++
 pym/repoman/modules/vcs/hg/changes.py   | 17 +++++++
 7 files changed, 83 insertions(+), 63 deletions(-)

diff --git a/pym/repoman/actions.py b/pym/repoman/actions.py
index 4032e04..c0cd5cc 100644
--- a/pym/repoman/actions.py
+++ b/pym/repoman/actions.py
@@ -7,21 +7,19 @@ import io
 import logging
 import platform
 import signal
-import subprocess
 import sys
 import tempfile
 from itertools import chain
 
 from _emerge.UserQuery import UserQuery
 
-import portage
+from repoman._portage import portage
 from portage import os
 from portage import _encodings
 from portage import _unicode_encode
 from portage.output import (
 	bold, create_color_func, green, red)
 from portage.package.ebuild.digestgen import digestgen
-from portage.process import find_binary, spawn
 from portage.util import writemsg_level
 
 from repoman.gpg import gpgsign, need_signature
@@ -443,43 +441,18 @@ class Actions(object):
 		mymsg.write(_unicode_encode(commitmessage))
 		mymsg.close()
 
-		commit_cmd = []
-		if self.options.pretend and self.vcs_settings.vcs is None:
-			# substitute a bogus value for pretend output
-			commit_cmd.append("cvs")
-		else:
-			commit_cmd.append(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)
-		if self.vcs_settings.vcs == "hg":
-			commit_cmd.extend(["--logfile", commitmessagefile])
-			commit_cmd.extend(myfiles)
-		else:
-			commit_cmd.extend(["-F", commitmessagefile])
-			commit_cmd.extend(f.lstrip("./") for f in myfiles)
-
+		retval = self.vcs_settings.changes.commit(myfiles, commitmessagefile)
+		# cleanup the commit message before possibly exiting
 		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:
-					if self.repo_settings.repo_config.sign_commit and not self.vcs_settings.status.supports_gpg_sign():
-						# Inform user that newer git is needed (bug #403323).
-						logging.error(
-							"Git >=1.7.9 is required for signed commits!")
-
-					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
+			os.unlink(commitmessagefile)
+		except OSError:
+			pass
+		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)
 
 
 	def priming_commit(self, myupdates, myremoved, commitmessage):
@@ -503,29 +476,18 @@ class Actions(object):
 		# 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)
-
+		retval = self.vcs_settings.changes.commit(myfiles, commitmessagefile)
+		# cleanup the commit message before possibly exiting
 		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
+			os.unlink(commitmessagefile)
+		except OSError:
+			pass
+		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)
 
 
 	def sign_manifest(self, myupdates, myremoved, mymanifests):

diff --git a/pym/repoman/modules/vcs/None/changes.py b/pym/repoman/modules/vcs/None/changes.py
index 98beedb..7f46177 100644
--- a/pym/repoman/modules/vcs/None/changes.py
+++ b/pym/repoman/modules/vcs/None/changes.py
@@ -26,3 +26,16 @@ class Changes(ChangesBase):
 	def add_items(self, myautoadd):
 		'''Nothing to add them to'''
 		pass
+
+	def commit(self, myfiles, commitmessagefile):
+		commit_cmd = []
+		# substitute a bogus vcs value for pretend output
+		commit_cmd.append("pretend")
+		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(f.lstrip("./") for f in myfiles)
+
+		print("(%s)" % (" ".join(commit_cmd),))
+		return 0

diff --git a/pym/repoman/modules/vcs/bzr/changes.py b/pym/repoman/modules/vcs/bzr/changes.py
index 81e7cf5..e5e61ff 100644
--- a/pym/repoman/modules/vcs/bzr/changes.py
+++ b/pym/repoman/modules/vcs/bzr/changes.py
@@ -57,4 +57,3 @@ 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)
-

diff --git a/pym/repoman/modules/vcs/changes.py b/pym/repoman/modules/vcs/changes.py
index ee94217..f322cb1 100644
--- a/pym/repoman/modules/vcs/changes.py
+++ b/pym/repoman/modules/vcs/changes.py
@@ -10,6 +10,8 @@ from itertools import chain
 
 from repoman._portage import portage
 from portage import _unicode_encode
+from portage.process import spawn
+
 
 class ChangesBase(object):
 	'''Base Class object to scan and hold the resultant data
@@ -22,6 +24,7 @@ class ChangesBase(object):
 		self.options = options
 		self.repo_settings = repo_settings
 		self.repoman_settings = repo_settings.repoman_settings
+		self.vcs_settings = repo_settings.vcs_settings
 		self._reset()
 
 	def _reset(self):
@@ -109,3 +112,20 @@ class ChangesBase(object):
 					logging.error(
 						"Exiting on %s error code: %s\n" % (self.vcs_settings.vcs, retcode))
 					sys.exit(retcode)
+
+
+	def commit(self, myfiles, commitmessagefile):
+		'''Common generic commit function'''
+		commit_cmd = []
+		commit_cmd.append(self.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(f.lstrip("./") for f in myfiles)
+
+		if self.options.pretend:
+			print("(%s)" % (" ".join(commit_cmd),))
+		else:
+			retval = spawn(commit_cmd, env=self.repo_settings.commit_env)
+		return retval

diff --git a/pym/repoman/modules/vcs/cvs/changes.py b/pym/repoman/modules/vcs/cvs/changes.py
index 794e850..f5c622b 100644
--- a/pym/repoman/modules/vcs/cvs/changes.py
+++ b/pym/repoman/modules/vcs/cvs/changes.py
@@ -89,4 +89,3 @@ class Changes(ChangesBase):
 				scanner.repolevel, scanner.reposplit, scanner.categories)):
 				self.repoman_settings["O"] = os.path.join(self.repo_settings.repodir, x)
 				digestgen(mysettings=self.repoman_settings, myportdb=self.repo_settings.portdb)
-

diff --git a/pym/repoman/modules/vcs/git/changes.py b/pym/repoman/modules/vcs/git/changes.py
index 018458c..a0b836e 100644
--- a/pym/repoman/modules/vcs/git/changes.py
+++ b/pym/repoman/modules/vcs/git/changes.py
@@ -90,3 +90,13 @@ class Changes(ChangesBase):
 					"error code: %s\n" % (self.vcs_settings.vcs, retval),
 					level=logging.ERROR, noiselevel=-1)
 				sys.exit(retval)
+
+	def commit(self, myfiles, commitmessagefile):
+		'''Git commit the changes'''
+		retval = super(Changes, self).commit(myfiles, commitmessagefile)
+		if retval != os.EX_OK:
+			if self.repo_settings.repo_config.sign_commit and not self.vcs_settings.status.supports_gpg_sign():
+				# Inform user that newer git is needed (bug #403323).
+				logging.error(
+					"Git >=1.7.9 is required for signed commits!")
+		return retval

diff --git a/pym/repoman/modules/vcs/hg/changes.py b/pym/repoman/modules/vcs/hg/changes.py
index 2667829..c8b0c5f 100644
--- a/pym/repoman/modules/vcs/hg/changes.py
+++ b/pym/repoman/modules/vcs/hg/changes.py
@@ -7,6 +7,7 @@ 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
 
 
 class Changes(ChangesBase):
@@ -71,3 +72,19 @@ 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 commit(self, myfiles, commitmessagefile):
+		'''Hg commit the changes'''
+		commit_cmd = []
+		commit_cmd.append(self.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(["--logfile", commitmessagefile])
+		commit_cmd.extend(myfiles)
+
+		if self.options.pretend:
+			print("(%s)" % (" ".join(commit_cmd),))
+		else:
+			retval = spawn(commit_cmd, env=self.repo_settings.commit_env)
+		return retval


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

end of thread, other threads:[~2016-03-11  1:07 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-01-31 20:03 [gentoo-commits] proj/portage:repoman commit in: pym/repoman/modules/vcs/, pym/repoman/modules/vcs/bzr/, Brian Dolbec
  -- strict thread matches above, loose matches on Subject: below --
2016-03-11  1:07 Brian Dolbec

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