changeset 63:670c2af462f6

Mercurial filter validation.
author John Schneiderman
date Tue, 07 Apr 2015 19:37:30 +0200
parents e082759a26b8
children 4f295ab3a0b7
files src/ignorepo.py src/manager.py
diffstat 2 files changed, 5 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/src/ignorepo.py	Tue Apr 07 19:07:10 2015 +0200
+++ b/src/ignorepo.py	Tue Apr 07 19:37:30 2015 +0200
@@ -28,11 +28,12 @@
 
 def ignore_syntax_name(mapFilterType):
 	""" Provides the mapping between an enumerated filter type and the
-	Mercurial ignore section header. If an invalid argument is supplied, an
-	empty string is given.
+	Mercurial ignore section header.
 
 	@param[in] mapFilterType	Is the enumerated value to map.
 
+	@throws ValueError	When an invalid filtering type is supplied.
+
 	@return The string value of the supplied enumerated value.
 	"""
 	if FilterType.Glob == mapFilterType:
@@ -40,7 +41,7 @@
 	elif FilterType.RegularExpression == mapFilterType:
 		return 'regexp'
 	else:
-		return ''
+		raise ValueError("Unknown filter type supplied, '%s'." % mapFilterType)
 
 
 class Pattern(object):
--- a/src/manager.py	Tue Apr 07 19:07:10 2015 +0200
+++ b/src/manager.py	Tue Apr 07 19:37:30 2015 +0200
@@ -538,7 +538,7 @@
 	import os
 
 	print 'Securing for Windows ...'
-	status = subprocess.call(["attrib.exe", '+H', '+I', '+S', settings.RepositoryPath + os.sep + repo.StorageName + os.sep + '.hg'])
+	status = subprocess.call(['attrib.exe', '+H', '+I', '+S', settings.RepositoryPath + os.sep + repo.StorageName + os.sep + '.hg'])
 
 	if not (0 == status):
 		raise RuntimeError("Failed to secure repository store for windows. Status code: " + status)