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/cvs/, ...
@ 2016-01-29  5:01 Brian Dolbec
  0 siblings, 0 replies; only message in thread
From: Brian Dolbec @ 2016-01-29  5:01 UTC (permalink / raw
  To: gentoo-commits

commit:     528210720df08250e81ae98f85ef29a5aa6be1a2
Author:     Brian Dolbec <dolsen <AT> gentoo <DOT> org>
AuthorDate: Fri Jan 29 04:48:56 2016 +0000
Commit:     Brian Dolbec <dolsen <AT> gentoo <DOT> org>
CommitDate: Fri Jan 29 04:57:01 2016 +0000
URL:        https://gitweb.gentoo.org/proj/portage.git/commit/?id=52821072

repoman: Migrate actions.py vcs code to the vcs modules

Add missing changes code to the existing Changes classes.
This removes the duplicated code in the Actions class.
It alsosspeeds up the run by not calling the vcs binary to scan for changes a second time.
Optimize the code for the vcs modules.

 pym/repoman/actions.py                    | 208 ++++--------------------------
 pym/repoman/modules/vcs/None/__init__.py  |   1 +
 pym/repoman/modules/vcs/bzr/__init__.py   |   1 +
 pym/repoman/modules/vcs/bzr/bzrchanges.py |  15 ++-
 pym/repoman/modules/vcs/changes.py        |  13 ++
 pym/repoman/modules/vcs/cvs/__init__.py   |   1 +
 pym/repoman/modules/vcs/cvs/cvschanges.py |  13 +-
 pym/repoman/modules/vcs/git/__init__.py   |   1 +
 pym/repoman/modules/vcs/git/gitchanges.py |  20 ++-
 pym/repoman/modules/vcs/hg/__init__.py    |   1 +
 pym/repoman/modules/vcs/hg/hgchanges.py   |  27 +++-
 pym/repoman/modules/vcs/settings.py       |   5 +-
 pym/repoman/modules/vcs/svn/__init__.py   |   1 +
 pym/repoman/modules/vcs/svn/svnchanges.py |  24 +++-
 14 files changed, 118 insertions(+), 213 deletions(-)

diff --git a/pym/repoman/actions.py b/pym/repoman/actions.py
index 3fd940c..8cf4a97 100644
--- a/pym/repoman/actions.py
+++ b/pym/repoman/actions.py
@@ -16,7 +16,6 @@ from itertools import chain
 from _emerge.UserQuery import UserQuery
 
 import portage
-from portage import cvstree
 from portage import os
 from portage import _encodings
 from portage import _unicode_encode
@@ -26,8 +25,7 @@ from portage.package.ebuild.digestgen import digestgen
 from portage.process import find_binary, spawn
 from portage.util import writemsg_level
 
-from repoman._subprocess import repoman_popen, repoman_getstatusoutput
-from repoman.errors import err
+from repoman._subprocess import repoman_getstatusoutput
 from repoman.gpg import gpgsign, need_signature
 from repoman import utilities
 from repoman.modules.vcs.vcs import vcs_files_to_cps
@@ -71,13 +69,11 @@ class Actions(object):
 
 
 	def perform(self, qa_output):
-		myunadded, mydeleted = self._vcs_unadded()
+		myautoadd = self._vcs_autoadd()
 
-		myautoadd = self._vcs_autoadd(myunadded)
+		self._vcs_deleted()
 
-		self._vcs_deleted(mydeleted)
-
-		changes = self.get_vcs_changed(mydeleted)
+		changes = self.get_vcs_changed()
 
 		mynew, mychanged, myremoved, no_expansion, expansion = changes
 
@@ -127,8 +123,8 @@ class Actions(object):
 
 		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
+		if 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.
 			print()
@@ -261,62 +257,8 @@ class Actions(object):
 			sys.exit(1)
 
 
-	def _vcs_unadded(self):
-		myunadded = []
-		mydeleted = []
-		if self.vcs_settings.vcs == "cvs":
-			try:
-				myvcstree = portage.cvstree.getentries("./", recursive=1)
-				myunadded = portage.cvstree.findunadded(
-					myvcstree, recursive=1, basedir="./")
-			except SystemExit:
-				raise  # TODO propagate this
-			except:
-				err("Error retrieving CVS tree; exiting.")
-		if self.vcs_settings.vcs == "svn":
-			try:
-				with repoman_popen("svn status --no-ignore") as f:
-					svnstatus = f.readlines()
-				myunadded = [
-					"./" + elem.rstrip().split()[1]
-					for elem in svnstatus
-					if elem.startswith("?") or elem.startswith("I")]
-			except SystemExit:
-				raise  # TODO propagate this
-			except:
-				err("Error retrieving SVN info; exiting.")
-		if self.vcs_settings.vcs == "git":
-			# get list of files not under version control or missing
-			myf = repoman_popen("git ls-files --others")
-			myunadded = ["./" + elem[:-1] for elem in myf]
-			myf.close()
-		if self.vcs_settings.vcs == "bzr":
-			try:
-				with repoman_popen("bzr status -S .") as f:
-					bzrstatus = f.readlines()
-				myunadded = [
-					"./" + elem.rstrip().split()[1].split('/')[-1:][0]
-					for elem in bzrstatus
-					if elem.startswith("?") or elem[0:2] == " D"]
-			except SystemExit:
-				raise # TODO propagate this
-			except:
-				err("Error retrieving bzr info; exiting.")
-		if self.vcs_settings.vcs == "hg":
-			with repoman_popen("hg status --no-status --unknown .") as f:
-				myunadded = f.readlines()
-			myunadded = ["./" + elem.rstrip() for elem in myunadded]
-
-			# Mercurial doesn't handle manually deleted files as removed from
-			# the repository, so the user need to remove them before commit,
-			# using "hg remove [FILES]"
-			with repoman_popen("hg status --no-status --deleted .") as f:
-				mydeleted = f.readlines()
-			mydeleted = ["./" + elem.rstrip() for elem in mydeleted]
-		return myunadded, mydeleted
-
-
-	def _vcs_autoadd(self, myunadded):
+	def _vcs_autoadd(self):
+		myunadded = self.vcs_settings.changes.unadded
 		myautoadd = []
 		if myunadded:
 			for x in range(len(myunadded) - 1, -1, -1):
@@ -348,137 +290,35 @@ class Actions(object):
 		return myautoadd
 
 
-	def _vcs_deleted(self, mydeleted):
-		if self.vcs_settings.vcs == "hg" and mydeleted:
+	def _vcs_deleted(self):
+		if self.vcs_settings.changes.has_deleted():
 			print(red(
 				"!!! The following files are removed manually"
 				" from your local tree but are not"))
 			print(red(
 				"!!! removed from the repository."
-				" Please remove them, using \"hg remove [FILES]\"."))
-			for x in mydeleted:
+				" Please remove them, using \"%s remove [FILES]\"."
+				% self.vcs_settings.vcs))
+			for x in self.vcs_settings.changes.deleted:
 				print("   ", x)
 			print()
 			print()
 			sys.exit(1)
 
 
-	def get_vcs_changed(self, mydeleted):
+	def get_vcs_changed(self):
 		'''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_changed_cvs_(self, mydeleted):
-		mycvstree = cvstree.getentries("./", recursive=1)
-		mychanged = cvstree.findchanged(mycvstree, recursive=1, basedir="./")
-		mynew = cvstree.findnew(mycvstree, recursive=1, basedir="./")
-		myremoved = portage.cvstree.findremoved(mycvstree, recursive=1, basedir="./")
-		bin_blob_pattern = re.compile("^-kb$")
-		no_expansion = set(portage.cvstree.findoption(
-			mycvstree, bin_blob_pattern, recursive=1, basedir="./"))
-		expansion = {}
-		return  (mynew, mychanged, myremoved, no_expansion, expansion)
-
-	def _get_changed_svn_(self, mydeleted):
-		with repoman_popen("svn status") as f:
-			svnstatus = f.readlines()
-		mychanged = [
-			"./" + elem.split()[-1:][0]
-			for elem in svnstatus
-			if (elem[:1] in "MR" or elem[1:2] in "M")]
-		mynew = [
-			"./" + elem.split()[-1:][0]
-			for elem in svnstatus
-			if elem.startswith("A")]
-		myremoved = [
-			"./" + elem.split()[-1:][0]
-			for elem in svnstatus
-			if elem.startswith("D")]
-		# Subversion expands keywords specified in svn:keywords properties.
-		with repoman_popen("svn propget -R svn:keywords") as f:
-			props = f.readlines()
-		expansion = dict(
-			("./" + prop.split(" - ")[0], prop.split(" - ")[1].split())
-			for prop in props if " - " in prop)
-		no_expansion = set()
-		return  (mynew, mychanged, myremoved, no_expansion, expansion)
-
-	def _get_changed_git_(self, mydeleted):
-		with repoman_popen(
-			"git diff-index --name-only "
-			"--relative --diff-filter=M HEAD") as f:
-			mychanged = f.readlines()
-		mychanged = ["./" + elem[:-1] for elem in mychanged]
-		with repoman_popen(
-			"git diff-index --name-only "
-			"--relative --diff-filter=A HEAD") as f:
-			mynew = f.readlines()
-		mynew = ["./" + elem[:-1] for elem in mynew]
-		with repoman_popen(
-			"git diff-index --name-only "
-			"--relative --diff-filter=D HEAD") as f:
-			myremoved = f.readlines()
-		myremoved = ["./" + elem[:-1] for elem in myremoved]
-		no_expansion = set()
-		expansion = {}
-		return  (mynew, mychanged, myremoved, no_expansion, expansion)
-
-	def _get_changed_bzr_(self, mydeleted):
-		with repoman_popen("bzr status -S .") as f:
-			bzrstatus = f.readlines()
-		mychanged = [
-			"./" + elem.split()[-1:][0].split('/')[-1:][0]
-			for elem in bzrstatus
-			if elem and elem[1:2] == "M"]
-		mynew = [
-			"./" + elem.split()[-1:][0].split('/')[-1:][0]
-			for elem in bzrstatus
-			if elem and (elem[1:2] in "NK" or elem[0:1] == "R")]
-		myremoved = [
-			"./" + elem.split()[-1:][0].split('/')[-1:][0]
-			for elem in bzrstatus
-			if elem.startswith("-")]
-		myremoved = [
-			"./" + elem.split()[-3:-2][0].split('/')[-1:][0]
-			for elem in bzrstatus
-			if elem and (elem[1:2] == "K" or elem[0:1] == "R")]
-		# Bazaar expands nothing.
-		no_expansion = set()
-		expansion = {}
-		return  (mynew, mychanged, myremoved, no_expansion, expansion)
-
-	def _get_changed_hg_(self, mydeleted):
-		with repoman_popen("hg status --no-status --modified .") as f:
-			mychanged = f.readlines()
-		mychanged = ["./" + elem.rstrip() for elem in mychanged]
-
-		with repoman_popen("hg status --no-status --added .") as f:
-			mynew = f.readlines()
-		mynew = ["./" + elem.rstrip() for elem in mynew]
-
-		with repoman_popen("hg status --no-status --removed .") as f:
-			myremoved = f.readlines()
-		myremoved = ["./" + elem.rstrip() for elem in myremoved]
-		no_expansion = set()
-		expansion = {}
-		return  (mynew, mychanged, myremoved, no_expansion, expansion)
+		changes = self.vcs_settings.vcs.changes
 
+		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_commit_footer(self):
 		portage_version = getattr(portage, "VERSION", None)

diff --git a/pym/repoman/modules/vcs/None/__init__.py b/pym/repoman/modules/vcs/None/__init__.py
index 166b423..adfbe96 100644
--- a/pym/repoman/modules/vcs/None/__init__.py
+++ b/pym/repoman/modules/vcs/None/__init__.py
@@ -19,6 +19,7 @@ module_spec = {
 			'func_desc': {
 			},
 			'vcs_preserves_mtime': False,
+			'needs_keyword_expansion': False,
 		},
 		'None-changes': {
 			'name': "Nonechanges",

diff --git a/pym/repoman/modules/vcs/bzr/__init__.py b/pym/repoman/modules/vcs/bzr/__init__.py
index b4c9e75..af150bc 100644
--- a/pym/repoman/modules/vcs/bzr/__init__.py
+++ b/pym/repoman/modules/vcs/bzr/__init__.py
@@ -19,6 +19,7 @@ module_spec = {
 			'func_desc': {
 			},
 			'vcs_preserves_mtime': True,
+			'needs_keyword_expansion': False,
 		},
 		'bzr-changes': {
 			'name': "bzrchanges",

diff --git a/pym/repoman/modules/vcs/bzr/bzrchanges.py b/pym/repoman/modules/vcs/bzr/bzrchanges.py
index f37aec8..465bd24 100644
--- a/pym/repoman/modules/vcs/bzr/bzrchanges.py
+++ b/pym/repoman/modules/vcs/bzr/bzrchanges.py
@@ -23,8 +23,13 @@ class Changes(ChangesBase):
 			"./" + elem.split()[-1:][0].split('/')[-1:][0]
 			for elem in bzrstatus
 			if elem and (elem[1:2] == "NK" or elem[0:1] == "R")]
-		if self.options.if_modified == "y":
-			self.removed = [
-				"./" + elem.split()[-3:-2][0].split('/')[-1:][0]
-				for elem in bzrstatus
-				if elem and (elem[1:2] == "K" or elem[0:1] == "R")]
+		#if self.options.if_modified == "y":
+		self.removed = [
+			"./" + elem.split()[-3:-2][0].split('/')[-1:][0]
+			for elem in bzrstatus
+			if elem and (elem[1:2] == "K" or elem[0:1] == "R")]
+		self.unadded = [
+			"./" + elem.rstrip().split()[1].split('/')[-1:][0]
+			for elem in bzrstatus
+			if elem.startswith("?") or elem[0:2] == " D"]
+		# Bazaar expands nothing.

diff --git a/pym/repoman/modules/vcs/changes.py b/pym/repoman/modules/vcs/changes.py
index 788f157..6a425b8 100644
--- a/pym/repoman/modules/vcs/changes.py
+++ b/pym/repoman/modules/vcs/changes.py
@@ -20,6 +20,10 @@ class ChangesBase(object):
 		self.changed = []
 		self.new = []
 		self.removed = []
+		self.no_expansion = set()
+		self.expansion = {}
+		self.deleted = []
+		self.unadded = []
 
 	def scan(self):
 		self._reset()
@@ -36,3 +40,12 @@ class ChangesBase(object):
 		'''Placeholder for subclassing'''
 		pass
 
+	@property
+	def has_deleted(self):
+		'''Placeholder for VCS that requires manual deletion of files'''
+		return self.deleted != []
+
+	@property
+	def has_changes(self):
+		'''Placeholder for VCS repo common has changes result'''
+		return (self.changed or self.new or self.removed or self.deleted) == []

diff --git a/pym/repoman/modules/vcs/cvs/__init__.py b/pym/repoman/modules/vcs/cvs/__init__.py
index 62d288d..cb918f5 100644
--- a/pym/repoman/modules/vcs/cvs/__init__.py
+++ b/pym/repoman/modules/vcs/cvs/__init__.py
@@ -19,6 +19,7 @@ module_spec = {
 			'func_desc': {
 			},
 			'vcs_preserves_mtime': True,
+			'needs_keyword_expansion': True,
 		},
 		'cvs-changes': {
 			'name': "cvschanges",

diff --git a/pym/repoman/modules/vcs/cvs/cvschanges.py b/pym/repoman/modules/vcs/cvs/cvschanges.py
index 6e9dc83..b28dfe4 100644
--- a/pym/repoman/modules/vcs/cvs/cvschanges.py
+++ b/pym/repoman/modules/vcs/cvs/cvschanges.py
@@ -1,7 +1,9 @@
 
 
-from portage import cvstree
+from repoman._portage import portage
 from repoman.modules.vcs.changes import ChangesBase
+from portage import cvstree
+
 
 class Changes(ChangesBase):
 	'''Class object to scan and hold the resultant data
@@ -12,9 +14,12 @@ class Changes(ChangesBase):
 		super(Changes, self).__init__(options, vcs)
 
 	def _scan(self):
-		tree = cvstree.getentries("./", recursive=1)
+		tree = portage.cvstree.getentries("./", recursive=1)
 		self.changed = cvstree.findchanged(tree, recursive=1, basedir="./")
 		self.new = cvstree.findnew(tree, recursive=1, basedir="./")
-		if self.options.if_modified == "y":
-			self.removed = cvstree.findremoved(tree, recursive=1, basedir="./")
+		self.removed = cvstree.findremoved(tree, recursive=1, basedir="./")
+		myunadded = portage.cvstree.findunadded(myvcstree, recursive=1, basedir="./")
+		bin_blob_pattern = re.compile("^-kb$")
+		self.no_expansion = set(portage.cvstree.findoption(
+			mycvstree, bin_blob_pattern, recursive=1, basedir="./"))
 		del tree

diff --git a/pym/repoman/modules/vcs/git/__init__.py b/pym/repoman/modules/vcs/git/__init__.py
index 56e1393..246d22a 100644
--- a/pym/repoman/modules/vcs/git/__init__.py
+++ b/pym/repoman/modules/vcs/git/__init__.py
@@ -19,6 +19,7 @@ module_spec = {
 			'func_desc': {
 			},
 			'vcs_preserves_mtime': False,
+			'needs_keyword_expansion': False,
 		},
 		'git-changes': {
 			'name': "gitchanges",

diff --git a/pym/repoman/modules/vcs/git/gitchanges.py b/pym/repoman/modules/vcs/git/gitchanges.py
index b7ab31d..9431df4 100644
--- a/pym/repoman/modules/vcs/git/gitchanges.py
+++ b/pym/repoman/modules/vcs/git/gitchanges.py
@@ -25,11 +25,17 @@ class Changes(ChangesBase):
 			"--relative --diff-filter=A HEAD") as f:
 			new = f.readlines()
 		self.new = ["./" + elem[:-1] for elem in new]
-		if self.options.if_modified == "y":
-			with repoman_popen(
-				"git diff-index --name-only "
-				"--relative --diff-filter=D HEAD") as f:
-				removed = f.readlines()
-			self.removed = ["./" + elem[:-1] for elem in removed]
-			del removed
+		del new
 
+		with repoman_popen(
+			"git diff-index --name-only "
+			"--relative --diff-filter=D HEAD") as f:
+			removed = f.readlines()
+		self.removed = ["./" + elem[:-1] for elem in removed]
+		del removed
+
+		# get list of files not under version control or missing
+		with repoman_popen("git ls-files --others") as f:
+			unadded = f.readlines()
+		self.unadded = ["./" + elem[:-1] for elem in unadded]
+		del unadded

diff --git a/pym/repoman/modules/vcs/hg/__init__.py b/pym/repoman/modules/vcs/hg/__init__.py
index 32c648d..efe8a31 100644
--- a/pym/repoman/modules/vcs/hg/__init__.py
+++ b/pym/repoman/modules/vcs/hg/__init__.py
@@ -19,6 +19,7 @@ module_spec = {
 			'func_desc': {
 			},
 			'vcs_preserves_mtime': False,
+			'needs_keyword_expansion': False,
 		},
 		'hg-changes': {
 			'name': "hgchanges",

diff --git a/pym/repoman/modules/vcs/hg/hgchanges.py b/pym/repoman/modules/vcs/hg/hgchanges.py
index 180301b..bc552dd 100644
--- a/pym/repoman/modules/vcs/hg/hgchanges.py
+++ b/pym/repoman/modules/vcs/hg/hgchanges.py
@@ -16,12 +16,27 @@ class Changes(ChangesBase):
 		with repoman_popen("hg status --no-status --modified .") as f:
 			changed = f.readlines()
 		self.changed = ["./" + elem.rstrip() for elem in changed]
+		del changed
+
 		with repoman_popen("hg status --no-status --added .") as f:
 			new = f.readlines()
 		self.new = ["./" + elem.rstrip() for elem in new]
-		if self.options.if_modified == "y":
-			with repoman_popen("hg status --no-status --removed .") as f:
-				removed = f.readlines()
-			self.removed = ["./" + elem.rstrip() for elem in removed]
-			del removed
-		del changed, new
+		del new
+
+		with repoman_popen("hg status --no-status --removed .") as f:
+			removed = f.readlines()
+		self.removed = ["./" + elem.rstrip() for elem in removed]
+		del removed
+
+		with repoman_popen("hg status --no-status --unknown .") as f:
+			unadded = f.readlines()
+		self.unadded = ["./" + elem.rstrip() for elem in unadded]
+		del unadded
+
+		# Mercurial doesn't handle manually deleted files as removed from
+		# the repository, so the user need to remove them before commit,
+		# using "hg remove [FILES]"
+		with repoman_popen("hg status --no-status --deleted .") as f:
+			deleted = f.readlines()
+		self.deleted = ["./" + elem.rstrip() for elem in deleted]
+		del deleted

diff --git a/pym/repoman/modules/vcs/settings.py b/pym/repoman/modules/vcs/settings.py
index 52bbb89..7fc0c99 100644
--- a/pym/repoman/modules/vcs/settings.py
+++ b/pym/repoman/modules/vcs/settings.py
@@ -4,7 +4,6 @@ from __future__ import print_function, unicode_literals
 import logging
 import sys
 
-from repoman._portage import portage
 from portage.output import red
 from repoman.modules.vcs import module_controller, module_names
 from repoman.modules.vcs.vcs import FindVCS
@@ -58,6 +57,8 @@ class VCSSettings(object):
 			logging.error("VCSSettings: Unknown VCS type: %s", self.vcs)
 			logging.error("Available modules: %s", module_controller.parents)
 
+		self.needs_keyword_expansion = module_controller.modules[
+				"%sstatus" % self.vcs]['needs_keyword_expansion']
 		self.vcs_local_opts = repoman_settings.get(
 			"REPOMAN_VCS_LOCAL_OPTS", "").split()
 		self.vcs_global_opts = repoman_settings.get(
@@ -88,5 +89,5 @@ class VCSSettings(object):
 	def changes(self):
 		if not self._changes:
 			changes = self.module_controller.get_class('%schanges' % self.vcs)
-			self._changes = changes(self.options)
+			self._changes = changes(self.options, self.vcs)
 		return self._changes

diff --git a/pym/repoman/modules/vcs/svn/__init__.py b/pym/repoman/modules/vcs/svn/__init__.py
index 7455640..d9d2e8c 100644
--- a/pym/repoman/modules/vcs/svn/__init__.py
+++ b/pym/repoman/modules/vcs/svn/__init__.py
@@ -19,6 +19,7 @@ module_spec = {
 			'func_desc': {
 			},
 			'vcs_preserves_mtime': False,
+			'needs_keyword_expansion': True,
 		},
 		'svn-changes': {
 			'name': "svnchanges",

diff --git a/pym/repoman/modules/vcs/svn/svnchanges.py b/pym/repoman/modules/vcs/svn/svnchanges.py
index c023c74..7743da9 100644
--- a/pym/repoman/modules/vcs/svn/svnchanges.py
+++ b/pym/repoman/modules/vcs/svn/svnchanges.py
@@ -23,9 +23,23 @@ class Changes(ChangesBase):
 			"./" + elem.split()[-1:][0]
 			for elem in svnstatus
 			if elem.startswith("A")]
-		if self.options.if_modified == "y":
-			self.removed = [
-				"./" + elem.split()[-1:][0]
-				for elem in svnstatus
-				if elem.startswith("D")]
+		self.removed = [
+			"./" + elem.split()[-1:][0]
+			for elem in svnstatus
+			if elem.startswith("D")]
+
+		# Subversion expands keywords specified in svn:keywords properties.
+		with repoman_popen("svn propget -R svn:keywords") as f:
+			props = f.readlines()
+		self.expansion = dict(
+			("./" + prop.split(" - ")[0], prop.split(" - ")[1].split())
+			for prop in props if " - " in prop)
+		del props
 
+		with repoman_popen("svn status --no-ignore") as f:
+			svnstatus = f.readlines()
+		self.unadded = [
+			"./" + elem.rstrip().split()[1]
+			for elem in svnstatus
+			if elem.startswith("?") or elem.startswith("I")]
+		del svnstatus


^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2016-01-29  5:01 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-01-29  5:01 [gentoo-commits] proj/portage:repoman commit in: pym/repoman/modules/vcs/, pym/repoman/modules/vcs/cvs/, Brian Dolbec

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